Add extra key icons to KeyboardIconsSet

* Get rid of Key.keyIconShifted attribute.
    Add Keyboard.iconShiftKeyShifted to KeyboardIconsSet.
  * Get rid of LatinKeyboardView.disabledShortcutIcon attribute.
    Add Keyboard.iconShortcurKeyDisabled to KeyboardIconsSet.
  * Add Keyboard.iconSpaceKeyForNumber to KeyboardIconsSet.
  * Fix misplaced autoCorrectionSpacebarLedIcon resources.

Change-Id: I381bff3789254977ab3cb18f58f95b3c433b1e1a
main
Tadashi G. Takaoka 2011-12-18 08:00:07 +09:00
parent 1ebedd7a15
commit 7bd714c086
15 changed files with 56 additions and 93 deletions

View File

@ -124,7 +124,6 @@
</declare-styleable> </declare-styleable>
<declare-styleable name="LatinKeyboardView"> <declare-styleable name="LatinKeyboardView">
<attr name="disabledShortcutIcon" format="reference" />
</declare-styleable> </declare-styleable>
<declare-styleable name="SuggestionsView"> <declare-styleable name="SuggestionsView">
@ -185,7 +184,9 @@
<attr name="iconTabKey" format="reference" /> <attr name="iconTabKey" format="reference" />
<attr name="iconShortcutKey" format="reference" /> <attr name="iconShortcutKey" format="reference" />
<attr name="iconShortcutForLabel" format="reference" /> <attr name="iconShortcutForLabel" format="reference" />
<attr name="iconShiftedShiftKey" format="reference" /> <attr name="iconSpaceKeyForNumberLayout" format="reference" />
<attr name="iconShortcutKeyDisabled" format="reference" />
<attr name="iconShiftKeyShifted" format="reference" />
<attr name="iconPreviewTabKey" format="reference" /> <attr name="iconPreviewTabKey" format="reference" />
</declare-styleable> </declare-styleable>
@ -248,16 +249,14 @@
<enum name="iconTabKey" value="7" /> <enum name="iconTabKey" value="7" />
<enum name="iconShortcutKey" value="8" /> <enum name="iconShortcutKey" value="8" />
<enum name="iconShortcutForLabel" value="9" /> <enum name="iconShortcutForLabel" value="9" />
</attr> <enum name="iconShortcutKeyDisabled" value="10" />
<!-- Shift key icon for shifted state --> <enum name="iconSpaceKeyForNumberLayout" value="11" />
<attr name="keyIconShifted" format="enum"> <enum name="iconShiftKeyShifted" value="12" />
<!-- This should be aligned with KeyboardIcons.ICON_SHIFTED_* -->
<enum name="iconShiftedShiftKey" value="10" />
</attr> </attr>
<!-- The icon to show in the popup preview. --> <!-- The icon to show in the popup preview. -->
<attr name="keyIconPreview" format="enum"> <attr name="keyIconPreview" format="enum">
<!-- This should be aligned with KeyboardIcons.ICON_PREVIEW_* --> <!-- This should be aligned with KeyboardIcons.ICON_PREVIEW_* -->
<enum name="iconPreviewTabKey" value="11" /> <enum name="iconPreviewTabKey" value="13" />
</attr> </attr>
<!-- The key style to specify a set of key attributes defined by <key_style/> --> <!-- The key style to specify a set of key attributes defined by <key_style/> -->
<attr name="keyStyle" format="string" /> <attr name="keyStyle" format="string" />

View File

@ -30,10 +30,9 @@
<item name="iconTabKey">@drawable/sym_bkeyboard_tab</item> <item name="iconTabKey">@drawable/sym_bkeyboard_tab</item>
<item name="iconShortcutKey">@drawable/sym_bkeyboard_mic</item> <item name="iconShortcutKey">@drawable/sym_bkeyboard_mic</item>
<item name="iconShortcutForLabel">@drawable/sym_bkeyboard_label_mic</item> <item name="iconShortcutForLabel">@drawable/sym_bkeyboard_label_mic</item>
<item name="iconShiftedShiftKey">@drawable/sym_bkeyboard_shift_locked</item> <item name="iconShortcutKeyDisabled">@drawable/sym_bkeyboard_voice_off</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_bkeyboard_space</item>
<item name="iconShiftKeyShifted">@drawable/sym_bkeyboard_shift_locked</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<!-- LatinKeyboard icons -->
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
<item name="disabledShortcutIcon">@drawable/sym_bkeyboard_voice_off</item>
</style> </style>
</resources> </resources>

