Merge "Make Key.mPreviewIcon public final"
This commit is contained in:
commit
8950f259b1
2 changed files with 5 additions and 10 deletions
|
@ -73,10 +73,11 @@ public class Key {
|
||||||
private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000;
|
private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000;
|
||||||
private static final int LABEL_FLAGS_AUTO_X_SCALE = 0x4000;
|
private static final int LABEL_FLAGS_AUTO_X_SCALE = 0x4000;
|
||||||
|
|
||||||
|
// TODO: This should be public final
|
||||||
/** Icon to display instead of a label. Icon takes precedence over a label */
|
/** Icon to display instead of a label. Icon takes precedence over a label */
|
||||||
private Drawable mIcon;
|
private Drawable mIcon;
|
||||||
/** Preview version of the icon, for the preview popup */
|
/** Preview version of the icon, for the preview popup */
|
||||||
private Drawable mPreviewIcon;
|
public final Drawable mPreviewIcon;
|
||||||
|
|
||||||
/** Width of the key, not including the gap */
|
/** Width of the key, not including the gap */
|
||||||
public final int mWidth;
|
public final int mWidth;
|
||||||
|
@ -198,6 +199,7 @@ public class Key {
|
||||||
mCode = code;
|
mCode = code;
|
||||||
mAltCode = Keyboard.CODE_DUMMY;
|
mAltCode = Keyboard.CODE_DUMMY;
|
||||||
mIcon = icon;
|
mIcon = icon;
|
||||||
|
mPreviewIcon = null;
|
||||||
// Horizontal gap is divided equally to both sides of the key.
|
// Horizontal gap is divided equally to both sides of the key.
|
||||||
mX = x + mHorizontalGap / 2;
|
mX = x + mHorizontalGap / 2;
|
||||||
mY = y;
|
mY = y;
|
||||||
|
@ -425,18 +427,11 @@ public class Key {
|
||||||
return mIcon;
|
return mIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getPreviewIcon() {
|
// TODO: Get rid of this method.
|
||||||
return mPreviewIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIcon(Drawable icon) {
|
public void setIcon(Drawable icon) {
|
||||||
mIcon = icon;
|
mIcon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreviewIcon(Drawable icon) {
|
|
||||||
mPreviewIcon = icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the key that it has been pressed, in case it needs to change its appearance or
|
* Informs the key that it has been pressed, in case it needs to change its appearance or
|
||||||
* state.
|
* state.
|
||||||
|
|
|
@ -889,7 +889,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
}
|
}
|
||||||
previewText.setText(mKeyboard.adjustLabelCase(key.mLabel));
|
previewText.setText(mKeyboard.adjustLabelCase(key.mLabel));
|
||||||
} else {
|
} else {
|
||||||
final Drawable previewIcon = key.getPreviewIcon();
|
final Drawable previewIcon = key.mPreviewIcon;
|
||||||
previewText.setCompoundDrawables(null, null, null,
|
previewText.setCompoundDrawables(null, null, null,
|
||||||
previewIcon != null ? previewIcon : key.getIcon());
|
previewIcon != null ? previewIcon : key.getIcon());
|
||||||
previewText.setText(null);
|
previewText.setText(null);
|
||||||
|
|
Loading…
Reference in a new issue