Prevent DialogFragment.show crash

This commit is contained in:
Mygod
2020-01-23 09:29:51 +08:00
parent 09238462d1
commit 2298f7858f
4 changed files with 13 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ import be.mygod.vpnhotspot.preference.SharedPreferenceDataStore
import be.mygod.vpnhotspot.preference.SummaryFallbackProvider
import be.mygod.vpnhotspot.util.RootSession
import be.mygod.vpnhotspot.util.launchUrl
import be.mygod.vpnhotspot.util.showAllowingStateLoss
import be.mygod.vpnhotspot.widget.SmartSnackbar
import com.google.android.material.snackbar.Snackbar
import kotlinx.coroutines.Dispatchers
@@ -167,7 +168,7 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
true
}
findPreference<Preference>("misc.donate")!!.setOnPreferenceClickListener {
EBegFragment().show(parentFragmentManager, "EBegFragment")
EBegFragment().showAllowingStateLoss(parentFragmentManager, "EBegFragment")
true
}
}
@@ -180,7 +181,7 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() {
app.connectivity.getLinkProperties(it)?.interfaceName
}.toTypedArray())
setTargetFragment(this@SettingsPreferenceFragment, 0)
}.show(parentFragmentManager, preference.key)
}.showAllowingStateLoss(parentFragmentManager, preference.key)
else -> super.onDisplayPreferenceDialog(preference)
}
}