mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix navigation bar color
This commit is contained in:
parent
a5473a5660
commit
119c017762
1 changed files with 20 additions and 0 deletions
|
@ -1576,6 +1576,23 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
// showToast(this, currentFocus.toString(), Toast.LENGTH_LONG)
|
||||
// }
|
||||
// }
|
||||
|
||||
onBackPressedDispatcher.addCallback(
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
window?.navigationBarColor = colorFromAttribute(R.attr.primaryGrayBackground)
|
||||
updateLocale()
|
||||
|
||||
// If we don't disable we end up in a loop with default behavior calling
|
||||
// this callback as well, so we disable it, run default behavior,
|
||||
// then re-enable this callback so it can be used for next back press.
|
||||
isEnabled = false
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
isEnabled = true
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private var backPressedCallback: OnBackPressedCallback? = null
|
||||
|
@ -1585,6 +1602,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
backPressedCallback = object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
showConfirmExitDialog()
|
||||
window?.navigationBarColor =
|
||||
colorFromAttribute(R.attr.primaryGrayBackground)
|
||||
updateLocale()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue