Merge "Make Keyboard aware of theme"

main
Tadashi G. Takaoka 2011-06-15 03:56:26 -07:00 committed by Android (Google) Code Review
commit 66bafe24f6
12 changed files with 79 additions and 51 deletions

View File

@ -16,6 +16,8 @@
<resources> <resources>
<declare-styleable name="KeyboardTheme"> <declare-styleable name="KeyboardTheme">
<!-- Keyboard style -->
<attr name="keyboardStyle" format="reference" />
<!-- KeyboardView style --> <!-- KeyboardView style -->
<attr name="keyboardViewStyle" format="reference" /> <attr name="keyboardViewStyle" format="reference" />
<attr name="keyPreviewStyle" format="reference" /> <attr name="keyPreviewStyle" format="reference" />
@ -113,6 +115,8 @@
<attr name="verticalGap" format="dimension|fraction" /> <attr name="verticalGap" format="dimension|fraction" />
<!-- Popup keyboard layout template --> <!-- Popup keyboard layout template -->
<attr name="popupKeyboardTemplate" format="reference" /> <attr name="popupKeyboardTemplate" format="reference" />
<!-- Popup hint icon -->
<attr name="popupHintIcon" format="reference" />
<!-- Locale of the keyboard layout --> <!-- Locale of the keyboard layout -->
<attr name="keyboardLocale" format="string" /> <attr name="keyboardLocale" format="string" />
</declare-styleable> </declare-styleable>
@ -146,10 +150,11 @@
<!-- The key label option --> <!-- The key label option -->
<attr name="keyLabelOption" format="integer"> <attr name="keyLabelOption" format="integer">
<!-- This should be aligned with KeyboardView.KEY_LABEL_OPTION_* --> <!-- This should be aligned with KeyboardView.KEY_LABEL_OPTION_* -->
<flag name="alignLeft" value="1" /> <flag name="alignLeft" value="0x01" />
<flag name="alignRight" value="2" /> <flag name="alignRight" value="0x02" />
<flag name="alignBottom" value="8" /> <flag name="alignBottom" value="0x08" />
<flag name="fontNormal" value="16" /> <flag name="fontNormal" value="0x10" />
<flag name="popupHint" value="0x20" />
</attr> </attr>
<!-- The unicode that this key generates in manual temporary upper case mode. --> <!-- The unicode that this key generates in manual temporary upper case mode. -->
<attr name="manualTemporaryUpperCaseCode" format="integer" /> <attr name="manualTemporaryUpperCaseCode" format="integer" />
@ -200,9 +205,9 @@
</attr> </attr>
<attr name="webInput" format="boolean" /> <attr name="webInput" format="boolean" />
<attr name="passwordInput" format="boolean" /> <attr name="passwordInput" format="boolean" />
<attr name="hasSettingsKey" format="string" /> <attr name="hasSettingsKey" format="boolean" />
<attr name="voiceKeyEnabled" format="string" /> <attr name="voiceKeyEnabled" format="boolean" />
<attr name="hasVoiceKey" format="string" /> <attr name="hasVoiceKey" format="boolean" />
<attr name="imeAction" format="enum"> <attr name="imeAction" format="enum">
<!-- This should be aligned with EditorInfo.IME_ACTION_* --> <!-- This should be aligned with EditorInfo.IME_ACTION_* -->
<enum name="actionUnspecified" value="0" /> <enum name="actionUnspecified" value="0" />

View File

