aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2013-03-13 07:41:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-03-13 07:41:11 +0000
commit0ab44b21bd6ef5e9fde329b25dfd84f6ca5c0825 (patch)
tree7bbae4c79398c05a1235dc9a68a6c4d741cfebe6 /java/src
parent2bbd3065d3bd9785ad1638c65f8c73f11bf21922 (diff)
parent756791e6bf80c1fd86f9a236f4ba8da770a7305f (diff)
downloadlatinime-0ab44b21bd6ef5e9fde329b25dfd84f6ca5c0825.tar.gz
latinime-0ab44b21bd6ef5e9fde329b25dfd84f6ca5c0825.tar.xz
latinime-0ab44b21bd6ef5e9fde329b25dfd84f6ca5c0825.zip
Merge "Make isInternal mutable" into jb-mr2-dev
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java22
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java9
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsFragment.java2
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java4
-rw-r--r--java/src/com/android/inputmethod/latin/define/ProductionFlag.java1
5 files changed, 22 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index bb7e2d1c2..e3a53068a 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1448,7 +1448,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
} else {
didAutoCorrect = false;
if (SPACE_STATE_PHANTOM == spaceState) {
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
if (mWordComposer.isComposingWord() && mWordComposer.isBatchMode()) {
Stats.onAutoCorrection(
"", mWordComposer.getTypedWord(), " ", mWordComposer);
@@ -1503,7 +1503,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mHandler.cancelUpdateSuggestionStrip();
mConnection.beginBatchEdit();
if (mWordComposer.isComposingWord()) {
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
if (mWordComposer.isBatchMode()) {
Stats.onAutoCorrection("", mWordComposer.getTypedWord(), " ", mWordComposer);
}
@@ -1733,7 +1733,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
}
} else {
if (mLastComposedWord.canRevertCommit()) {
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
Stats.onAutoCorrectionCancellation();
}
revertCommit();
@@ -1892,7 +1892,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
if (null != mSuggestionStripView) mSuggestionStripView.dismissAddToDictionaryHint();
}
mHandler.postUpdateSuggestionStrip();
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
Utils.Stats.onNonSeparator((char)primaryCode, x, y);
}
}
@@ -1959,7 +1959,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// already displayed or not, so it's okay.
setPunctuationSuggestions();
}
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
Utils.Stats.onSeparator((char)primaryCode, x, y);
}
@@ -2142,7 +2142,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
throw new RuntimeException("We have an auto-correction but the typed word "
+ "is empty? Impossible! I must commit suicide.");
}
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
Stats.onAutoCorrection(typedWord, autoCorrection, separatorString, mWordComposer);
}
if (ProductionFlag.IS_EXPERIMENTAL) {
@@ -2241,7 +2241,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// If the suggestion is not in the dictionary, the hint should be shown.
&& !AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(), suggestion, true);
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
Stats.onSeparator((char)Constants.CODE_SPACE,
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
}
@@ -2365,7 +2365,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mUserHistoryDictionary.cancelAddingUserHistory(previousWord, committedWord);
}
mConnection.commitText(originallyTypedWord + mLastComposedWord.mSeparatorString, 1);
- if (ProductionFlag.IS_INTERNAL) {
+ if (mSettings.isInternal()) {
Stats.onSeparator(mLastComposedWord.mSeparatorString,
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE);
}
@@ -2499,12 +2499,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
launchSubActivity(SettingsActivity.class);
}
- // Called from debug code only
- public void launchDebugSettings() {
- handleClose();
- launchSubActivity(DebugSettingsActivity.class);
- }
-
public void launchKeyboardedDialogActivity(final Class<? extends Activity> activityClass) {
// Put the text in the attached EditText into a safe, saved state before switching to a
// new activity that will also use the soft keyboard.
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index 435074bdb..4cbfa8ea1 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -70,6 +70,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_INPUT_LANGUAGE = "input_language";
public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
public static final String PREF_DEBUG_SETTINGS = "debug_settings";
+ public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
// This is being used only for the backward compatibility.
@@ -127,6 +128,10 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
return mSettingsValues;
}
+ public boolean isInternal() {
+ return mSettingsValues.mIsInternal;
+ }
+
// Accessed from the settings interface, hence public
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
final Resources res) {
@@ -274,4 +279,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
}
return prefs.getBoolean(Settings.PREF_SHOW_SETUP_WIZARD_ICON, false);
}
+
+ public static boolean isInternal(final SharedPreferences prefs) {
+ return prefs.getBoolean(Settings.PREF_KEY_IS_INTERNAL, false);
+ }
}
diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java
index 4c90e485a..d305285e9 100644
--- a/java/src/com/android/inputmethod/latin/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java
@@ -92,7 +92,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
final Preference debugSettings = findPreference(Settings.PREF_DEBUG_SETTINGS);
if (debugSettings != null) {
- if (ProductionFlag.IS_INTERNAL) {
+ if (Settings.isInternal(prefs)) {
final Intent debugSettingsIntent = new Intent(Intent.ACTION_MAIN);
debugSettingsIntent.setClassName(
context.getPackageName(), DebugSettingsActivity.class.getName());
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index d05868029..f77a92885 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -76,6 +76,9 @@ public final class SettingsValues {
private final boolean mVoiceKeyEnabled;
private final boolean mVoiceKeyOnMain;
+ // Debug settings
+ public final boolean mIsInternal;
+
public SettingsValues(final SharedPreferences prefs, final Resources res,
final InputAttributes inputAttributes) {
// Get the resources
@@ -141,6 +144,7 @@ public final class SettingsValues {
Settings.PREF_SHOW_SUGGESTIONS_SETTING,
res.getString(R.string.prefs_suggestion_visibility_default_value));
mSuggestionVisibility = createSuggestionVisibility(res, showSuggestionsSetting);
+ mIsInternal = Settings.isInternal(prefs);
}
public boolean isApplicationSpecifiedCompletionsOn() {
diff --git a/java/src/com/android/inputmethod/latin/define/ProductionFlag.java b/java/src/com/android/inputmethod/latin/define/ProductionFlag.java
index fe9be16c6..3df0d044e 100644
--- a/java/src/com/android/inputmethod/latin/define/ProductionFlag.java
+++ b/java/src/com/android/inputmethod/latin/define/ProductionFlag.java
@@ -22,7 +22,6 @@ public final class ProductionFlag {
}
public static final boolean IS_EXPERIMENTAL = false;
- public static final boolean IS_INTERNAL = false;
// When false, IS_EXPERIMENTAL_DEBUG suggests that all guarded class-private DEBUG flags should
// be false, and any privacy controls should be enforced. IS_EXPERIMENTAL_DEBUG should be false