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"
minSdk 25
targetSdk 31
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

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

View File

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