RustAssistant/app/src/main/java/com/coldmint/rust/pro/AboutActivity.kt

127 lines
6.2 KiB
Kotlin
Raw Normal View History

2022-04-04 14:03:10 +00:00
package com.coldmint.rust.pro
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.text.Html
2022-07-16 14:41:37 +00:00
import android.view.Menu
import android.view.MenuItem
2022-04-04 14:03:10 +00:00
import android.view.View
import com.coldmint.rust.core.web.ServerConfiguration
import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityAboutBinding
import com.coldmint.rust.pro.tool.AppSettings
import java.text.SimpleDateFormat
class AboutActivity : BaseActivity<ActivityAboutBinding>() {
2022-07-16 14:41:37 +00:00
fun initView() {
try {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
viewBinding.versionView.text = "v." + packageInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
val year = Integer.valueOf(SimpleDateFormat("yyyy").format(System.currentTimeMillis()))
val copyright = String.format(getString(R.string.copyright), year)
viewBinding.copyRightView.text = copyright
val aboutText = """<h6>起源</h6>
2022-04-04 14:03:10 +00:00
|<p>2020年我发现了这款游戏Rusted Warfare并开始学习制作简单的模组</p>
|
|<p>因为之前有开发过App的经验积累了一点技术导致某天突发奇想"这个游戏的模组制作好简单或许可以制作一款App来降低模组的开发门槛。"于是就起手开发1.x版本的铁锈助手了在某些方面也受到了铁锈工具的影响那时铁圈用的辅助大多数都是铁锈工具中文转换功能很方便</p>
|
|<p>我发现铁锈工具使用iapp开发的我最早是玩iapp入坑的程序圈的也对iapp了解一点那时刷到了结绳的视频一看中文编程很有意思于是就开始学习结绳</p>
|
|<p>结绳开发的App体积很小才几kb运行速度上一点不次于iapp开发的App我那时特别喜欢体积小的App于是就改用结绳开发新的软件</p>
|
|<p>那是正值高三暑假因为我是个学渣嘛走的单招并且受疫情影响放假时间很长大概6个月吧我也不爱出门憋在家里开发了1.x版本铁锈助手</p>
|
|<h6>发展</h6>
|
|<p>漫长的假期过了一半大概3个月吧我就完成了初版本的开发然后在QQ中文网百度贴吧进行宣传</p>
|
|<p>因为那是常玩结绳我日常活跃在"结绳官方1群"某天看到群友开发的结绳助手上架了酷安就开始梦想自己的App有朝一日也可以上架到酷安市场</p>
|
|<p>于是开始尝试上传到酷安成为一名开发者大概整改了2个版本花了14天左右我的软件经过酷安审核了与大家见面了</p>
|
|<p>将软件上传到酷安显得比较正式一点也是小编们对独立开发者的认可高兴死了~</p>
|
|<h6>转折</h6>
|
|<p>要从哔哩哔哩投稿视频说起那时我抱着试一试的心情投稿了第一部助手介绍视频引来了好多小伙伴的围观群里也慢慢热闹了起来<p>
|
|<p>建立了2个500人群后来又合并群</p>
|
|<h6>现在</h6>
|
|<p>铁锈助手2.0版本用零零散散的时间开发了1年开发语言以及开发环境都特别的正式了</p>
|<p>环境移到了电脑上使用Android Studio开发开发语言也从java迁移至了Kotlin</p>
|<p>越来越正式了更多的新功能也在慢慢的加入</p>
|
|
""".trimMargin()
2022-07-16 14:41:37 +00:00
viewBinding.aboutView.text = Html.fromHtml(aboutText)
val time = appSettings.getValue(AppSettings.Setting.ExpirationTime, 0.toLong())
if (time == 0.toLong()) {
viewBinding.expirationTimeView.text = getString(R.string.please_login_first)
} else {
val stringTime = ServerConfiguration.toStringTime(time)
viewBinding.expirationTimeView.text =
if (stringTime == ServerConfiguration.ForeverTime) {
getString(R.string.forever_time)
} else {
String.format(
getString(R.string.expiration_time_tip),
stringTime
)
}
}
2022-04-04 14:03:10 +00:00
}
2022-07-16 14:41:37 +00:00
fun initAction() {
viewBinding.privacyPolicyView.setOnClickListener {
val link =
ServerConfiguration.getRealLink("/resources/agreement/privacy_policy.html")
val thisIntent = Intent(this, BrowserActivity::class.java)
thisIntent.putExtra("link", link)
startActivity(thisIntent)
2022-04-04 14:03:10 +00:00
}
2022-07-16 14:41:37 +00:00
viewBinding.serviceAgreementView.setOnClickListener {
val link =
ServerConfiguration.getRealLink("/resources/agreement/service_agreement.html")
val thisIntent = Intent(this, BrowserActivity::class.java)
thisIntent.putExtra("link", link)
startActivity(thisIntent)
}
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_about, menu)
return true
2022-04-04 14:03:10 +00:00
}
2022-07-16 14:41:37 +00:00
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.thanks -> {
startActivity(Intent(this, ThanksActivity::class.java))
}
R.id.libs -> {
startActivity(Intent(this, LibraryActivity::class.java))
}
}
return super.onOptionsItemSelected(item)
}
2022-04-04 14:03:10 +00:00
override fun getViewBindingObject(): ActivityAboutBinding {
return ActivityAboutBinding.inflate(layoutInflater)
}
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
setReturnButton()
setTitle(R.string.about)
initView()
initAction()
}
}
}