View File

@ -23,16 +23,15 @@
<item name="iconShiftKey">@drawable/sym_keyboard_shift_holo</item> <item name="iconShiftKey">@drawable/sym_keyboard_shift_holo</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item> <item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item> <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item>
<item name="iconSpaceKey">@drawable/sym_keyboard_space_holo</item> <item name="iconSpaceKey">@null</item>
<item name="iconReturnKey">@drawable/sym_keyboard_return_holo</item> <item name="iconReturnKey">@drawable/sym_keyboard_return_holo</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search_holo</item> <item name="iconSearchKey">@drawable/sym_keyboard_search_holo</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_holo</item> <item name="iconTabKey">@drawable/sym_keyboard_tab_holo</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item> <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
<item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo</item> <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo</item>
<item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked_holo</item> <item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked_holo</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<!-- LatinKeyboard icons -->
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item>
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
</resources> </resources>

View File

@ -26,10 +26,10 @@
<item name="iconTabKey">@drawable/sym_keyboard_tab</item> <item name="iconTabKey">@drawable/sym_keyboard_tab</item>
<item name="iconShortcutKey">@drawable/sym_keyboard_mic</item> <item name="iconShortcutKey">@drawable/sym_keyboard_mic</item>
<item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic</item> <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic</item>
<item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked</item> <!-- TODO: Needs non-holo disabled shortcut icon drawable -->
<item name="iconShortcutKeyDisabled">@drawable/sym_keyboard_voice_off_holo</item>
<item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space</item>
<item name="iconShiftKeyShifted">@drawable/sym_keyboard_shift_locked</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<!-- LatinKeyboard icons -->
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
</resources> </resources>

View File

@ -33,6 +33,7 @@
</style> </style>
<style name="LatinKeyboard"> <style name="LatinKeyboard">
<item name="autoCorrectionSpacebarLedEnabled">true</item> <item name="autoCorrectionSpacebarLedEnabled">true</item>
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
<item name="spacebarTextRatio">@fraction/spacebar_text_ratio</item> <item name="spacebarTextRatio">@fraction/spacebar_text_ratio</item>
<item name="spacebarTextColor">#FFC0C0C0</item> <item name="spacebarTextColor">#FFC0C0C0</item>
<item name="spacebarTextShadowColor">#80000000</item> <item name="spacebarTextShadowColor">#80000000</item>
@ -74,8 +75,6 @@
<style <style
name="LatinKeyboardView" name="LatinKeyboardView"
parent="KeyboardView"> parent="KeyboardView">
<!-- TODO: Needs non-holo disabled shortcut icon drawable -->
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
<style <style
name="MiniKeyboard" name="MiniKeyboard"
@ -144,8 +143,6 @@
name="LatinKeyboardView.HighContrast" name="LatinKeyboardView.HighContrast"
parent="KeyboardView.HighContrast" parent="KeyboardView.HighContrast"
> >
<!-- TODO: Needs non-holo disabled shortcut icon drawable -->
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
<!-- Theme "Stone" --> <!-- Theme "Stone" -->
<style <style
@ -183,7 +180,6 @@
name="LatinKeyboardView.Stone" name="LatinKeyboardView.Stone"
parent="KeyboardView.Stone" parent="KeyboardView.Stone"
> >
<item name="disabledShortcutIcon">@drawable/sym_bkeyboard_voice_off</item>
</style> </style>
<style <style
name="MiniKeyboard.Stone" name="MiniKeyboard.Stone"
@ -218,7 +214,6 @@
name="LatinKeyboardView.Stone.Bold" name="LatinKeyboardView.Stone.Bold"
parent="KeyboardView.Stone.Bold" parent="KeyboardView.Stone.Bold"
> >
<item name="disabledShortcutIcon">@drawable/sym_bkeyboard_voice_off</item>
</style> </style>
<!-- Theme "Gingerbread" --> <!-- Theme "Gingerbread" -->
<style <style
@ -242,8 +237,6 @@
name="LatinKeyboardView.Gingerbread" name="LatinKeyboardView.Gingerbread"
parent="KeyboardView.Gingerbread" parent="KeyboardView.Gingerbread"
> >
<!-- TODO: Needs non-holo disabled shortcut icon drawable -->
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
<style <style
name="MiniKeyboard.Gingerbread" name="MiniKeyboard.Gingerbread"
@ -276,6 +269,7 @@
parent="LatinKeyboard" parent="LatinKeyboard"
> >
<item name="autoCorrectionSpacebarLedEnabled">false</item> <item name="autoCorrectionSpacebarLedEnabled">false</item>
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item>
</style> </style>
<style <style
name="KeyboardView.IceCreamSandwich" name="KeyboardView.IceCreamSandwich"
@ -304,7 +298,6 @@
name="LatinKeyboardView.IceCreamSandwich" name="LatinKeyboardView.IceCreamSandwich"
parent="KeyboardView.IceCreamSandwich" parent="KeyboardView.IceCreamSandwich"
> >
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
</style> </style>
<style <style
name="MiniKeyboard.IceCreamSandwich" name="MiniKeyboard.IceCreamSandwich"

