diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/res/values/attrs.xml | 1 | ||||
-rw-r--r-- | java/res/values/themes-basic-highcontrast.xml | 1 | ||||
-rw-r--r-- | java/res/values/themes-basic.xml | 1 | ||||
-rw-r--r-- | java/res/values/themes-gingerbread.xml | 1 | ||||
-rw-r--r-- | java/res/values/themes-ics.xml | 1 | ||||
-rw-r--r-- | java/res/values/themes-stone-bold.xml | 1 | ||||
-rw-r--r-- | java/res/values/themes-stone.xml | 1 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Keyboard.java | 15 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java | 6 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java | 1 |
11 files changed, 31 insertions, 2 deletions
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 1776630d9..2a7632124 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -16,6 +16,7 @@ <resources> <declare-styleable name="KeyboardTheme"> + <attr name="themeId" format="integer" /> <!-- Keyboard style --> <attr name="keyboardStyle" format="reference" /> <!-- LatinKeyboard style --> diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml index ce0598042..91272356f 100644 --- a/java/res/values/themes-basic-highcontrast.xml +++ b/java/res/values/themes-basic-highcontrast.xml @@ -16,6 +16,7 @@ <resources> <style name="KeyboardTheme.HighContrast" parent="KeyboardIcons"> + <item name="themeId">1</item> <item name="keyboardStyle">@style/Keyboard</item> <item name="latinKeyboardStyle">@style/LatinKeyboard</item> <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item> diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml index ff9fed55f..6c0e16e7b 100644 --- a/java/res/values/themes-basic.xml +++ b/java/res/values/themes-basic.xml @@ -16,6 +16,7 @@ <resources> <style name="KeyboardTheme" parent="KeyboardIcons"> + <item name="themeId">0</item> <item name="keyboardStyle">@style/Keyboard</item> <item name="latinKeyboardStyle">@style/LatinKeyboard</item> <item name="keyboardViewStyle">@style/KeyboardView</item> diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml index be853eb0f..43bff5082 100644 --- a/java/res/values/themes-gingerbread.xml +++ b/java/res/values/themes-gingerbread.xml @@ -16,6 +16,7 @@ <resources> <style name="KeyboardTheme.Gingerbread" parent="KeyboardIcons"> + <item name="themeId">8</item> <item name="keyboardStyle">@style/Keyboard.Gingerbread</item> <item name="latinKeyboardStyle">@style/LatinKeyboard</item> <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 618aaed79..1235d4e88 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -16,6 +16,7 @@ <resources> <style name="KeyboardTheme.IceCreamSandwich" parent="KeyboardIcons.IceCreamSandwich"> + <item name="themeId">5</item> <item name="keyboardStyle">@style/Keyboard.IceCreamSandwich</item> <item name="latinKeyboardStyle">@style/LatinKeyboard.IceCreamSandwich</item> <item name="keyboardViewStyle">@style/KeyboardView.IceCreamSandwich</item> diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml index fdf9c51f5..6e25f41d7 100644 --- a/java/res/values/themes-stone-bold.xml +++ b/java/res/values/themes-stone-bold.xml @@ -16,6 +16,7 @@ <resources> <style name="KeyboardTheme.Stone.Bold" parent="KeyboardIcons.Black"> + <item name="themeId">7</item> <item name="keyboardStyle">@style/Keyboard.Stone</item> <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item> <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item> diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml index cb3edc58f..3cbda810e 100644 --- a/java/res/values/themes-stone.xml +++ b/java/res/values/themes-stone.xml @@ -16,6 +16,7 @@ <resources> <style name="KeyboardTheme.Stone" parent="KeyboardIcons.Black"> + <item name="themeId">6</item> <item name="keyboardStyle">@style/Keyboard.Stone</item> <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item> <item name="keyboardViewStyle">@style/KeyboardView.Stone</item> diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 2f11164f9..d8f8bef9d 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -84,6 +84,7 @@ public class Keyboard { public static final int CODE_UNSPECIFIED = -99; public final KeyboardId mId; + public final int mThemeId; /** Total height of the keyboard, including the padding and keys */ public final int mOccupiedHeight; @@ -121,6 +122,7 @@ public class Keyboard { public Keyboard(KeyboardParams params) { mId = params.mId; + mThemeId = params.mThemeId; mOccupiedHeight = params.mOccupiedHeight; mOccupiedWidth = params.mOccupiedWidth; mMostCommonKeyHeight = params.mMostCommonKeyHeight; @@ -238,4 +240,17 @@ public class Keyboard { public int[] getNearestKeys(int x, int y) { return mProximityInfo.getNearestKeys(x, y); } + + public static String themeName(int themeId) { + // This should be aligned with theme-*.xml resource files' themeId attribute. + switch (themeId) { + case 0: return "Basic"; + case 1: return "BasicHighContrast"; + case 5: return "IceCreamSandwich"; + case 6: return "Stone"; + case 7: return "StoneBold"; + case 8: return "GingerBread"; + default: return null; + } + } } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java index a4684358d..13e8ba13c 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java @@ -275,10 +275,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha if (DEBUG_CACHE) { Log.d(TAG, "keyboard cache size=" + mKeyboardCache.size() + ": " - + ((ref == null) ? "LOAD" : "GCed") + " id=" + id); + + ((ref == null) ? "LOAD" : "GCed") + " id=" + id + + " theme=" + Keyboard.themeName(keyboard.mThemeId)); } } else if (DEBUG_CACHE) { - Log.d(TAG, "keyboard cache size=" + mKeyboardCache.size() + ": HIT id=" + id); + Log.d(TAG, "keyboard cache size=" + mKeyboardCache.size() + ": HIT id=" + id + + " theme=" + Keyboard.themeName(keyboard.mThemeId)); } keyboard.onAutoCorrectionStateChanged(mIsAutoCorrectionActive); diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java index 99b917c86..48f683aaf 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -244,6 +244,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> { mParams = params; + final TypedArray a = context.obtainStyledAttributes(R.styleable.KeyboardTheme); + mParams.mThemeId = a.getInt(R.styleable.KeyboardTheme_themeId, 0); + a.recycle(); + mParams.GRID_WIDTH = res.getInteger(R.integer.config_keyboard_grid_width); mParams.GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java index 01f9d3bb1..97f58fad2 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java @@ -31,6 +31,7 @@ import java.util.Set; public class KeyboardParams { public KeyboardId mId; + public int mThemeId; /** Total height and width of the keyboard, including the paddings and keys */ public int mOccupiedHeight; |