@ -16,6 +16,9 @@
<resources> <resources>
<!-- Theme "Basic" --> <!-- Theme "Basic" -->
<style name="Keyboard" >
<item name="popupHintIcon">@drawable/hint_popup</item>
</style>
<style name="KeyboardView"> <style name="KeyboardView">
<item name="android:background">@drawable/keyboard_background</item> <item name="android:background">@drawable/keyboard_background</item>
<item name="keyBackground">@drawable/btn_keyboard_key</item> <item name="keyBackground">@drawable/btn_keyboard_key</item>
@ -89,6 +92,9 @@
<item name="android:background">@null</item> <item name="android:background">@null</item>
</style> </style>
<!-- Theme "Honeycomb" --> <!-- Theme "Honeycomb" -->
<style name="Keyboard.Honeycomb" parent="Keyboard" >
<item name="popupHintIcon">@drawable/hint_popup_holo</item>
</style>
<style name="KeyboardView.Honeycomb" parent="KeyboardView"> <style name="KeyboardView.Honeycomb" parent="KeyboardView">
<item name="android:background">@drawable/keyboard_background_holo</item> <item name="android:background">@drawable/keyboard_background_holo</item>
<item name="keyBackground">@drawable/btn_keyboard_key_honeycomb</item> <item name="keyBackground">@drawable/btn_keyboard_key_honeycomb</item>
@ -111,13 +117,13 @@
<item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_padding_holo</item> <item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_padding_holo</item>
<item name="android:paddingRight">@dimen/mini_keyboard_horizontal_padding_holo</item> <item name="android:paddingRight">@dimen/mini_keyboard_horizontal_padding_holo</item>
</style> </style>
<style name="SuggestionsStripBackgroundStyle.Holo"> <style name="SuggestionsStripBackgroundStyle.Honeycomb">
<item name="android:background">@drawable/keyboard_suggest_strip_holo</item> <item name="android:background">@drawable/keyboard_suggest_strip_holo</item>
</style> </style>
<style name="SuggestionBackgroundStyle.Holo"> <style name="SuggestionBackgroundStyle.Honeycomb">
<item name="android:background">@drawable/btn_candidate_holo</item> <item name="android:background">@drawable/btn_candidate_holo</item>
</style> </style>
<style name="SuggestionPreviewBackgroundStyle.Holo"> <style name="SuggestionPreviewBackgroundStyle.Honeycomb">
<item name="android:background">@drawable/keyboard_popup_panel_background_holo</item> <item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
</style> </style>
<style name="PopupMiniKeyboardAnimation"> <style name="PopupMiniKeyboardAnimation">

View File

@ -16,6 +16,7 @@
<resources> <resources>
<style name="KeyboardTheme" parent="android:Theme"> <style name="KeyboardTheme" parent="android:Theme">
<item name="keyboardStyle">@style/Keyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView</item> <item name="keyboardViewStyle">@style/KeyboardView</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item> <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
@ -25,6 +26,7 @@
<item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item> <item name="suggestionPreviewBackgroundStyle">@style/SuggestionPreviewBackgroundStyle</item>
</style> </style>
<style name="KeyboardTheme.HighContrast" parent="android:Theme"> <style name="KeyboardTheme.HighContrast" parent="android:Theme">
<item name="keyboardStyle">@style/Keyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item> <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item> <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
@ -33,6 +35,7 @@
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
</style> </style>
<style name="KeyboardTheme.Stone" parent="android:Theme.Light"> <style name="KeyboardTheme.Stone" parent="android:Theme.Light">
<item name="keyboardStyle">@style/Keyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView.Stone</item> <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item> <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
@ -41,6 +44,7 @@
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
</style> </style>
<style name="KeyboardTheme.Stone.Bold" parent="android:Theme.Light"> <style name="KeyboardTheme.Stone.Bold" parent="android:Theme.Light">
<item name="keyboardStyle">@style/Keyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item> <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item> <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
@ -49,6 +53,7 @@
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
</style> </style>
<style name="KeyboardTheme.Gingerbread" parent="android:Theme.Black"> <style name="KeyboardTheme.Gingerbread" parent="android:Theme.Black">
<item name="keyboardStyle">@style/Keyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item> <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item> <item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
@ -57,11 +62,12 @@
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
</style> </style>
<style name="KeyboardTheme.Honeycomb" parent="android:Theme.Holo"> <style name="KeyboardTheme.Honeycomb" parent="android:Theme.Holo">
<item name="keyboardStyle">@style/Keyboard.Honeycomb</item>
<item name="keyboardViewStyle">@style/KeyboardView.Honeycomb</item> <item name="keyboardViewStyle">@style/KeyboardView.Honeycomb</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle.Honeycomb</item> <item name="keyPreviewStyle">@style/KeyPreviewStyle.Honeycomb</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Honeycomb</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Honeycomb</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.Honeycomb</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.Honeycomb</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Holo</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.Honeycomb</item>
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Holo</item> <item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.Honeycomb</item>
</style> </style>
</resources> </resources>

