aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-05-25 03:02:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-25 03:02:25 -0700
commit9e5be6caad4654bbb765161a9ddae22949695dd3 (patch)
treeb0e22b91cf1cc8a67393c949f4c8d92ce1e6ed7f /java/src
parent30f38adb0b7c681ce459294405fb416ec15acdb4 (diff)
parent13a741999480343ccebd81ff6349b572bde17b07 (diff)
downloadlatinime-9e5be6caad4654bbb765161a9ddae22949695dd3.tar.gz
latinime-9e5be6caad4654bbb765161a9ddae22949695dd3.tar.xz
latinime-9e5be6caad4654bbb765161a9ddae22949695dd3.zip
Merge "Use custom theme for Keyboard theme switch"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java19
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java10
-rw-r--r--java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java2
3 files changed, 17 insertions, 14 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 34973105e..195c929fa 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.util.Log;
+import android.view.ContextThemeWrapper;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.View;
@@ -45,12 +46,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private static String sConfigDefaultKeyboardThemeId;
public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902";
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,
+ R.style.KeyboardTheme,
+ R.style.KeyboardTheme_HighContrast,
+ R.style.KeyboardTheme_Stone,
+ R.style.KeyboardTheme_Stone_Bold,
+ R.style.KeyboardTheme_Gingerbread,
+ R.style.KeyboardTheme_Honeycomb,
};
private SubtypeSwitcher mSubtypeSwitcher;
@@ -730,8 +731,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
boolean tryGC = true;
for (int i = 0; i < Utils.GCUtils.GC_TRY_LOOP_MAX && tryGC; ++i) {
try {
- mCurrentInputView = LayoutInflater.from(mInputMethodService).inflate(
- KEYBOARD_THEMES[themeIndex], null);
+ final Context themeContext = new ContextThemeWrapper(mInputMethodService,
+ KEYBOARD_THEMES[themeIndex]);
+ mCurrentInputView = LayoutInflater.from(themeContext).inflate(
+ R.layout.input_view, null);
tryGC = false;
} catch (OutOfMemoryError e) {
Log.w(TAG, "load keyboard failed: " + e);
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 583b997ee..185f1f8f7 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -16,10 +16,6 @@
package com.android.inputmethod.keyboard;
-import com.android.inputmethod.deprecated.VoiceProxy;
-import com.android.inputmethod.latin.LatinImeLogger;
-import com.android.inputmethod.latin.Utils;
-
import android.content.Context;
import android.graphics.Canvas;
import android.text.TextUtils;
@@ -27,6 +23,10 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
+import com.android.inputmethod.deprecated.VoiceProxy;
+import com.android.inputmethod.latin.LatinImeLogger;
+import com.android.inputmethod.latin.Utils;
+
// TODO: We should remove this class
public class LatinKeyboardView extends KeyboardView {
private static final String TAG = LatinKeyboardView.class.getSimpleName();
@@ -47,7 +47,7 @@ public class LatinKeyboardView extends KeyboardView {
private int mLastY;
public LatinKeyboardView(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
+ super(context, attrs);
}
public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) {
diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
index 62a32cf3c..fa2aa874c 100644
--- a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
@@ -41,7 +41,7 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
private long mDownTime;
public PopupMiniKeyboardView(Context context, AttributeSet attrs) {
- this(context, attrs, R.attr.keyboardViewStyle);
+ this(context, attrs, R.attr.popupMiniKeyboardViewStyle);
}
public PopupMiniKeyboardView(Context context, AttributeSet attrs, int defStyle) {