View File

@ -43,7 +43,6 @@
latin:styleName="shiftKeyStyle" latin:styleName="shiftKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyIcon="iconShiftKey" latin:keyIcon="iconShiftKey"
latin:keyIconShifted="iconShiftedShiftKey"
latin:keyActionFlags="noKeyPreview" latin:keyActionFlags="noKeyPreview"
latin:backgroundType="sticky" /> latin:backgroundType="sticky" />
<key-style <key-style

View File

@ -25,7 +25,6 @@
latin:styleName="shiftKeyStyle" latin:styleName="shiftKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyIcon="iconShiftKey" latin:keyIcon="iconShiftKey"
latin:keyIconShifted="iconShiftedShiftKey"
latin:keyActionFlags="noKeyPreview" latin:keyActionFlags="noKeyPreview"
latin:backgroundType="sticky" /> latin:backgroundType="sticky" />
<key-style <key-style

View File

@ -66,7 +66,6 @@
latin:styleName="shiftKeyStyle" latin:styleName="shiftKeyStyle"
latin:code="@integer/key_shift" latin:code="@integer/key_shift"
latin:keyIcon="iconShiftKey" latin:keyIcon="iconShiftKey"
latin:keyIconShifted="iconShiftedShiftKey"
latin:keyActionFlags="noKeyPreview" latin:keyActionFlags="noKeyPreview"
latin:backgroundType="sticky" /> latin:backgroundType="sticky" />
<key-style <key-style

View File

@ -124,6 +124,6 @@
<key-style <key-style
latin:styleName="numSpaceKeyStyle" latin:styleName="numSpaceKeyStyle"
latin:code="@integer/key_space" latin:code="@integer/key_space"
latin:keyIcon="iconSpaceKey" latin:keyIcon="iconSpaceKeyForNumberLayout"
latin:parentStyle="numKeyBaseStyle" /> latin:parentStyle="numKeyBaseStyle" />
</merge> </merge>

View File

