Index: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java |
index ad7b3bdd6b76287eb979c66a4afab58ed743e0d7..0d1f3e26148dccf8abf868c4db69252beb30047a 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java |
@@ -35,6 +35,7 @@ import org.chromium.chrome.browser.invalidation.InvalidationController; |
import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; |
import org.chromium.chrome.browser.preferences.SyncedAccountPreference; |
import org.chromium.chrome.browser.sync.ProfileSyncService; |
+import org.chromium.chrome.browser.sync.SyncAccountSwitcher; |
import org.chromium.sync.AndroidSyncSettings; |
import org.chromium.sync.ModelType; |
import org.chromium.sync.PassphraseType; |
@@ -114,12 +115,13 @@ public class SyncCustomizationFragment extends PreferenceFragment |
private Preference mSyncEncryption; |
private Preference mManageSyncData; |
private CheckBoxPreference[] mAllTypes; |
+ private SyncedAccountPreference mSyncedAccountPreference; |
private ProfileSyncService mProfileSyncService; |
@Override |
- public View onCreateView(LayoutInflater inflater, ViewGroup container, |
- Bundle savedInstanceState) { |
+ public View onCreateView( |
+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
mProfileSyncService = ProfileSyncService.get(); |
assert mProfileSyncService != null; |
mIsBackendInitialized = mProfileSyncService.isBackendInitialized(); |
@@ -176,6 +178,11 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
}); |
+ mSyncedAccountPreference = |
+ (SyncedAccountPreference) findPreference(PREFERENCE_SYNC_ACCOUNT_LIST); |
+ mSyncedAccountPreference.setOnPreferenceChangeListener(new SyncAccountSwitcher( |
+ getActivity(), getFragmentManager(), mSyncedAccountPreference)); |
+ |
return view; |
} |
@@ -275,10 +282,9 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
/** |
- * Update the state of all settings from sync. |
- * |
- * This sets the state of the sync switch from external sync state and then calls |
- * updateSyncStateFromSwitch, which uses that as its source of truth. |
+ * Update the state of all settings from sync. This sets the state of the sync switch from |
newt (away)
2016/02/25 06:25:53
Revert the javadoc reformatting changes in this fi
PEConn
2016/02/25 14:19:52
Done.
|
+ * external sync state and then calls updateSyncStateFromSwitch, which uses that as its source |
+ * of truth. |
*/ |
private void updateSyncState() { |
boolean isSyncEnabled = AndroidSyncSettings.isSyncEnabled(getActivity()); |
@@ -288,9 +294,7 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
private void updateSyncAccountsListState() { |
- SyncedAccountPreference accountList = |
- (SyncedAccountPreference) findPreference(PREFERENCE_SYNC_ACCOUNT_LIST); |
- accountList.setEnabled(mSyncSwitchPreference.isChecked()); |
+ mSyncedAccountPreference.setEnabled(mSyncSwitchPreference.isChecked()); |
} |
/** |
@@ -304,12 +308,10 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
/** |
- * Update the encryption state. |
- * |
- * If sync's backend is initialized, the button is enabled and the dialog will present the |
- * valid encryption options for the user. Otherwise, any encryption dialogs will be closed |
- * and the button will be disabled because the backend is needed in order to know and |
- * modify the encryption state. |
+ * Update the encryption state. If sync's backend is initialized, the button is enabled and the |
+ * dialog will present the valid encryption options for the user. Otherwise, any encryption |
+ * dialogs will be closed and the button will be disabled because the backend is needed in order |
+ * to know and modify the encryption state. |
*/ |
private void updateEncryptionState() { |
boolean isSyncEnabled = mSyncSwitchPreference.isChecked(); |
@@ -514,10 +516,8 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
/** |
- * Update the state of the sync everything switch. |
- * |
- * If sync is on, load the pref from native. Otherwise display sync everything as on but |
- * disable the switch. |
+ * Update the state of the sync everything switch. If sync is on, load the pref from native. |
+ * Otherwise display sync everything as on but disable the switch. |
*/ |
private void updateSyncEverythingState() { |
boolean isSyncEnabled = mSyncSwitchPreference.isChecked(); |
@@ -527,11 +527,10 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
/** |
- * Update the data type switch state. |
- * |
- * If sync is on, load the prefs from native. Otherwise, all data types are disabled and |
- * checked. Note that the Password data type will be shown as disabled and unchecked between |
- * sync being turned on and the backend initialization completing. |
+ * Update the data type switch state. If sync is on, load the prefs from native. Otherwise, all |
+ * data types are disabled and checked. Note that the Password data type will be shown as |
+ * disabled and unchecked between sync being turned on and the backend initialization |
+ * completing. |
*/ |
private void updateDataTypeState() { |
boolean isSyncEnabled = mSyncSwitchPreference.isChecked(); |
@@ -569,10 +568,8 @@ public class SyncCustomizationFragment extends PreferenceFragment |
} |
/** |
- * Listen to sync state changes. |
- * |
- * If the user has just turned on sync, this listener is needed in order to enable |
- * the encryption settings once the backend has initialized. |
+ * Listen to sync state changes. If the user has just turned on sync, this listener is needed in |
+ * order to enable the encryption settings once the backend has initialized. |
*/ |
@Override |
public void syncStateChanged() { |