diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index c8060dac3..e4b3883af 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -61,7 +61,7 @@
Sync your personal dictionary across devices
- Sync Now
+ Sync now
Delete Keyboard Cloud data
@@ -73,12 +73,16 @@
Cancel
- Your personal dictionary will be synced & backed up to
- Google servers. The statistical information of word frequency may be collected to help
+ Your personal dictionary will be synced and backed up to
+ Google servers. The statistical information of word frequency may be collected to help
improve our products. The collection and usage of all the information will be compliant with
Google\'s Privacy Policy.
-
+
+
+ Please add a Google account to this device to enable this feature
+
+
Switch to other input methods
diff --git a/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java
index b734d8bcd..9a8a7b9e0 100644
--- a/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java
@@ -204,10 +204,33 @@ public final class AccountsSettingsFragment extends SubScreenFragment {
* is currently selected.
*/
private void refreshAccountAndDependentPreferences(@Nullable final String currentAccount) {
+ // TODO(cvnguyen): Write tests.
if (!ProductionFlags.ENABLE_ACCOUNT_SIGN_IN) {
return;
}
+ final String[] accountsForLogin =
+ LoginAccountUtils.getAccountsForLogin(getActivity());
+
+ if (accountsForLogin.length > 0) {
+ enableSyncPreferences();
+ mAccountSwitcher.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ @Override
+ public boolean onPreferenceClick(final Preference preference) {
+ if (accountsForLogin.length > 0) {
+ // TODO: Add addition of account.
+ createAccountPicker(accountsForLogin, currentAccount,
+ new AccountChangedListener(null)).show();
+ }
+ return true;
+ }
+ });
+ } else {
+ mAccountSwitcher.setEnabled(false);
+ disableSyncPreferences();
+ mEnableSyncPreference.setSummary(getString(R.string.add_account_to_enable_sync));
+ }
+
if (currentAccount == null) {
// No account is currently selected; switch enable sync preference off.
mAccountSwitcher.setSummary(getString(R.string.no_accounts_selected));
@@ -216,20 +239,6 @@ public final class AccountsSettingsFragment extends SubScreenFragment {
// Set the currently selected account as the summary text.
mAccountSwitcher.setSummary(getString(R.string.account_selected, currentAccount));
}
-
- mAccountSwitcher.setOnPreferenceClickListener(new OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(final Preference preference) {
- final String[] accountsForLogin =
- LoginAccountUtils.getAccountsForLogin(getActivity());
- if (accountsForLogin.length > 0) {
- // TODO: Add addition of account.
- createAccountPicker(accountsForLogin, currentAccount,
- new AccountChangedListener(null)).show();
- }
- return true;
- }
- });
}
@Nullable