For #8592: Relocate device name in account preferences. Deactivate device name field while syncing. (#9255)

fennec/beta
Elise Richards 4 years ago committed by GitHub
parent a356b4b2c4
commit 5d8a9bb4be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -162,7 +162,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
// Make sure out sync engine checkboxes are up-to-date and disabled if currently syncing
updateSyncEngineStates()
setCwtsDisabledWhileSyncing(accountManager.isSyncActive())
setDisabledWhileSyncing(accountManager.isSyncActive())
val historyNameKey = getPreferenceKey(R.string.pref_key_sync_history)
findPreference<CheckBoxPreference>(historyNameKey)?.apply {
@ -317,10 +317,14 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
}
}
private fun setCwtsDisabledWhileSyncing(isSyncing: Boolean) {
private fun setDisabledWhileSyncing(isSyncing: Boolean) {
findPreference<PreferenceCategory>(
getPreferenceKey(R.string.preferences_sync_category)
)?.isEnabled = !isSyncing
findPreference<EditTextPreference>(
getPreferenceKey(R.string.pref_key_sync_device_name)
)?.isEnabled = !isSyncing
}
private val syncStatusObserver = object : SyncStatusObserver {
@ -330,7 +334,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
view?.announceForAccessibility(getString(R.string.sync_syncing_in_progress))
pref?.title = getString(R.string.sync_syncing_in_progress)
pref?.isEnabled = false
setCwtsDisabledWhileSyncing(true)
setDisabledWhileSyncing(true)
}
}
@ -347,7 +351,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
}
// Make sure out sync engine checkboxes are up-to-date.
updateSyncEngineStates()
setCwtsDisabledWhileSyncing(false)
setDisabledWhileSyncing(false)
}
}

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.preference.Preference
android:key="@string/pref_key_sync_now"
android:title="@string/preferences_sync_now" />
<androidx.preference.EditTextPreference
android:key="@string/pref_key_sync_device_name"
android:title="@string/preferences_sync_device_name" />
<androidx.preference.Preference
android:key="@string/pref_key_sign_out"
android:title="@string/preferences_sign_out" />
@ -29,10 +34,5 @@
android:defaultValue="true"
android:key="@string/pref_key_sync_logins"
android:title="@string/preferences_sync_logins" />
<androidx.preference.EditTextPreference
android:key="@string/pref_key_sync_device_name"
android:title="@string/preferences_sync_device_name" />
</androidx.preference.PreferenceCategory>
</PreferenceScreen>

Loading…
Cancel
Save