aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/res/values/strings.xml12
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java10
-rw-r--r--java/src/com/android/inputmethod/latin/settings/AccountsSettingsFragment.java33
3 files changed, 33 insertions, 22 deletions
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 @@
<!-- 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 &amp; 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] -->
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d5bfe43b2..0f9915778 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -110,7 +110,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
ImportantNoticeDialog.ImportantNoticeDialogListener {
static final String TAG = LatinIME.class.getSimpleName();
private static final boolean TRACE = false;
- private static boolean DEBUG = false;
private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100;
private static final int PERIOD_FOR_AUDIO_AND_HAPTIC_FEEDBACK_IN_KEY_REPEAT = 2;
@@ -557,7 +556,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
super.onCreate();
mHandler.onCreate();
- DEBUG = DebugFlags.DEBUG_ENABLED;
// TODO: Resolve mutual dependencies of {@link #loadSettings()} and
// {@link #resetDictionaryFacilitatorIfNecessary()}.
@@ -823,7 +821,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
return;
}
- if (DEBUG) {
+ if (DebugFlags.DEBUG_ENABLED) {
Log.d(TAG, "onStartInputView: editorInfo:"
+ String.format("inputType=0x%08x imeOptions=0x%08x",
editorInfo.inputType, editorInfo.imeOptions));
@@ -1011,7 +1009,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final int composingSpanStart, final int composingSpanEnd) {
super.onUpdateSelection(oldSelStart, oldSelEnd, newSelStart, newSelEnd,
composingSpanStart, composingSpanEnd);
- if (DEBUG) {
+ if (DebugFlags.DEBUG_ENABLED) {
Log.i(TAG, "onUpdateSelection: oss=" + oldSelStart + ", ose=" + oldSelEnd
+ ", nss=" + newSelStart + ", nse=" + newSelEnd
+ ", cs=" + composingSpanStart + ", ce=" + composingSpanEnd);
@@ -1079,7 +1077,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onDisplayCompletions(final CompletionInfo[] applicationSpecifiedCompletions) {
- if (DEBUG) {
+ if (DebugFlags.DEBUG_ENABLED) {
Log.i(TAG, "Received completions:");
if (applicationSpecifiedCompletions != null) {
for (int i = 0; i < applicationSpecifiedCompletions.length; i++) {
@@ -1780,7 +1778,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@UsedForTesting
/* package for test */ SuggestedWords getSuggestedWordsForTest() {
// You may not use this method for anything else than debug
- return DEBUG ? mInputLogic.mSuggestedWords : null;
+ return DebugFlags.DEBUG_ENABLED ? mInputLogic.mSuggestedWords : null;
}
// DO NOT USE THIS for any other purpose than testing. This is information private to LatinIME.
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,24 +204,19 @@ 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;
}
- if (currentAccount == null) {
- // No account is currently selected; switch enable sync preference off.
- mAccountSwitcher.setSummary(getString(R.string.no_accounts_selected));
- mEnableSyncPreference.setChecked(false);
- } else {
- // Set the currently selected account as the summary text.
- mAccountSwitcher.setSummary(getString(R.string.account_selected, currentAccount));
- }
+ final String[] accountsForLogin =
+ LoginAccountUtils.getAccountsForLogin(getActivity());
- mAccountSwitcher.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+ if (accountsForLogin.length > 0) {
+ enableSyncPreferences();
+ 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,
@@ -229,7 +224,21 @@ public final class AccountsSettingsFragment extends SubScreenFragment {
}
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));
+ mEnableSyncPreference.setChecked(false);
+ } else {
+ // Set the currently selected account as the summary text.
+ mAccountSwitcher.setSummary(getString(R.string.account_selected, currentAccount));
+ }
}
@Nullable