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

49 lines
1.7 KiB
Kotlin
Raw Normal View History

2022-04-04 14:03:10 +00:00
package com.coldmint.rust.pro
import android.os.Bundle
2022-08-14 02:43:53 +00:00
import android.view.LayoutInflater
2022-04-04 14:03:10 +00:00
import com.coldmint.rust.pro.base.BaseActivity
import android.view.View
import com.coldmint.rust.core.tool.AppOperator
import com.coldmint.rust.pro.databinding.ActivityGameCheckBinding
import com.coldmint.rust.pro.tool.GlobalMethod
import com.google.android.material.snackbar.Snackbar
import com.coldmint.rust.pro.tool.AppSettings
/**
* 游戏检查处理
*/
class GameCheckActivity : BaseActivity<ActivityGameCheckBinding>() {
2022-08-14 02:43:53 +00:00
override fun getViewBindingObject(layoutInflater: LayoutInflater): ActivityGameCheckBinding {
2022-04-04 14:03:10 +00:00
return ActivityGameCheckBinding.inflate(layoutInflater)
}
override fun whenCreateActivity(savedInstanceState: Bundle?, canUseView: Boolean) {
if (canUseView) {
setReturnButton()
setTitle(R.string.game_configured)
viewBinding.startButton.setOnClickListener(View.OnClickListener {
if (AppOperator.isAppInstalled(
this@GameCheckActivity,
GlobalMethod.DEFAULT_GAME_PACKAGE
)
) {
AppOperator.openApp(this@GameCheckActivity, GlobalMethod.DEFAULT_GAME_PACKAGE)
} else {
Snackbar.make(
viewBinding.startButton,
R.string.no_game_installed,
Snackbar.LENGTH_SHORT
)
.show()
}
})
viewBinding.completionButton.setOnClickListener(View.OnClickListener {
2022-08-14 02:43:53 +00:00
AppSettings.setValue(AppSettings.Setting.SetGameStorage, true)
2022-04-04 14:03:10 +00:00
finish()
})
}
}
}