From 59c3ef1ff8df23e3c3e3f549c0289c479553c666 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 8 May 2014 12:04:36 +0900 Subject: [PATCH] Refactor KeyboardTheme This CL introduces two preference keys in addition to the existing one. - pref_keyboard_theme: The new preference key that is used only in the preference settings. - pref_keyboard_layout_20110916: The previous preference key that holds keyboard color scheme settings. This is superseded by the next key. - pref_keyboard_theme_20140509: The new preference key that holds keyboard theme settings. This value is forcibly reset to LMP theme on a LMP device. On a KitKat and previous device, the settings of the pref_keyboard_layout_20110916 is carried on into this preference. This CL must be checked in together with Id7b3ddd8aa. Change-Id: I2d55602d026e30b38d8f822d2124f5c5e4a9a812 --- java/res/values/config-common.xml | 3 - java/res/values/donottranslate.xml | 11 -- java/res/values/keyboard-themes.xml | 34 +++++ java/res/xml/prefs.xml | 5 +- .../keyboard/KeyboardSwitcher.java | 7 +- .../inputmethod/keyboard/KeyboardTheme.java | 126 +++++++++++++++--- .../inputmethod/latin/settings/Settings.java | 2 +- .../latin/settings/SettingsFragment.java | 25 +++- .../keyboard/KeyboardLayoutSetTestsBase.java | 8 +- .../keyboard/KeyboardThemeTests.java | 93 +++++++++++++ 10 files changed, 269 insertions(+), 45 deletions(-) create mode 100644 java/res/values/keyboard-themes.xml create mode 100644 tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java diff --git a/java/res/values/config-common.xml b/java/res/values/config-common.xml index 3fe4b947c..1962c0d45 100644 --- a/java/res/values/config-common.xml +++ b/java/res/values/config-common.xml @@ -24,9 +24,6 @@ at input history to suggest a hopefully helpful suggestions for the next word? --> true - - 2 - 100 1100 diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 9a610a0d0..415dd0b65 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -47,17 +47,6 @@ Debug Mode Force non-distinct multitouch - - - @string/keyboard_color_scheme_white - @string/keyboard_color_scheme_blue - - - - 2 - 0 - - + + + + @string/keyboard_color_scheme_white + @string/keyboard_color_scheme_blue + + Quantum + + + + 2 + 0 + 3 + + diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 7d86dbd5d..61ebb6992 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -158,12 +158,11 @@ android:persistent="true" android:defaultValue="false" /> + android:entries="@array/keyboard_theme_names" /> () { + @Override + public int compare(final KeyboardTheme lhs, final KeyboardTheme rhs) { + if (lhs.mMinApiVersion > rhs.mMinApiVersion) return -1; + if (lhs.mMinApiVersion < rhs.mMinApiVersion) return 1; + return 0; + } + }); + } public final int mThemeId; public final int mStyleId; + final int mMinApiVersion; // Note: The themeId should be aligned with "themeId" attribute of Keyboard style - // in values/style.xml. - public KeyboardTheme(final int themeId, final int styleId) { + // in values/themes-