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 {
if (isTopSettings && (shouldRecreate || shouldRestart || shouldTerminate)) {
val df = RestartConfirmDialogFragment()
df.arguments = Bundle {
this[EXTRA_SHOULD_RECREATE] = shouldRecreate
this[EXTRA_SHOULD_RESTART] = shouldRestart
this[EXTRA_SHOULD_TERMINATE] = shouldTerminate
executeAfterFragmentResumed {
if (it.isFinishing) return@executeAfterFragmentResumed
it as SettingsActivity
val df = RestartConfirmDialogFragment()
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 false