fixed settings apply confirm dialog crash on some devices

This commit is contained in:
Mariotaku Lee 2017-05-16 10:22:58 +08:00
parent ef1c334200
commit 68b34edecf
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
1 changed files with 10 additions and 6 deletions

View File

@ -258,13 +258,17 @@ class SettingsActivity : BaseActivity(), OnItemClickListener, OnPreferenceStartF
private fun notifyUnsavedChange(): Boolean { private fun notifyUnsavedChange(): Boolean {
if (isTopSettings && (shouldRecreate || shouldRestart || shouldTerminate)) { if (isTopSettings && (shouldRecreate || shouldRestart || shouldTerminate)) {
val df = RestartConfirmDialogFragment() executeAfterFragmentResumed {
df.arguments = Bundle { if (it.isFinishing) return@executeAfterFragmentResumed
this[EXTRA_SHOULD_RECREATE] = shouldRecreate it as SettingsActivity
this[EXTRA_SHOULD_RESTART] = shouldRestart val df = RestartConfirmDialogFragment()
this[EXTRA_SHOULD_TERMINATE] = shouldTerminate df.arguments = Bundle {
this[EXTRA_SHOULD_RECREATE] = it.shouldRecreate
this[EXTRA_SHOULD_RESTART] = it.shouldRestart
this[EXTRA_SHOULD_TERMINATE] = it.shouldTerminate
}
df.show(it.supportFragmentManager, "restart_confirm")
} }
df.show(supportFragmentManager, "restart_confirm")
return true return true
} }
return false return false