[skip ci] feat: theme crash fix
This commit is contained in:
parent
cd3bb20afd
commit
3d1040b280
15 changed files with 121 additions and 73 deletions
|
@ -11,6 +11,7 @@ import android.os.Build.VERSION.SDK_INT
|
|||
import android.os.Bundle
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.updateLayoutParams
|
||||
|
@ -28,6 +29,7 @@ import ani.dantotsu.others.AppUpdater
|
|||
import ani.dantotsu.others.CustomBottomDialog
|
||||
import ani.dantotsu.pop
|
||||
import ani.dantotsu.setSafeOnClickListener
|
||||
import ani.dantotsu.settings.saving.PrefManager
|
||||
import ani.dantotsu.snackString
|
||||
import ani.dantotsu.startMainActivity
|
||||
import ani.dantotsu.statusBarHeight
|
||||
|
@ -40,9 +42,6 @@ import kotlin.random.Random
|
|||
|
||||
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
private val restartMainActivity = object : OnBackPressedCallback(false) {
|
||||
override fun handleOnBackPressed() = startMainActivity(this@SettingsActivity)
|
||||
}
|
||||
lateinit var binding: ActivitySettingsBinding
|
||||
private var cursedCounter = 0
|
||||
|
||||
|
@ -70,7 +69,14 @@ class SettingsActivity : AppCompatActivity() {
|
|||
bottomMargin = navBarHeight
|
||||
}
|
||||
|
||||
onBackPressedDispatcher.addCallback(context, restartMainActivity)
|
||||
onBackPressedDispatcher.addCallback(context){
|
||||
if (PrefManager.getCustomVal("reload", false)) {
|
||||
startMainActivity(context)
|
||||
PrefManager.setCustomVal("reload", false)
|
||||
}else{
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
settingsBack.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
|
@ -262,4 +268,8 @@ class SettingsActivity : AppCompatActivity() {
|
|||
?: "Unknown Architecture"
|
||||
}
|
||||
}
|
||||
override fun onResume() {
|
||||
ThemeManager(this).applyTheme()
|
||||
super.onResume()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue