diff options
author | 2010-06-29 05:32:48 +0900 | |
---|---|---|
committer | 2010-06-29 08:41:33 +0900 | |
commit | 6c20ab55b5b33543aedf5a56ffdea0b85f9e9cb6 (patch) | |
tree | 396b3b107cf9be08509e512b5241456708386209 /java/src/com/android/inputmethod | |
parent | cd61cadb717264953e56db5d292bf81fa88c81b7 (diff) | |
download | latinime-6c20ab55b5b33543aedf5a56ffdea0b85f9e9cb6.tar.gz latinime-6c20ab55b5b33543aedf5a56ffdea0b85f9e9cb6.tar.xz latinime-6c20ab55b5b33543aedf5a56ffdea0b85f9e9cb6.zip |
Add a typeFace element and a symbol's color element
- add default bold theme
- add
Change-Id: Ie3f31a6973c12e7f8b885d0036f50e8647c9fe82
Diffstat (limited to 'java/src/com/android/inputmethod')
3 files changed, 36 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 665e16aec..bbde23221 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -48,10 +48,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public static final int KEYBOARDMODE_IM = R.id.mode_im; public static final int KEYBOARDMODE_WEB = R.id.mode_webentry; - public static final String DEFAULT_LAYOUT_ID = "2"; + public static final String DEFAULT_LAYOUT_ID = "3"; public static final String PREF_KEYBOARD_LAYOUT = "keyboard_layout"; private static final int[] LAYOUTS = new int [] { - R.layout.input, R.layout.input2, R.layout.input7}; + R.layout.input_basic, R.layout.input_basic_highcontrast, R.layout.input_stone_normal, + R.layout.input_stone_bold}; private static final int SYMBOLS_MODE_STATE_NONE = 0; private static final int SYMBOLS_MODE_STATE_BEGIN = 1; @@ -424,8 +425,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } } - // TODO: Generalize for any theme public boolean isBlackSym () { - return (mLayoutId == 6); + if (mInputView != null && mInputView.getSymbolColorSheme() == 1) { + return true; + } + return false; } } diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index 42d5689d2..e8899504e 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -264,8 +264,10 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang Log.d(TAG, "Log theme Id. (1)"); } // TODO: Not to convert theme ID here. Currently "2" is treated as "6" in a log server. - if (mThemeId == "2") { + if (mThemeId.equals("2")) { mThemeId = "6"; + } else if (mThemeId.equals("3")) { + mThemeId = "7"; } mLogBuffer.add(new LogEntry (time, ID_THEME_ID, new String[] {mThemeId})); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 64299b626..6b8d4f890 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -165,6 +165,8 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener private Map<Key,View> mMiniKeyboardCache; private int[] mWindowOffset; private Key[] mKeys; + private Typeface mKeyTextStyle = Typeface.DEFAULT; + private int mSymbolColorScheme = 0; /** Listener for {@link OnKeyboardActionListener}. */ private OnKeyboardActionListener mKeyboardActionListener; @@ -334,6 +336,24 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener case R.styleable.LatinKeyboardBaseView_backgroundDimAmount: mBackgroundDimAmount = a.getFloat(attr, 0.5f); break; + //case android.R.styleable. + case R.styleable.LatinKeyboardBaseView_keyTextStyle: + int textStyle = a.getInt(attr, 0); + switch (textStyle) { + case 0: + mKeyTextStyle = Typeface.DEFAULT; + break; + case 1: + mKeyTextStyle = Typeface.DEFAULT_BOLD; + break; + default: + mKeyTextStyle = Typeface.defaultFromStyle(textStyle); + break; + } + break; + case R.styleable.LatinKeyboardBaseView_symbolColorScheme: + mSymbolColorScheme = a.getInt(attr, 0); + break; } } @@ -526,6 +546,10 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener return mShowPreview; } + public int getSymbolColorSheme() { + return mSymbolColorScheme; + } + public void setVerticalCorrection(int verticalOffset) { } @@ -693,7 +717,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener paint.setTypeface(Typeface.DEFAULT_BOLD); } else { paint.setTextSize(mKeyTextSize); - paint.setTypeface(Typeface.DEFAULT); + paint.setTypeface(mKeyTextStyle); } // Draw a drop shadow for the text paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor); @@ -894,7 +918,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener mPreviewText.setTypeface(Typeface.DEFAULT_BOLD); } else { mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge); - mPreviewText.setTypeface(Typeface.DEFAULT); + mPreviewText.setTypeface(mKeyTextStyle); } } mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), |