am e3ac02e7: Merge "Sync setting disabled if no account."
* commit 'e3ac02e796d64c1cdef0c300338124afe27cfbec': Sync setting disabled if no account.main
commit
e410a513be
|
@ -61,7 +61,7 @@
|
|||
<!-- Option summary when cloud sync feature is disabled [CHAR LIMIT=65] -->
|
||||
<string name="cloud_sync_summary_disabled">Sync your personal dictionary across devices</string>
|
||||
<!-- Option title for starting the sync cycle now. [CHAR LIMIT=33]-->
|
||||
<string name="sync_now_title">Sync Now</string>
|
||||
<string name="sync_now_title">Sync now</string>
|
||||
<!-- Option title for letting user delete data from Google servers. [CHAR LIMIT=33] -->
|
||||
<string name="clear_sync_data_title">Delete Keyboard Cloud data</string>
|
||||
<!-- Option summary for letting user delete data from Google servers. [CHAR LIMIT=65] -->
|
||||
|
@ -73,12 +73,16 @@
|
|||
<!-- Option to cancel the deletion of user data from cloud [CHAR LIMIT=20] -->
|
||||
<string name="cloud_sync_cancel">Cancel</string>
|
||||
<!-- Option to agree to terms and conditions for enabling cloud sync feature. -->
|
||||
<string name="cloud_sync_opt_in_text">Your personal dictionary will be synced & backed up to
|
||||
Google servers. The statistical information of word frequency may be collected to help
|
||||
<string name="cloud_sync_opt_in_text">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
|
||||
<a href="https://www.google.com/policies/privacy">Google\'s Privacy Policy</a>.
|
||||
</string>
|
||||
|
||||
<!-- Text to tell the user to add a Google account to the device to enable the cloud sync feature. [CHAR LIMIT=65]-->
|
||||
<string name="add_account_to_enable_sync">
|
||||
Please add a Google account to this device to enable this feature
|
||||
</string>
|
||||
|
||||
<!-- Option name for including other IMEs in the language switch list [CHAR LIMIT=30] -->
|
||||
<string name="include_other_imes_in_language_switch_list">Switch to other input methods</string>
|
||||
<!-- Option summary for including other IMEs in the language switch list [CHAR LIMIT=65] -->
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue