Merge "Add config_default_keyboard_theme_id resource"
commit
07357f33db
|
@ -27,6 +27,8 @@
|
|||
<bool name="config_sliding_key_input_enabled">false</bool>
|
||||
<!-- Whether or not Popup on key press is enabled by default -->
|
||||
<bool name="config_default_popup_preview">false</bool>
|
||||
<!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
|
||||
<string name="config_default_keyboard_theme_id">5</string>
|
||||
<string name="config_text_size_of_language_on_spacebar">medium</string>
|
||||
<integer name="config_max_popup_keyboard_column">9</integer>
|
||||
</resources>
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
<integer name="config_long_press_shift_key_timeout">1200</integer>
|
||||
<integer name="config_touch_noise_threshold_millis">40</integer>
|
||||
<dimen name="config_touch_noise_threshold_distance">2.0mm</dimen>
|
||||
<!-- This configuration is the index of the array {@link KeyboardSwitcher.KEYBOARD_THEMES}. -->
|
||||
<string name="config_default_keyboard_theme_id">4</string>
|
||||
<string name="config_text_size_of_language_on_spacebar">small</string>
|
||||
<integer name="config_max_popup_keyboard_column">9</integer>
|
||||
<!-- Whether or not auto-correction should be enabled by default -->
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
android:persistent="true"
|
||||
android:entryValues="@array/keyboard_layout_modes_values"
|
||||
android:entries="@array/keyboard_layout_modes"
|
||||
android:defaultValue="5"
|
||||
android:defaultValue="@string/config_default_keyboard_theme_id"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference
|
||||
|
|
|
@ -39,16 +39,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
private static final boolean DEBUG = false;
|
||||
public static final boolean DEBUG_STATE = false;
|
||||
|
||||
// Changing DEFAULT_LAYOUT_ID also requires prefs_for_debug.xml to be matched with.
|
||||
public static final String DEFAULT_LAYOUT_ID = "5";
|
||||
private static String sConfigDefaultKeyboardThemeId;
|
||||
public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
|
||||
private static final int[] THEMES = new int [] {
|
||||
private static final int[] KEYBOARD_THEMES = {
|
||||
R.layout.input_basic,
|
||||
R.layout.input_basic_highcontrast,
|
||||
R.layout.input_stone_normal,
|
||||
R.layout.input_stone_bold,
|
||||
R.layout.input_gingerbread,
|
||||
R.layout.input_honeycomb, // DEFAULT_LAYOUT_ID
|
||||
R.layout.input_honeycomb,
|
||||
};
|
||||
|
||||
private SubtypeSwitcher mSubtypeSwitcher;
|
||||
|
@ -111,8 +110,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
sInstance.mPrefs = prefs;
|
||||
sInstance.mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
||||
|
||||
sInstance.mLayoutId = Integer.valueOf(
|
||||
prefs.getString(PREF_KEYBOARD_LAYOUT, DEFAULT_LAYOUT_ID));
|
||||
try {
|
||||
sConfigDefaultKeyboardThemeId = ims.getString(
|
||||
R.string.config_default_keyboard_theme_id);
|
||||
sInstance.mLayoutId = Integer.valueOf(
|
||||
prefs.getString(PREF_KEYBOARD_LAYOUT, sConfigDefaultKeyboardThemeId));
|
||||
} catch (NumberFormatException e) {
|
||||
sConfigDefaultKeyboardThemeId = "0";
|
||||
sInstance.mLayoutId = 0;
|
||||
}
|
||||
prefs.registerOnSharedPreferenceChangeListener(sInstance);
|
||||
}
|
||||
|
||||
|
@ -609,8 +615,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
if (mInputView != null) {
|
||||
mInputView.closing();
|
||||
}
|
||||
if (THEMES.length <= layoutId) {
|
||||
layoutId = Integer.valueOf(DEFAULT_LAYOUT_ID);
|
||||
if (KEYBOARD_THEMES.length <= layoutId) {
|
||||
layoutId = Integer.valueOf(sConfigDefaultKeyboardThemeId);
|
||||
}
|
||||
|
||||
Utils.GCUtils.getInstance().reset();
|
||||
|
@ -618,7 +624,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
|
||||
try {
|
||||
mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater(
|
||||
).inflate(THEMES[layoutId], null);
|
||||
).inflate(KEYBOARD_THEMES[layoutId], null);
|
||||
tryGC = false;
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.w(TAG, "load keyboard failed: " + e);
|
||||
|
@ -651,7 +657,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (PREF_KEYBOARD_LAYOUT.equals(key)) {
|
||||
final int layoutId = Integer.valueOf(
|
||||
sharedPreferences.getString(key, DEFAULT_LAYOUT_ID));
|
||||
sharedPreferences.getString(key, sConfigDefaultKeyboardThemeId));
|
||||
createInputViewInternal(layoutId, false);
|
||||
postSetInputView();
|
||||
} else if (Settings.PREF_SETTINGS_KEY.equals(key)) {
|
||||
|
|
Loading…
Reference in New Issue