am deb5cedf: Add Key.getIconId for testability

* commit 'deb5cedf811e6d605a4a2a934f4d0c75b880cede':
  Add Key.getIconId for testability
main
Tadashi G. Takaoka 2014-02-24 18:19:18 -08:00 committed by Android Git Automerger
commit 5d2c961ed6
2 changed files with 7 additions and 3 deletions

View File

@ -716,10 +716,14 @@ public class Key implements Comparable<Key> {
return (attrs != null) ? attrs.mAltCode : CODE_UNSPECIFIED;
}
public int getIconId() {
return mIconId;
}
public Drawable getIcon(final KeyboardIconsSet iconSet, final int alpha) {
final OptionalAttributes attrs = mOptionalAttributes;
final int disabledIconId = (attrs != null) ? attrs.mDisabledIconId : ICON_UNDEFINED;
final int iconId = mEnabled ? mIconId : disabledIconId;
final int iconId = mEnabled ? getIconId() : disabledIconId;
final Drawable icon = iconSet.getIconDrawable(iconId);
if (icon != null) {
icon.setAlpha(alpha);
@ -731,7 +735,7 @@ public class Key implements Comparable<Key> {
final OptionalAttributes attrs = mOptionalAttributes;
final int previewIconId = (attrs != null) ? attrs.mPreviewIconId : ICON_UNDEFINED;
return previewIconId != ICON_UNDEFINED
? iconSet.getIconDrawable(previewIconId) : iconSet.getIconDrawable(mIconId);
? iconSet.getIconDrawable(previewIconId) : iconSet.getIconDrawable(getIconId());
}
public int getWidth() {

View File

@ -102,7 +102,7 @@ public final class KeyboardIconsSet {
return isValidIconId(iconId) ? ICON_NAMES[iconId] : "unknown<" + iconId + ">";
}
static int getIconId(final String name) {
public static int getIconId(final String name) {
Integer iconId = sNameToIdsMap.get(name);
if (iconId != null) {
return iconId;