View File

@ -75,7 +75,7 @@
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
latin:keyOutputText=":-) " latin:keyOutputText=":-) "
latin:keyHintIcon="@drawable/hint_popup_holo" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_smiley" latin:popupCharacters="@string/alternates_for_smiley"
latin:maxPopupKeyboardColumn="5" /> latin:maxPopupKeyboardColumn="5" />
<switch> <switch>
@ -87,7 +87,7 @@
latin:code="@integer/key_shortcut" latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_keyboard_voice_holo" latin:keyIcon="@drawable/sym_keyboard_voice_holo"
latin:iconPreview="@drawable/sym_keyboard_feedback_mic" latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
latin:keyHintIcon="@drawable/hint_popup_holo" latin:keyLabelOption="popupHint"
latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings" latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings"
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />
</case> </case>
@ -137,7 +137,7 @@
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
latin:keyOutputText=":-) " latin:keyOutputText=":-) "
latin:keyHintIcon="@drawable/hint_popup_holo" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_smiley" latin:popupCharacters="@string/alternates_for_smiley"
latin:maxPopupKeyboardColumn="5" /> latin:maxPopupKeyboardColumn="5" />
<switch> <switch>
@ -149,7 +149,7 @@
latin:code="@integer/key_shortcut" latin:code="@integer/key_shortcut"
latin:keyIcon="@drawable/sym_bkeyboard_mic" latin:keyIcon="@drawable/sym_bkeyboard_mic"
latin:iconPreview="@drawable/sym_keyboard_feedback_mic" latin:iconPreview="@drawable/sym_keyboard_feedback_mic"
latin:keyHintIcon="@drawable/hint_popup_holo" latin:keyLabelOption="popupHint"
latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings" latin:popupCharacters="\@drawable/sym_keyboard_settings|\@integer/key_settings"
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />
</case> </case>
@ -192,9 +192,8 @@
<key-style <key-style
latin:styleName="comKeyStyle" latin:styleName="comKeyStyle"
latin:keyLabel="@string/keylabel_for_popular_domain" latin:keyLabel="@string/keylabel_for_popular_domain"
latin:keyLabelOption="fontNormal" latin:keyLabelOption="fontNormal|popupHint"
latin:keyOutputText="@string/keylabel_for_popular_domain" latin:keyOutputText="@string/keylabel_for_popular_domain"
latin:keyHintIcon="@drawable/hint_popup_holo"
latin:popupCharacters="@string/alternates_for_popular_domain" /> latin:popupCharacters="@string/alternates_for_popular_domain" />
<switch> <switch>
<case <case

View File

@ -62,7 +62,7 @@
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
latin:keyOutputText=":-) " latin:keyOutputText=":-) "
latin:keyHintIcon="@drawable/hint_popup_holo" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_smiley" latin:popupCharacters="@string/alternates_for_smiley"
latin:maxPopupKeyboardColumn="5" /> latin:maxPopupKeyboardColumn="5" />
<key-style <key-style
@ -116,7 +116,7 @@
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
latin:keyOutputText=":-) " latin:keyOutputText=":-) "
latin:keyHintIcon="@drawable/hint_popup_holo" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_smiley" latin:popupCharacters="@string/alternates_for_smiley"
latin:maxPopupKeyboardColumn="5" /> latin:maxPopupKeyboardColumn="5" />
<key-style <key-style
@ -161,9 +161,8 @@
<key-style <key-style
latin:styleName="comKeyStyle" latin:styleName="comKeyStyle"
latin:keyLabel="@string/keylabel_for_popular_domain" latin:keyLabel="@string/keylabel_for_popular_domain"
latin:keyLabelOption="fontNormal" latin:keyLabelOption="fontNormal|popupHint"
latin:keyOutputText="@string/keylabel_for_popular_domain" latin:keyOutputText="@string/keylabel_for_popular_domain"
latin:keyHintIcon="@drawable/hint_popup_holo"
latin:popupCharacters="@string/alternates_for_popular_domain" /> latin:popupCharacters="@string/alternates_for_popular_domain" />
<switch> <switch>
<case <case

