Verified Commit 97a55d73 authored by Hussein's avatar Hussein

Merge branch 'P4A-1059' into develop

parents 31e71088 cf44053e
......@@ -4,7 +4,7 @@ buildscript {
'compileSdk' : 29,
'targetSdk' : 28,
'minSdk' : 21,
'versionCode' : 72,
'versionCode' : 73,
'pEpEngineRevision' : 'Release_2.1.0-RC38',
'pEpJNIAdapterRevision': 'Release_2.1.0-RC12',
'versionName' : '1.1.250-dev',
......
......@@ -35,6 +35,7 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() {
private lateinit var attachmentDefaultPathPreference: Preference
private var syncSwitchDialog: AlertDialog? = null
override fun onCreatePreferencesFix(savedInstanceState: Bundle?, rootKey: String?) {
preferenceManager.preferenceDataStore = dataStore
......@@ -152,18 +153,16 @@ class GeneralSettingsFragment : PreferenceFragmentCompat() {
private fun processKeySyncSwitchClick(preference: Preference, newValue: Any): Boolean {
if (preference is SwitchPreferenceCompat && newValue is Boolean) {
if (!newValue) {
val theme = if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
R.style.SyncDisableDialog
} else {
com.google.android.material.R.style.Theme_AppCompat_Light_Dialog
if (syncSwitchDialog == null) {
syncSwitchDialog = AlertDialog.Builder(view?.context, R.style.SyncDisableDialog)
.setTitle(R.string.keysync_disable_warning_title)
.setMessage(R.string.keysync_disable_warning_explanation)
.setCancelable(false)
.setPositiveButton(R.string.keysync_disable_warning_action_disable) { _, _ -> preference.isChecked = false }
.setNegativeButton(R.string.cancel_action) { _, _ -> }
.create()
}
AlertDialog.Builder(view?.context, theme)
.setTitle(R.string.keysync_disable_warning_title)
.setMessage(R.string.keysync_disable_warning_explanation)
.setCancelable(false)
.setPositiveButton(R.string.keysync_disable_warning_action_disable) { _, _ -> preference.isChecked = false }
.setNegativeButton(R.string.cancel_action) { _, _ -> }
.show()
syncSwitchDialog?.let { dialog -> if (!dialog.isShowing) dialog.show() }
} else {
preference.isChecked = true
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment