0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-23 11:45:11 +00:00

fixed constant activity recreate

This commit is contained in:
X1nto 2020-06-23 18:36:46 +04:00
parent 2e24fd8ed6
commit 0f1af2e80d

View file

@ -129,8 +129,11 @@ open class Home : BaseFragment(), View.OnClickListener, AdapterView.OnItemSelect
}
private fun writeToVariantPref(variant: String) {
getDefaultSharedPreferences(activity).edit().putString("vanced_variant", variant).apply()
restartActivity()
val prefs = getDefaultSharedPreferences(activity)
if (prefs.getString("vanced_variant", "nonroot") != variant) {
prefs.edit().putString("vanced_variant", variant).apply()
restartActivity()
} else Log.d("VMvariant", "$variant is already selected")
}
private fun restartActivity() {