View File

@ -50,7 +50,7 @@
<default> <default>
<key-style <key-style
latin:styleName="settingsPopupStyle" latin:styleName="settingsPopupStyle"
latin:keyHintIcon="@drawable/hint_popup" latin:keyLabelOption="popupHint"
latin:popupCharacters="\@drawable/sym_keyboard_settings_holo|\@integer/key_settings" latin:popupCharacters="\@drawable/sym_keyboard_settings_holo|\@integer/key_settings"
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />
</default> </default>
@ -308,7 +308,7 @@
latin:styleName="smileyKeyStyle" latin:styleName="smileyKeyStyle"
latin:keyLabel=":-)" latin:keyLabel=":-)"
latin:keyOutputText=":-) " latin:keyOutputText=":-) "
latin:keyHintIcon="@drawable/hint_popup" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_smiley" latin:popupCharacters="@string/alternates_for_smiley"
latin:maxPopupKeyboardColumn="5" latin:maxPopupKeyboardColumn="5"
latin:parentStyle="functionalKeyStyle" /> latin:parentStyle="functionalKeyStyle" />

View File

@ -59,15 +59,15 @@
latin:webInput="true" latin:webInput="true"
> >
<Key <Key
latin:keyHintIcon="@drawable/hint_popup" latin:keyStyle="tabKeyStyle"
latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_web_tab_punctuation" latin:popupCharacters="@string/alternates_for_web_tab_punctuation"
latin:maxPopupKeyboardColumn="8" latin:maxPopupKeyboardColumn="8" />
latin:keyStyle="tabKeyStyle" />
</case> </case>
<default> <default>
<Key <Key
latin:keyLabel="." latin:keyLabel="."
latin:keyHintIcon="@drawable/hint_popup" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_punctuation" latin:popupCharacters="@string/alternates_for_punctuation"
latin:maxPopupKeyboardColumn="7" latin:maxPopupKeyboardColumn="7"
latin:keyStyle="functionalKeyStyle" /> latin:keyStyle="functionalKeyStyle" />

View File

@ -56,7 +56,7 @@
</switch> </switch>
<Key <Key
latin:keyLabel="." latin:keyLabel="."
latin:keyHintIcon="@drawable/hint_popup" latin:keyLabelOption="popupHint"
latin:popupCharacters="@string/alternates_for_punctuation" latin:popupCharacters="@string/alternates_for_punctuation"
latin:maxPopupKeyboardColumn="7" latin:maxPopupKeyboardColumn="7"
latin:keyStyle="functionalKeyStyle" /> latin:keyStyle="functionalKeyStyle" />

View File

