2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/8592: Relocate device name in account preferences. Deactivate device name field while syncing. (https://github.com/mozilla-mobile/fenix/pull/9255)

This commit is contained in:
Elise Richards 2020-03-20 12:32:04 -05:00 committed by GitHub
parent 3c3db7d3ba
commit 1be0825abe
2 changed files with 15 additions and 11 deletions

View File

@ -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)
}
}

View File

@ -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>