Skip to content

Commit

Permalink
fix MainActivity not restarting when theme changes (#4900)
Browse files Browse the repository at this point in the history
`EXTRA_RESTART_ON_BACK` is never set on the Intent extras, but
`intent.extras?.getBoolean(EXTRA_RESTART_ON_BACK)` will return `false`
as long as there are any extras, hiding the actual value from the
`savedInstanceState`.
  • Loading branch information
connyduck authored Jan 29, 2025
1 parent 2cc4739 commit 19041d7
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ class PreferencesActivity :
}

onBackPressedDispatcher.addCallback(this, restartActivitiesOnBackPressedCallback)
restartActivitiesOnBackPressedCallback.isEnabled = intent.extras?.getBoolean(
EXTRA_RESTART_ON_BACK
) ?: savedInstanceState?.getBoolean(EXTRA_RESTART_ON_BACK, false) ?: false
restartActivitiesOnBackPressedCallback.isEnabled = savedInstanceState?.getBoolean(EXTRA_RESTART_ON_BACK, false) == true
}

override fun onPreferenceStartFragment(
Expand Down

0 comments on commit 19041d7

Please sign in to comment.