Loading java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java +2 −3 Original line number Diff line number Diff line Loading @@ -386,12 +386,11 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); RichInputMethodManager.init(getActivity()); mPrefs = getPreferenceManager().getSharedPreferences(); RichInputMethodManager.init(getActivity(), mPrefs); mRichImm = RichInputMethodManager.getInstance(); addPreferencesFromResource(R.xml.additional_subtype_settings); setHasOptionsMenu(true); mPrefs = getPreferenceManager().getSharedPreferences(); } @Override Loading java/src/com/android/inputmethod/latin/LatinIME.java +9 −14 Original line number Diff line number Diff line Loading @@ -403,33 +403,28 @@ public final class LatinIME extends InputMethodService implements KeyboardAction @Override public void onCreate() { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); mPrefs = prefs; LatinImeLogger.init(this, prefs); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mResources = getResources(); LatinImeLogger.init(this, mPrefs); if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.getInstance().init(this, prefs); ResearchLogger.getInstance().init(this, mPrefs); } RichInputMethodManager.init(this); RichInputMethodManager.init(this, mPrefs); mRichImm = RichInputMethodManager.getInstance(); SubtypeSwitcher.init(this); KeyboardSwitcher.init(this, prefs); KeyboardSwitcher.init(this, mPrefs); AccessibilityUtils.init(this); super.onCreate(); mRichImm = RichInputMethodManager.getInstance(); mHandler.onCreate(); DEBUG = LatinImeLogger.sDBG; final Resources res = getResources(); mResources = res; loadSettings(); mRichImm.setAdditionalInputMethodSubtypes(mCurrentSettings.getAdditionalSubtypes()); initSuggest(); mDisplayOrientation = res.getConfiguration().orientation; mDisplayOrientation = mResources.getConfiguration().orientation; // Register to receive ringer mode change and network state change. // Also receive installation and removal of a dictionary pack. Loading java/src/com/android/inputmethod/latin/RichInputMethodManager.java +20 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE; import android.content.Context; import android.content.SharedPreferences; import android.os.IBinder; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; Loading Loading @@ -49,19 +50,34 @@ public final class RichInputMethodManager { return sInstance; } public static void init(final Context context) { sInstance.initInternal(context); public static void init(final Context context, final SharedPreferences prefs) { sInstance.initInternal(context, prefs); } private boolean isInitialized() { return mImmWrapper != null; } private void checkInitialized() { if (mImmWrapper == null) { if (!isInitialized()) { throw new RuntimeException(TAG + " is used before initialization"); } } private void initInternal(final Context context) { private void initInternal(final Context context, final SharedPreferences prefs) { if (isInitialized()) { return; } mImmWrapper = new InputMethodManagerCompatWrapper(context); mInputMethodInfoOfThisIme = getInputMethodInfoOfThisIme(context); // Initialize additional subtypes. SubtypeLocale.init(context); final String prefAdditionalSubtypes = SettingsValues.getPrefAdditionalSubtypes( prefs, context.getResources()); final InputMethodSubtype[] additionalSubtypes = AdditionalSubtype.createAdditionalSubtypesArray(prefAdditionalSubtypes); setAdditionalInputMethodSubtypes(additionalSubtypes); } public InputMethodManager getInputMethodManager() { Loading java/src/com/android/inputmethod/latin/SettingsValues.java +0 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.keyboard.internal.KeySpecParser; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; Loading Loading @@ -82,7 +81,6 @@ public final class SettingsValues { private final int mVibrationDurationSettingsRawValue; @SuppressWarnings("unused") // TODO: Use this private final float mKeypressSoundVolumeRawValue; private final InputMethodSubtype[] mAdditionalSubtypes; public final boolean mGestureInputEnabled; public final boolean mGesturePreviewTrailEnabled; public final boolean mGestureFloatingPreviewTextEnabled; Loading Loading @@ -170,8 +168,6 @@ public final class SettingsValues { mAutoCorrectionThresholdRawValue); mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); mAdditionalSubtypes = AdditionalSubtype.createAdditionalSubtypesArray( getPrefAdditionalSubtypes(prefs, res)); final boolean gestureInputEnabledByBuildConfig = res.getBoolean( R.bool.config_gesture_input_enabled_by_build_config); mGestureInputEnabled = gestureInputEnabledByBuildConfig Loading Loading @@ -375,10 +371,6 @@ public final class SettingsValues { return res.getBoolean(R.bool.config_use_fullscreen_mode); } public InputMethodSubtype[] getAdditionalSubtypes() { return mAdditionalSubtypes; } public static String getPrefAdditionalSubtypes(final SharedPreferences prefs, final Resources res) { final String predefinedPrefSubtypes = AdditionalSubtype.createPrefSubtypes( Loading tests/src/com/android/inputmethod/keyboard/SpacebarTextTests.java +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard; import android.content.Context; import android.content.res.Resources; import android.preference.PreferenceManager; import android.test.AndroidTestCase; import android.view.inputmethod.InputMethodSubtype; Loading @@ -41,7 +42,8 @@ public class SpacebarTextTests extends AndroidTestCase { protected void setUp() throws Exception { super.setUp(); final Context context = getContext(); RichInputMethodManager.init(context); RichInputMethodManager.init( context, PreferenceManager.getDefaultSharedPreferences(context)); mRichImm = RichInputMethodManager.getInstance(); mRes = context.getResources(); SubtypeLocale.init(context); Loading Loading
java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java +2 −3 Original line number Diff line number Diff line Loading @@ -386,12 +386,11 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); RichInputMethodManager.init(getActivity()); mPrefs = getPreferenceManager().getSharedPreferences(); RichInputMethodManager.init(getActivity(), mPrefs); mRichImm = RichInputMethodManager.getInstance(); addPreferencesFromResource(R.xml.additional_subtype_settings); setHasOptionsMenu(true); mPrefs = getPreferenceManager().getSharedPreferences(); } @Override Loading
java/src/com/android/inputmethod/latin/LatinIME.java +9 −14 Original line number Diff line number Diff line Loading @@ -403,33 +403,28 @@ public final class LatinIME extends InputMethodService implements KeyboardAction @Override public void onCreate() { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); mPrefs = prefs; LatinImeLogger.init(this, prefs); mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mResources = getResources(); LatinImeLogger.init(this, mPrefs); if (ProductionFlag.IS_EXPERIMENTAL) { ResearchLogger.getInstance().init(this, prefs); ResearchLogger.getInstance().init(this, mPrefs); } RichInputMethodManager.init(this); RichInputMethodManager.init(this, mPrefs); mRichImm = RichInputMethodManager.getInstance(); SubtypeSwitcher.init(this); KeyboardSwitcher.init(this, prefs); KeyboardSwitcher.init(this, mPrefs); AccessibilityUtils.init(this); super.onCreate(); mRichImm = RichInputMethodManager.getInstance(); mHandler.onCreate(); DEBUG = LatinImeLogger.sDBG; final Resources res = getResources(); mResources = res; loadSettings(); mRichImm.setAdditionalInputMethodSubtypes(mCurrentSettings.getAdditionalSubtypes()); initSuggest(); mDisplayOrientation = res.getConfiguration().orientation; mDisplayOrientation = mResources.getConfiguration().orientation; // Register to receive ringer mode change and network state change. // Also receive installation and removal of a dictionary pack. Loading
java/src/com/android/inputmethod/latin/RichInputMethodManager.java +20 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import static com.android.inputmethod.latin.Constants.Subtype.KEYBOARD_MODE; import android.content.Context; import android.content.SharedPreferences; import android.os.IBinder; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; Loading Loading @@ -49,19 +50,34 @@ public final class RichInputMethodManager { return sInstance; } public static void init(final Context context) { sInstance.initInternal(context); public static void init(final Context context, final SharedPreferences prefs) { sInstance.initInternal(context, prefs); } private boolean isInitialized() { return mImmWrapper != null; } private void checkInitialized() { if (mImmWrapper == null) { if (!isInitialized()) { throw new RuntimeException(TAG + " is used before initialization"); } } private void initInternal(final Context context) { private void initInternal(final Context context, final SharedPreferences prefs) { if (isInitialized()) { return; } mImmWrapper = new InputMethodManagerCompatWrapper(context); mInputMethodInfoOfThisIme = getInputMethodInfoOfThisIme(context); // Initialize additional subtypes. SubtypeLocale.init(context); final String prefAdditionalSubtypes = SettingsValues.getPrefAdditionalSubtypes( prefs, context.getResources()); final InputMethodSubtype[] additionalSubtypes = AdditionalSubtype.createAdditionalSubtypesArray(prefAdditionalSubtypes); setAdditionalInputMethodSubtypes(additionalSubtypes); } public InputMethodManager getInputMethodManager() { Loading
java/src/com/android/inputmethod/latin/SettingsValues.java +0 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.keyboard.internal.KeySpecParser; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; Loading Loading @@ -82,7 +81,6 @@ public final class SettingsValues { private final int mVibrationDurationSettingsRawValue; @SuppressWarnings("unused") // TODO: Use this private final float mKeypressSoundVolumeRawValue; private final InputMethodSubtype[] mAdditionalSubtypes; public final boolean mGestureInputEnabled; public final boolean mGesturePreviewTrailEnabled; public final boolean mGestureFloatingPreviewTextEnabled; Loading Loading @@ -170,8 +168,6 @@ public final class SettingsValues { mAutoCorrectionThresholdRawValue); mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); mAdditionalSubtypes = AdditionalSubtype.createAdditionalSubtypesArray( getPrefAdditionalSubtypes(prefs, res)); final boolean gestureInputEnabledByBuildConfig = res.getBoolean( R.bool.config_gesture_input_enabled_by_build_config); mGestureInputEnabled = gestureInputEnabledByBuildConfig Loading Loading @@ -375,10 +371,6 @@ public final class SettingsValues { return res.getBoolean(R.bool.config_use_fullscreen_mode); } public InputMethodSubtype[] getAdditionalSubtypes() { return mAdditionalSubtypes; } public static String getPrefAdditionalSubtypes(final SharedPreferences prefs, final Resources res) { final String predefinedPrefSubtypes = AdditionalSubtype.createPrefSubtypes( Loading
tests/src/com/android/inputmethod/keyboard/SpacebarTextTests.java +3 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard; import android.content.Context; import android.content.res.Resources; import android.preference.PreferenceManager; import android.test.AndroidTestCase; import android.view.inputmethod.InputMethodSubtype; Loading @@ -41,7 +42,8 @@ public class SpacebarTextTests extends AndroidTestCase { protected void setUp() throws Exception { super.setUp(); final Context context = getContext(); RichInputMethodManager.init(context); RichInputMethodManager.init( context, PreferenceManager.getDefaultSharedPreferences(context)); mRichImm = RichInputMethodManager.getInstance(); mRes = context.getResources(); SubtypeLocale.init(context); Loading