am 761a6812
: Don\'t reuse main keyboard\'s spacebar icon for Emoji palette
* commit '761a6812312c48d04bcb91e5c4448364c4925731': Don't reuse main keyboard's spacebar icon for Emoji palette
This commit is contained in:
commit
6fe326ae42
2 changed files with 17 additions and 5 deletions
|
@ -369,8 +369,14 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
|
|||
|
||||
public void startEmojiPalettes(final String switchToAlphaLabel,
|
||||
final KeyVisualAttributes keyVisualAttr, final KeyboardIconsSet iconSet) {
|
||||
mDeleteKey.setImageDrawable(iconSet.getIconDrawable(KeyboardIconsSet.NAME_DELETE_KEY));
|
||||
mSpacebar.setImageDrawable(iconSet.getIconDrawable(KeyboardIconsSet.NAME_SPACE_KEY));
|
||||
final int deleteIconResId = iconSet.getIconResourceId(KeyboardIconsSet.NAME_DELETE_KEY);
|
||||
if (deleteIconResId != 0) {
|
||||
mDeleteKey.setImageResource(deleteIconResId);
|
||||
}
|
||||
final int spacebarResId = iconSet.getIconResourceId(KeyboardIconsSet.NAME_SPACE_KEY);
|
||||
if (spacebarResId != 0) {
|
||||
mSpacebar.setImageResource(spacebarResId);
|
||||
}
|
||||
final KeyDrawParams params = new KeyDrawParams();
|
||||
params.updateParams(mEmojiLayoutParams.getActionBarHeight(), keyVisualAttr);
|
||||
setupAlphabetKey(mAlphabetKeyLeft, switchToAlphaLabel, params);
|
||||
|
|
|
@ -89,6 +89,7 @@ public final class KeyboardIconsSet {
|
|||
private static int NUM_ICONS = NAMES_AND_ATTR_IDS.length / 2;
|
||||
private static final String[] ICON_NAMES = new String[NUM_ICONS];
|
||||
private final Drawable[] mIcons = new Drawable[NUM_ICONS];
|
||||
private final int[] mIconResourceIds = new int[NUM_ICONS];
|
||||
|
||||
static {
|
||||
int iconId = ICON_UNDEFINED;
|
||||
|
@ -96,7 +97,7 @@ public final class KeyboardIconsSet {
|
|||
final String name = (String)NAMES_AND_ATTR_IDS[i];
|
||||
final Integer attrId = (Integer)NAMES_AND_ATTR_IDS[i + 1];
|
||||
if (attrId != ATTR_UNDEFINED) {
|
||||
ATTR_ID_TO_ICON_ID.put(attrId, iconId);
|
||||
ATTR_ID_TO_ICON_ID.put(attrId, iconId);
|
||||
}
|
||||
sNameToIdsMap.put(name, iconId);
|
||||
ICON_NAMES[iconId] = name;
|
||||
|
@ -113,6 +114,7 @@ public final class KeyboardIconsSet {
|
|||
setDefaultBounds(icon);
|
||||
final Integer iconId = ATTR_ID_TO_ICON_ID.get(attrId);
|
||||
mIcons[iconId] = icon;
|
||||
mIconResourceIds[iconId] = keyboardAttrs.getResourceId(attrId, 0);
|
||||
} catch (Resources.NotFoundException e) {
|
||||
Log.w(TAG, "Drawable resource for icon #"
|
||||
+ keyboardAttrs.getResources().getResourceEntryName(attrId)
|
||||
|
@ -137,8 +139,12 @@ public final class KeyboardIconsSet {
|
|||
throw new RuntimeException("unknown icon name: " + name);
|
||||
}
|
||||
|
||||
public Drawable getIconDrawable(final String name) {
|
||||
return getIconDrawable(getIconId(name));
|
||||
public int getIconResourceId(final String name) {
|
||||
final int iconId = getIconId(name);
|
||||
if (isValidIconId(iconId)) {
|
||||
return mIconResourceIds[iconId];
|
||||
}
|
||||
throw new RuntimeException("unknown icon name: " + name);
|
||||
}
|
||||
|
||||
public Drawable getIconDrawable(final int iconId) {
|
||||
|
|
Loading…
Reference in a new issue