This commit is contained in:
lucky 2021-11-20 11:58:45 +03:00
parent 727de2b6ac
commit b8de10eaf3
3 changed files with 14 additions and 9 deletions

View File

@ -10,8 +10,8 @@ android {
applicationId "me.lucky.wasted" applicationId "me.lucky.wasted"
minSdk 25 minSdk 25
targetSdk 31 targetSdk 31
versionCode 2 versionCode 3
versionName "1.0.1" versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -35,20 +35,16 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater) binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root) setContentView(binding.root)
init()
setup() setup()
} }
override fun onResume() { override fun onStart() {
super.onResume() super.onStart()
update() update()
} }
private fun update() { private fun update() {
if (prefs.code == "") prefs.code = makeCode()
binding.apply {
code.text = prefs.code
toggle.isChecked = prefs.isServiceEnabled
}
if (!isAdminActive() && prefs.isServiceEnabled) if (!isAdminActive() && prefs.isServiceEnabled)
Toast.makeText( Toast.makeText(
this, this,
@ -57,6 +53,14 @@ class MainActivity : AppCompatActivity() {
).show() ).show()
} }
private fun init() {
if (prefs.code == "") prefs.code = makeCode()
binding.apply {
code.text = prefs.code
toggle.isChecked = prefs.isServiceEnabled
}
}
private fun setup() { private fun setup() {
binding.apply { binding.apply {
code.setOnLongClickListener { code.setOnLongClickListener {

View File

@ -0,0 +1 @@
Not provided by developer