@ -16,15 +16,16 @@
package com.android.inputmethod.keyboard; package com.android.inputmethod.keyboard;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.Log;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -146,6 +147,8 @@ public class Keyboard {
private final ProximityInfo mProximityInfo; private final ProximityInfo mProximityInfo;
public final Drawable mPopupHintIcon;
/** /**
* Creates a keyboard from the given xml key layout file. * Creates a keyboard from the given xml key layout file.
* @param context the application or service context * @param context the application or service context
@ -171,8 +174,14 @@ public class Keyboard {
mDefaultVerticalGap = 0; mDefaultVerticalGap = 0;
mDefaultHeight = mDefaultWidth; mDefaultHeight = mDefaultWidth;
mId = id; mId = id;
loadKeyboard(context, xmlLayoutResId);
mProximityInfo = new ProximityInfo(GRID_WIDTH, GRID_HEIGHT); mProximityInfo = new ProximityInfo(GRID_WIDTH, GRID_HEIGHT);
final TypedArray attrs = context.obtainStyledAttributes(
null, R.styleable.Keyboard, R.attr.keyboardStyle, R.style.Keyboard);
mPopupHintIcon = attrs.getDrawable(R.styleable.Keyboard_popupHintIcon);
attrs.recycle();
loadKeyboard(context, xmlLayoutResId);
} }
public int getProximityInfo() { public int getProximityInfo() {

View File

@ -16,12 +16,6 @@
package com.android.inputmethod.keyboard; package com.android.inputmethod.keyboard;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.latin.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
@ -31,6 +25,12 @@ import android.util.TypedValue;
import android.util.Xml; import android.util.Xml;
import android.view.InflateException; import android.view.InflateException;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.latin.R;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

View File

@ -202,7 +202,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
final Locale savedLocale = Utils.setSystemLocale(res, final Locale savedLocale = Utils.setSystemLocale(res,
mSubtypeSwitcher.getInputLocale()); mSubtypeSwitcher.getInputLocale());
keyboard = new LatinKeyboard(mInputMethodService, id, id.mWidth); final Context themeContext = new ContextThemeWrapper(mInputMethodService,
KEYBOARD_THEMES[mThemeIndex]);
keyboard = new LatinKeyboard(themeContext, id, id.mWidth);
if (id.mEnableShiftLock) { if (id.mEnableShiftLock) {
keyboard.enableShiftLock(); keyboard.enableShiftLock();

View File

@ -16,9 +16,6 @@
package com.android.inputmethod.keyboard; package com.android.inputmethod.keyboard;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Resources; import android.content.res.Resources;
@ -50,6 +47,9 @@ import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.WeakHashMap; import java.util.WeakHashMap;
@ -176,10 +176,11 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f; private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f;
private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f; private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f;
private final String KEY_LABEL_REFERENCE_CHAR = "H"; private final String KEY_LABEL_REFERENCE_CHAR = "H";
private final int KEY_LABEL_OPTION_ALIGN_LEFT = 1; private final int KEY_LABEL_OPTION_ALIGN_LEFT = 0x01;
private final int KEY_LABEL_OPTION_ALIGN_RIGHT = 2; private final int KEY_LABEL_OPTION_ALIGN_RIGHT = 0x02;
private final int KEY_LABEL_OPTION_ALIGN_BOTTOM = 8; private final int KEY_LABEL_OPTION_ALIGN_BOTTOM = 0x08;
private final int KEY_LABEL_OPTION_FONT_NORMAL = 16; private final int KEY_LABEL_OPTION_FONT_NORMAL = 0x10;
private final int KEY_LABEL_OPTION_POPUP_HINT = 0x20;
private final int mKeyLabelHorizontalPadding; private final int mKeyLabelHorizontalPadding;
private final UIHandler mHandler = new UIHandler(); private final UIHandler mHandler = new UIHandler();
@ -762,14 +763,15 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
} }
// Draw hint icon. // Draw hint icon.
if (key.mHintIcon != null) { if (key.mHintIcon != null || (key.mLabelOption & KEY_LABEL_OPTION_POPUP_HINT) != 0) {
final int drawableWidth = keyDrawWidth; final int drawableWidth = keyDrawWidth;
final int drawableHeight = key.mHeight; final int drawableHeight = key.mHeight;
final int drawableX = 0; final int drawableX = 0;
final int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL; final int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL;
Drawable hintIcon = (isManualTemporaryUpperCase Drawable hintIcon = (isManualTemporaryUpperCase
&& key.mManualTemporaryUpperCaseHintIcon != null) && key.mManualTemporaryUpperCaseHintIcon != null)
? key.mManualTemporaryUpperCaseHintIcon : key.mHintIcon; ? key.mManualTemporaryUpperCaseHintIcon
: (key.mHintIcon != null ? key.mHintIcon : mKeyboard.mPopupHintIcon);
drawIcon(canvas, hintIcon, drawableX, drawableY, drawableWidth, drawableHeight); drawIcon(canvas, hintIcon, drawableX, drawableY, drawableWidth, drawableHeight);
if (DEBUG_SHOW_ALIGN) if (DEBUG_SHOW_ALIGN)
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight, drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,