Loading java/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ <integer name="config_keyboard_grid_width">32</integer> <integer name="config_keyboard_grid_height">16</integer> <integer name="config_double_space_period_timeout">1100</integer> <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. --> <!-- This configuration is an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string name="config_default_keyboard_theme_index" translatable="false">2</string> <integer name="config_max_more_keys_column">5</integer> Loading java/res/values/donottranslate.xml +12 −0 Original line number Diff line number Diff line Loading @@ -111,12 +111,24 @@ <item>@string/layout_gingerbread</item> <item>@string/layout_klp</item> </string-array> <!-- An element must be an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string-array name="keyboard_layout_modes_values"> <item>0</item> <item>1</item> <item>2</item> </string-array> <!-- For keyboard color scheme option dialog. --> <string-array name="keyboard_color_schemes"> <item>@string/keyboard_color_scheme_white</item> <item>@string/keyboard_color_scheme_blue</item> </string-array> <!-- An element must be an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string-array name="keyboard_color_schemes_values"> <item>2</item> <item>0</item> </string-array> <!-- Subtype locale display name exceptions. For each exception, there should be related string resources for display name that may have explicit keyboard layout. The string resource name must be "subtype_<locale>" or Loading java/res/xml/prefs.xml +8 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,14 @@ android:summary="@string/sliding_key_input_preview_summary" android:persistent="true" android:defaultValue="true" /> <ListPreference android:key="pref_keyboard_layout_20110916" android:title="@string/keyboard_color_scheme" android:summary="%s" android:persistent="true" android:entryValues="@array/keyboard_color_schemes_values" android:entries="@array/keyboard_color_schemes" android:defaultValue="@string/config_default_keyboard_theme_index" /> <PreferenceScreen android:fragment="com.android.inputmethod.latin.settings.AdditionalSubtypeSettings" android:key="custom_input_styles" Loading java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +17 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.View; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.compat.InputMethodServiceCompatUtils; import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetException; import com.android.inputmethod.keyboard.internal.KeyboardState; import com.android.inputmethod.latin.InputView; Loading Loading @@ -75,6 +76,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private EmojiPalettesView mEmojiPalettesView; private LatinIME mLatinIME; private Resources mResources; private boolean mIsHardwareAcceleratedDrawingEnabled; private KeyboardState mState; Loading Loading @@ -108,7 +110,16 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mPrefs = prefs; mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mState = new KeyboardState(this); setContextThemeWrapper(latinIme, getKeyboardTheme(latinIme, prefs)); mIsHardwareAcceleratedDrawingEnabled = InputMethodServiceCompatUtils.enableHardwareAcceleration(mLatinIME); } public void updateKeyboardTheme() { final boolean themeUpdated = updateKeyboardThemeAndContextThemeWrapper( mLatinIME, getKeyboardTheme(mLatinIME, mPrefs)); if (themeUpdated && mKeyboardView != null) { mLatinIME.setInputView(onCreateInputView(mIsHardwareAcceleratedDrawingEnabled)); } } private static KeyboardTheme getKeyboardTheme(final Context context, Loading @@ -128,12 +139,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { return KEYBOARD_THEMES[Integer.valueOf(defaultIndex)]; } private void setContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) { private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) { if (mThemeContext == null || mKeyboardTheme.mThemeId != keyboardTheme.mThemeId) { mKeyboardTheme = keyboardTheme; mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId); KeyboardLayoutSet.clearKeyboardCache(); return true; } return false; } public void loadKeyboard(final EditorInfo editorInfo, final SettingsValues settingsValues) { Loading Loading @@ -365,7 +379,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardView.closing(); } setContextThemeWrapper(mLatinIME, mKeyboardTheme); updateKeyboardThemeAndContextThemeWrapper(mLatinIME, mKeyboardTheme); mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( R.layout.input_view, null); mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); Loading java/src/com/android/inputmethod/latin/LatinIME.java +1 −0 Original line number Diff line number Diff line Loading @@ -811,6 +811,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen super.onStartInputView(editorInfo, restarting); mRichImm.clearSubtypeCaches(); final KeyboardSwitcher switcher = mKeyboardSwitcher; switcher.updateKeyboardTheme(); final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView(); // If we are starting input in a different text field from before, we'll have to reload // settings, so currentSettingsValues can't be final. Loading Loading
java/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ <integer name="config_keyboard_grid_width">32</integer> <integer name="config_keyboard_grid_height">16</integer> <integer name="config_double_space_period_timeout">1100</integer> <!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. --> <!-- This configuration is an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string name="config_default_keyboard_theme_index" translatable="false">2</string> <integer name="config_max_more_keys_column">5</integer> Loading
java/res/values/donottranslate.xml +12 −0 Original line number Diff line number Diff line Loading @@ -111,12 +111,24 @@ <item>@string/layout_gingerbread</item> <item>@string/layout_klp</item> </string-array> <!-- An element must be an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string-array name="keyboard_layout_modes_values"> <item>0</item> <item>1</item> <item>2</item> </string-array> <!-- For keyboard color scheme option dialog. --> <string-array name="keyboard_color_schemes"> <item>@string/keyboard_color_scheme_white</item> <item>@string/keyboard_color_scheme_blue</item> </string-array> <!-- An element must be an index of {@link KeyboardSwitcher#KEYBOARD_THEMES[]}. --> <string-array name="keyboard_color_schemes_values"> <item>2</item> <item>0</item> </string-array> <!-- Subtype locale display name exceptions. For each exception, there should be related string resources for display name that may have explicit keyboard layout. The string resource name must be "subtype_<locale>" or Loading
java/res/xml/prefs.xml +8 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,14 @@ android:summary="@string/sliding_key_input_preview_summary" android:persistent="true" android:defaultValue="true" /> <ListPreference android:key="pref_keyboard_layout_20110916" android:title="@string/keyboard_color_scheme" android:summary="%s" android:persistent="true" android:entryValues="@array/keyboard_color_schemes_values" android:entries="@array/keyboard_color_schemes" android:defaultValue="@string/config_default_keyboard_theme_index" /> <PreferenceScreen android:fragment="com.android.inputmethod.latin.settings.AdditionalSubtypeSettings" android:key="custom_input_styles" Loading
java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +17 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.View; import android.view.inputmethod.EditorInfo; import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.compat.InputMethodServiceCompatUtils; import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetException; import com.android.inputmethod.keyboard.internal.KeyboardState; import com.android.inputmethod.latin.InputView; Loading Loading @@ -75,6 +76,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { private EmojiPalettesView mEmojiPalettesView; private LatinIME mLatinIME; private Resources mResources; private boolean mIsHardwareAcceleratedDrawingEnabled; private KeyboardState mState; Loading Loading @@ -108,7 +110,16 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mPrefs = prefs; mSubtypeSwitcher = SubtypeSwitcher.getInstance(); mState = new KeyboardState(this); setContextThemeWrapper(latinIme, getKeyboardTheme(latinIme, prefs)); mIsHardwareAcceleratedDrawingEnabled = InputMethodServiceCompatUtils.enableHardwareAcceleration(mLatinIME); } public void updateKeyboardTheme() { final boolean themeUpdated = updateKeyboardThemeAndContextThemeWrapper( mLatinIME, getKeyboardTheme(mLatinIME, mPrefs)); if (themeUpdated && mKeyboardView != null) { mLatinIME.setInputView(onCreateInputView(mIsHardwareAcceleratedDrawingEnabled)); } } private static KeyboardTheme getKeyboardTheme(final Context context, Loading @@ -128,12 +139,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { return KEYBOARD_THEMES[Integer.valueOf(defaultIndex)]; } private void setContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) { private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context, final KeyboardTheme keyboardTheme) { if (mThemeContext == null || mKeyboardTheme.mThemeId != keyboardTheme.mThemeId) { mKeyboardTheme = keyboardTheme; mThemeContext = new ContextThemeWrapper(context, keyboardTheme.mStyleId); KeyboardLayoutSet.clearKeyboardCache(); return true; } return false; } public void loadKeyboard(final EditorInfo editorInfo, final SettingsValues settingsValues) { Loading Loading @@ -365,7 +379,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardView.closing(); } setContextThemeWrapper(mLatinIME, mKeyboardTheme); updateKeyboardThemeAndContextThemeWrapper(mLatinIME, mKeyboardTheme); mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( R.layout.input_view, null); mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); Loading
java/src/com/android/inputmethod/latin/LatinIME.java +1 −0 Original line number Diff line number Diff line Loading @@ -811,6 +811,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen super.onStartInputView(editorInfo, restarting); mRichImm.clearSubtypeCaches(); final KeyboardSwitcher switcher = mKeyboardSwitcher; switcher.updateKeyboardTheme(); final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView(); // If we are starting input in a different text field from before, we'll have to reload // settings, so currentSettingsValues can't be final. Loading