@ -280,8 +280,6 @@ public class Key {
R.styleable.Keyboard_Key_keyIconPreview, KeyboardIconsSet.ICON_UNDEFINED)); R.styleable.Keyboard_Key_keyIconPreview, KeyboardIconsSet.ICON_UNDEFINED));
mIcon = iconsSet.getIcon(style.getInt(keyAttr, R.styleable.Keyboard_Key_keyIcon, mIcon = iconsSet.getIcon(style.getInt(keyAttr, R.styleable.Keyboard_Key_keyIcon,
KeyboardIconsSet.ICON_UNDEFINED)); KeyboardIconsSet.ICON_UNDEFINED));
final int shiftedIconId = style.getInt(keyAttr, R.styleable.Keyboard_Key_keyIconShifted,
KeyboardIconsSet.ICON_UNDEFINED);
mHintLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLabel); mHintLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyHintLabel);
mLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyLabel); mLabel = style.getText(keyAttr, R.styleable.Keyboard_Key_keyLabel);
@ -308,11 +306,6 @@ public class Key {
mHashCode = hashCode(this); mHashCode = hashCode(this);
keyAttr.recycle(); keyAttr.recycle();
if (shiftedIconId != KeyboardIconsSet.ICON_UNDEFINED) {
final Drawable shiftedIcon = iconsSet.getIcon(shiftedIconId);
params.addShiftedIcon(this, shiftedIcon);
}
} }
private static int hashCode(Key key) { private static int hashCode(Key key) {

View File

@ -16,7 +16,6 @@
package com.android.inputmethod.keyboard; package com.android.inputmethod.keyboard;
import android.graphics.drawable.Drawable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -108,8 +107,6 @@ public class Keyboard {
public final Set<Key> mKeys; public final Set<Key> mKeys;
public final Set<Key> mShiftKeys; public final Set<Key> mShiftKeys;
public final Set<Key> mShiftLockKeys; public final Set<Key> mShiftLockKeys;
public final Map<Key, Drawable> mShiftedIcons;
public final Map<Key, Drawable> mUnshiftedIcons;
public final KeyboardIconsSet mIconsSet; public final KeyboardIconsSet mIconsSet;
private final Map<Integer, Key> mKeyCache = new HashMap<Integer, Key>(); private final Map<Integer, Key> mKeyCache = new HashMap<Integer, Key>();
@ -136,8 +133,6 @@ public class Keyboard {
mKeys = Collections.unmodifiableSet(params.mKeys); mKeys = Collections.unmodifiableSet(params.mKeys);
mShiftKeys = Collections.unmodifiableSet(params.mShiftKeys); mShiftKeys = Collections.unmodifiableSet(params.mShiftKeys);
mShiftLockKeys = Collections.unmodifiableSet(params.mShiftLockKeys); mShiftLockKeys = Collections.unmodifiableSet(params.mShiftLockKeys);
mShiftedIcons = Collections.unmodifiableMap(params.mShiftedIcons);
mUnshiftedIcons = Collections.unmodifiableMap(params.mUnshiftedIcons);
mIconsSet = params.mIconsSet; mIconsSet = params.mIconsSet;
mProximityInfo = new ProximityInfo( mProximityInfo = new ProximityInfo(
@ -179,7 +174,9 @@ public class Keyboard {
// To represent "shift locked" state. The highlight is handled by background image that // To represent "shift locked" state. The highlight is handled by background image that
// might be a StateListDrawable. // might be a StateListDrawable.
key.setHighlightOn(newShiftLockState); key.setHighlightOn(newShiftLockState);
key.setIcon(newShiftLockState ? mShiftedIcons.get(key) : mUnshiftedIcons.get(key)); final int iconId = newShiftLockState ? KeyboardIconsSet.ICON_SHIFT_KEY_SHIFTED
: KeyboardIconsSet.ICON_SHIFT_KEY;
key.setIcon(mIconsSet.getIcon(iconId));
} }
mShiftState.setShiftLocked(newShiftLockState); mShiftState.setShiftLocked(newShiftLockState);
} }
@ -193,7 +190,9 @@ public class Keyboard {
void setShifted(boolean newShiftState) { void setShifted(boolean newShiftState) {
if (!mShiftState.isShiftLocked()) { if (!mShiftState.isShiftLocked()) {
for (final Key key : mShiftKeys) { for (final Key key : mShiftKeys) {
key.setIcon(newShiftState ? mShiftedIcons.get(key) : mUnshiftedIcons.get(key)); final int iconId = newShiftState ? KeyboardIconsSet.ICON_SHIFT_KEY_SHIFTED
: KeyboardIconsSet.ICON_SHIFT_KEY;
key.setIcon(mIconsSet.getIcon(iconId));
} }
} }
mShiftState.setShifted(newShiftState); mShiftState.setShifted(newShiftState);

View File

@ -19,10 +19,8 @@ package com.android.inputmethod.keyboard;
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;
import android.content.res.TypedArray;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Message; import android.os.Message;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
@ -41,6 +39,7 @@ import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
import com.android.inputmethod.deprecated.VoiceProxy; import com.android.inputmethod.deprecated.VoiceProxy;
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy; import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
@ -67,14 +66,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
private final boolean mIsSpacebarTriggeringPopupByLongPress; private final boolean mIsSpacebarTriggeringPopupByLongPress;
private boolean mMultipleEnabledIMEsOrSubtypes; private boolean mMultipleEnabledIMEsOrSubtypes;
/* Shortcut key and its icons if available */
private Key mShortcutKey;
// TODO: Remove this variable, use KeyboardIconsSet instead.
private Drawable mEnabledShortcutIcon;
// TODO: Remove this variable and LatinKeyboardView.disabledShortcutIcon attribute.
// This should be moved to KeyboardIconsSet.
private final Drawable mDisabledShortcutIcon;
private final SuddenJumpingTouchEventHandler mTouchScreenRegulator; private final SuddenJumpingTouchEventHandler mTouchScreenRegulator;
// Timing constants // Timing constants
@ -266,11 +257,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
final int longPressSpaceKeyTimeout = final int longPressSpaceKeyTimeout =
res.getInteger(R.integer.config_long_press_space_key_timeout); res.getInteger(R.integer.config_long_press_space_key_timeout);
mIsSpacebarTriggeringPopupByLongPress = (longPressSpaceKeyTimeout > 0); mIsSpacebarTriggeringPopupByLongPress = (longPressSpaceKeyTimeout > 0);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.LatinKeyboardView, defStyle, R.style.LatinKeyboardView);
mDisabledShortcutIcon = a.getDrawable(R.styleable.LatinKeyboardView_disabledShortcutIcon);
a.recycle();
} }
public void startIgnoringDoubleTap() { public void startIgnoringDoubleTap() {
@ -325,9 +311,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
PointerTracker.setKeyDetector(mKeyDetector); PointerTracker.setKeyDetector(mKeyDetector);
mTouchScreenRegulator.setKeyboard(keyboard); mTouchScreenRegulator.setKeyboard(keyboard);
mMoreKeysPanelCache.clear(); mMoreKeysPanelCache.clear();
mShortcutKey = keyboard.getKey(Keyboard.CODE_SHORTCUT);
mEnabledShortcutIcon = (mShortcutKey != null) ? mShortcutKey.getIcon() : null;
} }
/** /**
@ -714,10 +697,15 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
} }
public void updateShortcutKey(boolean available) { public void updateShortcutKey(boolean available) {
if (mShortcutKey == null) return; final Keyboard keyboard = getKeyboard();
mShortcutKey.setEnabled(available); if (keyboard == null) return;
mShortcutKey.setIcon(available ? mEnabledShortcutIcon : mDisabledShortcutIcon); final Key shortcutKey = keyboard.getKey(Keyboard.CODE_SHORTCUT);
invalidateKey(mShortcutKey); if (shortcutKey == null) return;
shortcutKey.setEnabled(available);
final int iconId = available ? KeyboardIconsSet.ICON_SHORTCUT_KEY
: KeyboardIconsSet.ICON_SHORTCUT_KEY_DISABLED;
shortcutKey.setIcon(keyboard.mIconsSet.getIcon(iconId));
invalidateKey(shortcutKey);
} }
public void updateSpacebar() { public void updateSpacebar() {

View File

@ -160,7 +160,6 @@ public class KeyStyles {
readFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags); readFlag(keyAttr, R.styleable.Keyboard_Key_keyLabelFlags);
readInt(keyAttr, R.styleable.Keyboard_Key_keyIcon); readInt(keyAttr, R.styleable.Keyboard_Key_keyIcon);
readInt(keyAttr, R.styleable.Keyboard_Key_keyIconPreview); readInt(keyAttr, R.styleable.Keyboard_Key_keyIconPreview);
readInt(keyAttr, R.styleable.Keyboard_Key_keyIconShifted);
readInt(keyAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn); readInt(keyAttr, R.styleable.Keyboard_Key_maxMoreKeysColumn);
readInt(keyAttr, R.styleable.Keyboard_Key_backgroundType); readInt(keyAttr, R.styleable.Keyboard_Key_backgroundType);
readFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags); readFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags);

View File

@ -28,22 +28,26 @@ public class KeyboardIconsSet {
public static final int ICON_UNDEFINED = 0; public static final int ICON_UNDEFINED = 0;
// TODO: Make all enums private
// This should be aligned with Keyboard.keyIcon enum. // This should be aligned with Keyboard.keyIcon enum.
private static final int ICON_SHIFT_KEY = 1; public static final int ICON_SHIFT_KEY = 1;
private static final int ICON_DELETE_KEY = 2; private static final int ICON_DELETE_KEY = 2;
private static final int ICON_SETTINGS_KEY = 3; // This is also represented as "@icon/3" in XML. // This is also represented as "@icon/3" in keyboard layout XML.
private static final int ICON_SPACE_KEY = 4; private static final int ICON_SETTINGS_KEY = 3;
public static final int ICON_SPACE_KEY = 4;
private static final int ICON_RETURN_KEY = 5; private static final int ICON_RETURN_KEY = 5;
private static final int ICON_SEARCH_KEY = 6; private static final int ICON_SEARCH_KEY = 6;
private static final int ICON_TAB_KEY = 7; // This is also represented as "@icon/7" in XML. // This is also represented as "@icon/7" in keyboard layout XML.
private static final int ICON_SHORTCUT_KEY = 8; private static final int ICON_TAB_KEY = 7;
public static final int ICON_SHORTCUT_KEY = 8;
private static final int ICON_SHORTCUT_FOR_LABEL = 9; private static final int ICON_SHORTCUT_FOR_LABEL = 9;
// This should be aligned with Keyboard.keyIconShifted enum. public static final int ICON_SHORTCUT_KEY_DISABLED = 10;
private static final int ICON_SHIFTED_SHIFT_KEY = 10; private static final int ICON_SPACE_KEY_FOR_NUMBER_LAYOUT = 11;
public static final int ICON_SHIFT_KEY_SHIFTED = 12;
// This should be aligned with Keyboard.keyIconPreview enum. // This should be aligned with Keyboard.keyIconPreview enum.
private static final int ICON_PREVIEW_TAB_KEY = 11; private static final int ICON_PREVIEW_TAB_KEY = 13;
private static final int ICON_LAST = 11; private static final int ICON_LAST = 13;
private final Drawable mIcons[] = new Drawable[ICON_LAST + 1]; private final Drawable mIcons[] = new Drawable[ICON_LAST + 1];
@ -67,8 +71,12 @@ public class KeyboardIconsSet {
return ICON_SHORTCUT_KEY; return ICON_SHORTCUT_KEY;
case R.styleable.Keyboard_iconShortcutForLabel: case R.styleable.Keyboard_iconShortcutForLabel:
return ICON_SHORTCUT_FOR_LABEL; return ICON_SHORTCUT_FOR_LABEL;
case R.styleable.Keyboard_iconShiftedShiftKey: case R.styleable.Keyboard_iconShortcutKeyDisabled:
return ICON_SHIFTED_SHIFT_KEY; return ICON_SHORTCUT_KEY_DISABLED;
case R.styleable.Keyboard_iconSpaceKeyForNumberLayout:
return ICON_SPACE_KEY_FOR_NUMBER_LAYOUT;
case R.styleable.Keyboard_iconShiftKeyShifted:
return ICON_SHIFT_KEY_SHIFTED;
case R.styleable.Keyboard_iconPreviewTabKey: case R.styleable.Keyboard_iconPreviewTabKey:
return ICON_PREVIEW_TAB_KEY; return ICON_PREVIEW_TAB_KEY;
default: default:

View File

@ -16,8 +16,6 @@
package com.android.inputmethod.keyboard.internal; package com.android.inputmethod.keyboard.internal;
import android.graphics.drawable.Drawable;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
@ -60,8 +58,6 @@ public class KeyboardParams {
public final Set<Key> mKeys = new HashSet<Key>(); public final Set<Key> mKeys = new HashSet<Key>();
public final Set<Key> mShiftKeys = new HashSet<Key>(); public final Set<Key> mShiftKeys = new HashSet<Key>();
public final Set<Key> mShiftLockKeys = new HashSet<Key>(); public final Set<Key> mShiftLockKeys = new HashSet<Key>();
public final Map<Key, Drawable> mShiftedIcons = new HashMap<Key, Drawable>();
public final Map<Key, Drawable> mUnshiftedIcons = new HashMap<Key, Drawable>();
public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
public int mMostCommonKeyHeight = 0; public int mMostCommonKeyHeight = 0;
@ -128,8 +124,6 @@ public class KeyboardParams {
mKeys.clear(); mKeys.clear();
mShiftKeys.clear(); mShiftKeys.clear();
mShiftLockKeys.clear(); mShiftLockKeys.clear();
mShiftedIcons.clear();
mUnshiftedIcons.clear();
clearHistogram(); clearHistogram();
} }
@ -144,11 +138,6 @@ public class KeyboardParams {
} }
} }
public void addShiftedIcon(Key key, Drawable icon) {
mUnshiftedIcons.put(key, key.getIcon());
mShiftedIcons.put(key, icon);
}
private int mMaxHeightCount = 0; private int mMaxHeightCount = 0;
private int mMaxWidthCount = 0; private int mMaxWidthCount = 0;
private final Map<Integer, Integer> mHeightHistogram = new HashMap<Integer, Integer>(); private final Map<Integer, Integer> mHeightHistogram = new HashMap<Integer, Integer>();