am 749cc187: Move some key top visual attributes from KeyboardView to Key
* commit '749cc1875164e38ca24d31d0d718603232abccb8': Move some key top visual attributes from KeyboardView to Keymain
commit
abd665bde9
|
@ -41,45 +41,6 @@
|
||||||
checkable+checked+pressed. -->
|
checkable+checked+pressed. -->
|
||||||
<attr name="keyBackground" format="reference" />
|
<attr name="keyBackground" format="reference" />
|
||||||
|
|
||||||
<!-- Size of the text for one letter keys. If specified as fraction, the text size is
|
|
||||||
measured in the proportion of key height. -->
|
|
||||||
<attr name="keyLetterSize" format="dimension|fraction" />
|
|
||||||
<!-- Size of the text for keys with multiple letters. If specified as fraction, the text
|
|
||||||
size is measured in the proportion of key height. -->
|
|
||||||
<attr name="keyLabelSize" format="dimension|fraction" />
|
|
||||||
<!-- Large size of the text for one letter keys, in the proportion of key height. -->
|
|
||||||
<attr name="keyLargeLetterRatio" format="fraction" />
|
|
||||||
<!-- Large size of the text for keys with multiple letters, in the proportion of key height. -->
|
|
||||||
<attr name="keyLargeLabelRatio" format="fraction" />
|
|
||||||
<!-- Size of the text for hint letter (= one character hint label), in the proportion of
|
|
||||||
key height. -->
|
|
||||||
<attr name="keyHintLetterRatio" format="fraction" />
|
|
||||||
<!-- Size of the text for hint label, in the proportion of key height. -->
|
|
||||||
<attr name="keyHintLabelRatio" format="fraction" />
|
|
||||||
<!-- Size of the text for shifted letter hint, in the proportion of key height. -->
|
|
||||||
<attr name="keyShiftedLetterHintRatio" format="dimension|fraction" />
|
|
||||||
|
|
||||||
<!-- Horizontal padding of left/right aligned key label to the edge of the key. -->
|
|
||||||
<attr name="keyLabelHorizontalPadding" format="dimension" />
|
|
||||||
<!-- Right padding of hint letter to the edge of the key.-->
|
|
||||||
<attr name="keyHintLetterPadding" format="dimension" />
|
|
||||||
<!-- Bottom padding of popup hint letter "..." to the edge of the key.-->
|
|
||||||
<attr name="keyPopupHintLetterPadding" format="dimension" />
|
|
||||||
<!-- Right padding of shifted letter hint to the edge of the key.-->
|
|
||||||
<attr name="keyShiftedLetterHintPadding" format="dimension" />
|
|
||||||
|
|
||||||
<!-- Color to use for the label in a key. -->
|
|
||||||
<attr name="keyTextColor" format="color" />
|
|
||||||
<!-- Color to use for the label in a key when in inactivated state. -->
|
|
||||||
<attr name="keyTextInactivatedColor" format="color" />
|
|
||||||
<!-- Key hint letter (= one character hint label) color -->
|
|
||||||
<attr name="keyHintLetterColor" format="color" />
|
|
||||||
<!-- Key hint label color -->
|
|
||||||
<attr name="keyHintLabelColor" format="color" />
|
|
||||||
<!-- Shifted letter hint colors -->
|
|
||||||
<attr name="keyShiftedLetterHintInactivatedColor" format="color" />
|
|
||||||
<attr name="keyShiftedLetterHintActivatedColor" format="color" />
|
|
||||||
|
|
||||||
<!-- Layout resource for key press feedback.-->
|
<!-- Layout resource for key press feedback.-->
|
||||||
<attr name="keyPreviewLayout" format="reference" />
|
<attr name="keyPreviewLayout" format="reference" />
|
||||||
<!-- The background for key press feedback. -->
|
<!-- The background for key press feedback. -->
|
||||||
|
@ -88,14 +49,10 @@
|
||||||
<attr name="keyPreviewLeftBackground" format="reference" />
|
<attr name="keyPreviewLeftBackground" format="reference" />
|
||||||
<!-- The background for the right edge key press feedback. -->
|
<!-- The background for the right edge key press feedback. -->
|
||||||
<attr name="keyPreviewRightBackground" format="reference" />
|
<attr name="keyPreviewRightBackground" format="reference" />
|
||||||
<!-- The text color for key press feedback. -->
|
|
||||||
<attr name="keyPreviewTextColor" format="color" />
|
|
||||||
<!-- Vertical offset of the key press feedback from the key. -->
|
<!-- Vertical offset of the key press feedback from the key. -->
|
||||||
<attr name="keyPreviewOffset" format="dimension" />
|
<attr name="keyPreviewOffset" format="dimension" />
|
||||||
<!-- Height of the key press feedback popup. -->
|
<!-- Height of the key press feedback popup. -->
|
||||||
<attr name="keyPreviewHeight" format="dimension" />
|
<attr name="keyPreviewHeight" format="dimension" />
|
||||||
<!-- Size of the text for key press feedback popup, in the proportion of key height. -->
|
|
||||||
<attr name="keyPreviewTextRatio" format="fraction" />
|
|
||||||
<!-- Delay after key releasing and key press feedback dismissing in millisecond -->
|
<!-- Delay after key releasing and key press feedback dismissing in millisecond -->
|
||||||
<attr name="keyPreviewLingerTimeout" format="integer" />
|
<attr name="keyPreviewLingerTimeout" format="integer" />
|
||||||
|
|
||||||
|
@ -105,18 +62,8 @@
|
||||||
<!-- Layout resource for more keys panel -->
|
<!-- Layout resource for more keys panel -->
|
||||||
<attr name="moreKeysLayout" format="reference" />
|
<attr name="moreKeysLayout" format="reference" />
|
||||||
|
|
||||||
<attr name="shadowColor" format="color" />
|
|
||||||
<attr name="shadowRadius" format="float" />
|
|
||||||
<attr name="backgroundDimAlpha" format="integer" />
|
<attr name="backgroundDimAlpha" format="integer" />
|
||||||
|
|
||||||
<attr name="keyTypeface" format="enum">
|
|
||||||
<!-- This should be aligned with Typeface.NORMAL etc. -->
|
|
||||||
<enum name="normal" value="0" />
|
|
||||||
<enum name="bold" value="1" />
|
|
||||||
<enum name="italic" value="2" />
|
|
||||||
<enum name="boldItalic" value="3" />
|
|
||||||
</attr>
|
|
||||||
|
|
||||||
<!-- Attributes for PreviewPlacerView -->
|
<!-- Attributes for PreviewPlacerView -->
|
||||||
<attr name="gestureFloatingPreviewTextSize" format="dimension" />
|
<attr name="gestureFloatingPreviewTextSize" format="dimension" />
|
||||||
<attr name="gestureFloatingPreviewTextColor" format="color" />
|
<attr name="gestureFloatingPreviewTextColor" format="color" />
|
||||||
|
@ -335,6 +282,59 @@
|
||||||
<!-- The X-coordinate of upper right corner of this key including horizontal gap.
|
<!-- The X-coordinate of upper right corner of this key including horizontal gap.
|
||||||
If the value is negative, the origin is the right edge of the keyboard. -->
|
If the value is negative, the origin is the right edge of the keyboard. -->
|
||||||
<attr name="keyXPos" format="dimension|fraction" />
|
<attr name="keyXPos" format="dimension|fraction" />
|
||||||
|
|
||||||
|
<!-- Key top visual attributes -->
|
||||||
|
<attr name="keyTypeface" format="enum">
|
||||||
|
<!-- This should be aligned with Typeface.NORMAL etc. -->
|
||||||
|
<enum name="normal" value="0" />
|
||||||
|
<enum name="bold" value="1" />
|
||||||
|
<enum name="italic" value="2" />
|
||||||
|
<enum name="boldItalic" value="3" />
|
||||||
|
</attr>
|
||||||
|
<!-- Size of the text for one letter keys. If specified as fraction, the text size is
|
||||||
|
measured in the proportion of key height. -->
|
||||||
|
<attr name="keyLetterSize" format="dimension|fraction" />
|
||||||
|
<!-- Size of the text for keys with multiple letters. If specified as fraction, the text
|
||||||
|
size is measured in the proportion of key height. -->
|
||||||
|
<attr name="keyLabelSize" format="dimension|fraction" />
|
||||||
|
<!-- Large size of the text for one letter keys, in the proportion of key height. -->
|
||||||
|
<attr name="keyLargeLetterRatio" format="fraction" />
|
||||||
|
<!-- Large size of the text for keys with multiple letters, in the proportion of key height. -->
|
||||||
|
<attr name="keyLargeLabelRatio" format="fraction" />
|
||||||
|
<!-- Size of the text for hint letter (= one character hint label), in the proportion of
|
||||||
|
key height. -->
|
||||||
|
<attr name="keyHintLetterRatio" format="fraction" />
|
||||||
|
<!-- Size of the text for hint label, in the proportion of key height. -->
|
||||||
|
<attr name="keyHintLabelRatio" format="fraction" />
|
||||||
|
<!-- Size of the text for shifted letter hint, in the proportion of key height. -->
|
||||||
|
<attr name="keyShiftedLetterHintRatio" format="dimension|fraction" />
|
||||||
|
<!-- Horizontal padding of left/right aligned key label to the edge of the key. -->
|
||||||
|
<attr name="keyLabelHorizontalPadding" format="dimension" />
|
||||||
|
<!-- Right padding of hint letter to the edge of the key.-->
|
||||||
|
<attr name="keyHintLetterPadding" format="dimension" />
|
||||||
|
<!-- Bottom padding of popup hint letter "..." to the edge of the key.-->
|
||||||
|
<attr name="keyPopupHintLetterPadding" format="dimension" />
|
||||||
|
<!-- Right padding of shifted letter hint to the edge of the key.-->
|
||||||
|
<attr name="keyShiftedLetterHintPadding" format="dimension" />
|
||||||
|
<!-- Color to use for the label in a key. -->
|
||||||
|
<attr name="keyTextColor" format="color" />
|
||||||
|
<attr name="keyTextShadowColor" format="color" />
|
||||||
|
<attr name="keyTextShadowRadius" format="float" />
|
||||||
|
<!-- Color to use for the label in a key when in inactivated state. -->
|
||||||
|
<attr name="keyTextInactivatedColor" format="color" />
|
||||||
|
<!-- Key hint letter (= one character hint label) color -->
|
||||||
|
<attr name="keyHintLetterColor" format="color" />
|
||||||
|
<!-- Key hint label color -->
|
||||||
|
<attr name="keyHintLabelColor" format="color" />
|
||||||
|
<!-- Shifted letter hint colors -->
|
||||||
|
<attr name="keyShiftedLetterHintInactivatedColor" format="color" />
|
||||||
|
<attr name="keyShiftedLetterHintActivatedColor" format="color" />
|
||||||
|
|
||||||
|
<!-- Key preview visual parameters -->
|
||||||
|
<!-- The text color for key press feedback. -->
|
||||||
|
<attr name="keyPreviewTextColor" format="color" />
|
||||||
|
<!-- Size of the text for key press feedback popup, in the proportion of key height. -->
|
||||||
|
<attr name="keyPreviewTextRatio" format="fraction" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="Keyboard_Include">
|
<declare-styleable name="Keyboard_Include">
|
||||||
|
|
|
@ -64,8 +64,8 @@
|
||||||
<item name="keyPreviewLingerTimeout">@integer/config_key_preview_linger_timeout</item>
|
<item name="keyPreviewLingerTimeout">@integer/config_key_preview_linger_timeout</item>
|
||||||
<item name="moreKeysLayout">@layout/more_keys_keyboard</item>
|
<item name="moreKeysLayout">@layout/more_keys_keyboard</item>
|
||||||
<item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
|
<item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
|
||||||
<item name="shadowColor">#BB000000</item>
|
<item name="keyTextShadowColor">#BB000000</item>
|
||||||
<item name="shadowRadius">2.75</item>
|
<item name="keyTextShadowRadius">2.75</item>
|
||||||
<item name="backgroundDimAlpha">128</item>
|
<item name="backgroundDimAlpha">128</item>
|
||||||
<!-- android:color/holo_blue_light=#FF33B5E5 -->
|
<!-- android:color/holo_blue_light=#FF33B5E5 -->
|
||||||
<item name="gestureFloatingPreviewTextSize">@dimen/gesture_floating_preview_text_size</item>
|
<item name="gestureFloatingPreviewTextSize">@dimen/gesture_floating_preview_text_size</item>
|
||||||
|
@ -203,7 +203,7 @@
|
||||||
<item name="keyHintLabelColor">#E0000000</item>
|
<item name="keyHintLabelColor">#E0000000</item>
|
||||||
<item name="keyShiftedLetterHintInactivatedColor">#66000000</item>
|
<item name="keyShiftedLetterHintInactivatedColor">#66000000</item>
|
||||||
<item name="keyShiftedLetterHintActivatedColor">#CC000000</item>
|
<item name="keyShiftedLetterHintActivatedColor">#CC000000</item>
|
||||||
<item name="shadowColor">#FFFFFFFF</item>
|
<item name="keyTextShadowColor">#FFFFFFFF</item>
|
||||||
</style>
|
</style>
|
||||||
<style
|
<style
|
||||||
name="MainKeyboardView.Stone"
|
name="MainKeyboardView.Stone"
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
>
|
>
|
||||||
<item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
|
<item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
|
||||||
<item name="keyTextColor">#FF000000</item>
|
<item name="keyTextColor">#FF000000</item>
|
||||||
<item name="shadowColor">#FFFFFFFF</item>
|
<item name="keyTextShadowColor">#FFFFFFFF</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- Theme "Stone bold" -->
|
<!-- Theme "Stone bold" -->
|
||||||
<style
|
<style
|
||||||
|
@ -328,8 +328,8 @@
|
||||||
<item name="keyPreviewRightBackground">@drawable/keyboard_key_feedback_right_ics</item>
|
<item name="keyPreviewRightBackground">@drawable/keyboard_key_feedback_right_ics</item>
|
||||||
<item name="keyPreviewTextColor">#FFFFFFFF</item>
|
<item name="keyPreviewTextColor">#FFFFFFFF</item>
|
||||||
<item name="keyPreviewOffset">@dimen/key_preview_offset_ics</item>
|
<item name="keyPreviewOffset">@dimen/key_preview_offset_ics</item>
|
||||||
<item name="shadowColor">#00000000</item>
|
<item name="keyTextShadowColor">#00000000</item>
|
||||||
<item name="shadowRadius">0.0</item>
|
<item name="keyTextShadowRadius">0.0</item>
|
||||||
</style>
|
</style>
|
||||||
<style
|
<style
|
||||||
name="MainKeyboardView.IceCreamSandwich"
|
name="MainKeyboardView.IceCreamSandwich"
|
||||||
|
|
|
@ -188,8 +188,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
public final float mKeyHintLetterPadding;
|
public final float mKeyHintLetterPadding;
|
||||||
public final float mKeyPopupHintLetterPadding;
|
public final float mKeyPopupHintLetterPadding;
|
||||||
public final float mKeyShiftedLetterHintPadding;
|
public final float mKeyShiftedLetterHintPadding;
|
||||||
public final int mShadowColor;
|
public final int mKeyTextShadowColor;
|
||||||
public final float mShadowRadius;
|
public final float mKeyTextShadowRadius;
|
||||||
public final Drawable mKeyBackground;
|
public final Drawable mKeyBackground;
|
||||||
public final int mKeyHintLetterColor;
|
public final int mKeyHintLetterColor;
|
||||||
public final int mKeyHintLabelColor;
|
public final int mKeyHintLabelColor;
|
||||||
|
@ -217,52 +217,55 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
public int mKeyHintLabelSize;
|
public int mKeyHintLabelSize;
|
||||||
public int mAnimAlpha;
|
public int mAnimAlpha;
|
||||||
|
|
||||||
public KeyDrawParams(final TypedArray a) {
|
public KeyDrawParams(final TypedArray keyboardViewAttr, final TypedArray keyAttr) {
|
||||||
mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground);
|
mKeyBackground = keyboardViewAttr.getDrawable(R.styleable.KeyboardView_keyBackground);
|
||||||
mKeyLetterRatio = ResourceUtils.getFraction(a, R.styleable.KeyboardView_keyLetterSize);
|
|
||||||
mKeyLetterSizeFromKeyboardView = ResourceUtils.getDimensionPixelSize(a,
|
|
||||||
R.styleable.KeyboardView_keyLetterSize);
|
|
||||||
mKeyLabelRatio = ResourceUtils.getFraction(a, R.styleable.KeyboardView_keyLabelSize);
|
|
||||||
mKeyLabelSize = ResourceUtils.getDimensionPixelSize(a,
|
|
||||||
R.styleable.KeyboardView_keyLabelSize);
|
|
||||||
mKeyLargeLabelRatio = ResourceUtils.getFraction(a,
|
|
||||||
R.styleable.KeyboardView_keyLargeLabelRatio);
|
|
||||||
mKeyLargeLetterRatio = ResourceUtils.getFraction(a,
|
|
||||||
R.styleable.KeyboardView_keyLargeLetterRatio);
|
|
||||||
mKeyHintLetterRatio = ResourceUtils.getFraction(a,
|
|
||||||
R.styleable.KeyboardView_keyHintLetterRatio);
|
|
||||||
mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(a,
|
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintRatio);
|
|
||||||
mKeyHintLabelRatio = ResourceUtils.getFraction(a,
|
|
||||||
R.styleable.KeyboardView_keyHintLabelRatio);
|
|
||||||
mKeyLabelHorizontalPadding = a.getDimension(
|
|
||||||
R.styleable.KeyboardView_keyLabelHorizontalPadding, 0);
|
|
||||||
mKeyHintLetterPadding = a.getDimension(
|
|
||||||
R.styleable.KeyboardView_keyHintLetterPadding, 0);
|
|
||||||
mKeyPopupHintLetterPadding = a.getDimension(
|
|
||||||
R.styleable.KeyboardView_keyPopupHintLetterPadding, 0);
|
|
||||||
mKeyShiftedLetterHintPadding = a.getDimension(
|
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintPadding, 0);
|
|
||||||
mKeyTextColor = a.getColor(
|
|
||||||
R.styleable.KeyboardView_keyTextColor, Color.WHITE);
|
|
||||||
mKeyTextInactivatedColor = a.getColor(
|
|
||||||
R.styleable.KeyboardView_keyTextInactivatedColor, Color.WHITE);
|
|
||||||
mKeyHintLetterColor = a.getColor(
|
|
||||||
R.styleable.KeyboardView_keyHintLetterColor, Color.TRANSPARENT);
|
|
||||||
mKeyHintLabelColor = a.getColor(
|
|
||||||
R.styleable.KeyboardView_keyHintLabelColor, Color.TRANSPARENT);
|
|
||||||
mKeyShiftedLetterHintInactivatedColor = a.getColor(
|
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintInactivatedColor,
|
|
||||||
Color.TRANSPARENT);
|
|
||||||
mKeyShiftedLetterHintActivatedColor = a.getColor(
|
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintActivatedColor, Color.TRANSPARENT);
|
|
||||||
mKeyTypefaceFromKeyboardView = Typeface.defaultFromStyle(
|
|
||||||
a.getInt(R.styleable.KeyboardView_keyTypeface, Typeface.NORMAL));
|
|
||||||
mKeyTypeface = mKeyTypefaceFromKeyboardView;
|
|
||||||
mShadowColor = a.getColor(R.styleable.KeyboardView_shadowColor, Color.TRANSPARENT);
|
|
||||||
mShadowRadius = a.getFloat(R.styleable.KeyboardView_shadowRadius, 0f);
|
|
||||||
|
|
||||||
mKeyBackground.getPadding(mPadding);
|
mKeyBackground.getPadding(mPadding);
|
||||||
|
|
||||||
|
mKeyLetterRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyLetterSize);
|
||||||
|
mKeyLetterSizeFromKeyboardView = ResourceUtils.getDimensionPixelSize(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyLetterSize);
|
||||||
|
mKeyLabelRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyLabelSize);
|
||||||
|
mKeyLabelSize = ResourceUtils.getDimensionPixelSize(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyLabelSize);
|
||||||
|
mKeyLargeLabelRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyLargeLabelRatio);
|
||||||
|
mKeyLargeLetterRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyLargeLetterRatio);
|
||||||
|
mKeyHintLetterRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyHintLetterRatio);
|
||||||
|
mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyShiftedLetterHintRatio);
|
||||||
|
mKeyHintLabelRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyHintLabelRatio);
|
||||||
|
mKeyLabelHorizontalPadding = keyAttr.getDimension(
|
||||||
|
R.styleable.Keyboard_Key_keyLabelHorizontalPadding, 0);
|
||||||
|
mKeyHintLetterPadding = keyAttr.getDimension(
|
||||||
|
R.styleable.Keyboard_Key_keyHintLetterPadding, 0);
|
||||||
|
mKeyPopupHintLetterPadding = keyAttr.getDimension(
|
||||||
|
R.styleable.Keyboard_Key_keyPopupHintLetterPadding, 0);
|
||||||
|
mKeyShiftedLetterHintPadding = keyAttr.getDimension(
|
||||||
|
R.styleable.Keyboard_Key_keyShiftedLetterHintPadding, 0);
|
||||||
|
mKeyTextColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyTextColor, Color.WHITE);
|
||||||
|
mKeyTextInactivatedColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyTextInactivatedColor, Color.WHITE);
|
||||||
|
mKeyHintLetterColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyHintLetterColor, Color.TRANSPARENT);
|
||||||
|
mKeyHintLabelColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyHintLabelColor, Color.TRANSPARENT);
|
||||||
|
mKeyShiftedLetterHintInactivatedColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyShiftedLetterHintInactivatedColor,
|
||||||
|
Color.TRANSPARENT);
|
||||||
|
mKeyShiftedLetterHintActivatedColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyShiftedLetterHintActivatedColor, Color.TRANSPARENT);
|
||||||
|
mKeyTypefaceFromKeyboardView = Typeface.defaultFromStyle(
|
||||||
|
keyAttr.getInt(R.styleable.Keyboard_Key_keyTypeface, Typeface.NORMAL));
|
||||||
|
mKeyTextShadowColor = keyAttr.getColor(
|
||||||
|
R.styleable.Keyboard_Key_keyTextShadowColor, Color.TRANSPARENT);
|
||||||
|
mKeyTextShadowRadius = keyAttr.getFloat(
|
||||||
|
R.styleable.Keyboard_Key_keyTextShadowRadius, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateParams(final Keyboard keyboard) {
|
public void updateParams(final Keyboard keyboard) {
|
||||||
|
@ -357,23 +360,26 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
|
|
||||||
private static final int PREVIEW_ALPHA = 240;
|
private static final int PREVIEW_ALPHA = 240;
|
||||||
|
|
||||||
public KeyPreviewDrawParams(final TypedArray a) {
|
public KeyPreviewDrawParams(final TypedArray keyboardViewAttr, final TypedArray keyAttr) {
|
||||||
mPreviewBackground = a.getDrawable(R.styleable.KeyboardView_keyPreviewBackground);
|
mPreviewBackground = keyboardViewAttr.getDrawable(
|
||||||
mPreviewLeftBackground = a.getDrawable(
|
R.styleable.KeyboardView_keyPreviewBackground);
|
||||||
|
mPreviewLeftBackground = keyboardViewAttr.getDrawable(
|
||||||
R.styleable.KeyboardView_keyPreviewLeftBackground);
|
R.styleable.KeyboardView_keyPreviewLeftBackground);
|
||||||
mPreviewRightBackground = a.getDrawable(
|
mPreviewRightBackground = keyboardViewAttr.getDrawable(
|
||||||
R.styleable.KeyboardView_keyPreviewRightBackground);
|
R.styleable.KeyboardView_keyPreviewRightBackground);
|
||||||
setAlpha(mPreviewBackground, PREVIEW_ALPHA);
|
setAlpha(mPreviewBackground, PREVIEW_ALPHA);
|
||||||
setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA);
|
setAlpha(mPreviewLeftBackground, PREVIEW_ALPHA);
|
||||||
setAlpha(mPreviewRightBackground, PREVIEW_ALPHA);
|
setAlpha(mPreviewRightBackground, PREVIEW_ALPHA);
|
||||||
mPreviewOffset = a.getDimensionPixelOffset(
|
mPreviewOffset = keyboardViewAttr.getDimensionPixelOffset(
|
||||||
R.styleable.KeyboardView_keyPreviewOffset, 0);
|
R.styleable.KeyboardView_keyPreviewOffset, 0);
|
||||||
mPreviewHeight = a.getDimensionPixelSize(
|
mPreviewHeight = keyboardViewAttr.getDimensionPixelSize(
|
||||||
R.styleable.KeyboardView_keyPreviewHeight, 80);
|
R.styleable.KeyboardView_keyPreviewHeight, 80);
|
||||||
mPreviewTextRatio = ResourceUtils.getFraction(a,
|
mLingerTimeout = keyboardViewAttr.getInt(
|
||||||
R.styleable.KeyboardView_keyPreviewTextRatio);
|
R.styleable.KeyboardView_keyPreviewLingerTimeout, 0);
|
||||||
mPreviewTextColor = a.getColor(R.styleable.KeyboardView_keyPreviewTextColor, 0);
|
|
||||||
mLingerTimeout = a.getInt(R.styleable.KeyboardView_keyPreviewLingerTimeout, 0);
|
mPreviewTextRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
|
R.styleable.Keyboard_Key_keyPreviewTextRatio);
|
||||||
|
mPreviewTextColor = keyAttr.getColor(R.styleable.Keyboard_Key_keyPreviewTextColor, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateParams(final Keyboard keyboard, final KeyDrawParams keyDrawParams) {
|
public void updateParams(final Keyboard keyboard, final KeyDrawParams keyDrawParams) {
|
||||||
|
@ -398,20 +404,26 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
public KeyboardView(Context context, AttributeSet attrs, int defStyle) {
|
public KeyboardView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
|
|
||||||
final TypedArray a = context.obtainStyledAttributes(
|
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs,
|
||||||
attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
|
R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
|
||||||
mKeyDrawParams = new KeyDrawParams(a);
|
final TypedArray keyAttr = context.obtainStyledAttributes(attrs,
|
||||||
mKeyPreviewDrawParams = new KeyPreviewDrawParams(a);
|
R.styleable.Keyboard_Key, defStyle, R.style.KeyboardView);
|
||||||
|
mKeyDrawParams = new KeyDrawParams(keyboardViewAttr, keyAttr);
|
||||||
|
mKeyPreviewDrawParams = new KeyPreviewDrawParams(keyboardViewAttr, keyAttr);
|
||||||
mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout;
|
mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout;
|
||||||
mKeyPreviewLayoutId = a.getResourceId(R.styleable.KeyboardView_keyPreviewLayout, 0);
|
mKeyPreviewLayoutId = keyboardViewAttr.getResourceId(
|
||||||
|
R.styleable.KeyboardView_keyPreviewLayout, 0);
|
||||||
if (mKeyPreviewLayoutId == 0) {
|
if (mKeyPreviewLayoutId == 0) {
|
||||||
mShowKeyPreviewPopup = false;
|
mShowKeyPreviewPopup = false;
|
||||||
}
|
}
|
||||||
mVerticalCorrection = a.getDimensionPixelOffset(
|
mVerticalCorrection = keyboardViewAttr.getDimensionPixelOffset(
|
||||||
R.styleable.KeyboardView_verticalCorrection, 0);
|
R.styleable.KeyboardView_verticalCorrection, 0);
|
||||||
mMoreKeysLayout = a.getResourceId(R.styleable.KeyboardView_moreKeysLayout, 0);
|
mMoreKeysLayout = keyboardViewAttr.getResourceId(
|
||||||
mBackgroundDimAlpha = a.getInt(R.styleable.KeyboardView_backgroundDimAlpha, 0);
|
R.styleable.KeyboardView_moreKeysLayout, 0);
|
||||||
a.recycle();
|
mBackgroundDimAlpha = keyboardViewAttr.getInt(
|
||||||
|
R.styleable.KeyboardView_backgroundDimAlpha, 0);
|
||||||
|
keyboardViewAttr.recycle();
|
||||||
|
keyAttr.recycle();
|
||||||
|
|
||||||
mPreviewPlacerView = new PreviewPlacerView(context, attrs);
|
mPreviewPlacerView = new PreviewPlacerView(context, attrs);
|
||||||
mPaint.setAntiAlias(true);
|
mPaint.setAntiAlias(true);
|
||||||
|
@ -705,7 +717,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
? params.mKeyTextInactivatedColor : params.mKeyTextColor);
|
? params.mKeyTextInactivatedColor : params.mKeyTextColor);
|
||||||
if (key.isEnabled()) {
|
if (key.isEnabled()) {
|
||||||
// Set a drop shadow for the text
|
// Set a drop shadow for the text
|
||||||
paint.setShadowLayer(params.mShadowRadius, 0, 0, params.mShadowColor);
|
paint.setShadowLayer(params.mKeyTextShadowRadius, 0, 0, params.mKeyTextShadowColor);
|
||||||
} else {
|
} else {
|
||||||
// Make label invisible
|
// Make label invisible
|
||||||
paint.setColor(Color.TRANSPARENT);
|
paint.setColor(Color.TRANSPARENT);
|
||||||
|
|
|
@ -237,8 +237,6 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
R.style.Keyboard);
|
R.style.Keyboard);
|
||||||
final TypedArray keyAttr = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
final TypedArray keyAttr = mResources.obtainAttributes(Xml.asAttributeSet(parser),
|
||||||
R.styleable.Keyboard_Key);
|
R.styleable.Keyboard_Key);
|
||||||
final TypedArray keyboardViewAttr = mResources.obtainAttributes(
|
|
||||||
Xml.asAttributeSet(parser), R.styleable.KeyboardView);
|
|
||||||
try {
|
try {
|
||||||
final int displayHeight = mDisplayMetrics.heightPixels;
|
final int displayHeight = mDisplayMetrics.heightPixels;
|
||||||
final String keyboardHeightString = ResourceUtils.getDeviceOverrideValue(
|
final String keyboardHeightString = ResourceUtils.getDeviceOverrideValue(
|
||||||
|
@ -291,18 +289,18 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
R.styleable.Keyboard_rowHeight, params.mBaseHeight,
|
R.styleable.Keyboard_rowHeight, params.mBaseHeight,
|
||||||
params.mBaseHeight / DEFAULT_KEYBOARD_ROWS);
|
params.mBaseHeight / DEFAULT_KEYBOARD_ROWS);
|
||||||
|
|
||||||
if (keyboardViewAttr.hasValue(R.styleable.KeyboardView_keyTypeface)) {
|
if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyTypeface)) {
|
||||||
params.mKeyTypeface = Typeface.defaultFromStyle(keyboardViewAttr.getInt(
|
params.mKeyTypeface = Typeface.defaultFromStyle(keyAttr.getInt(
|
||||||
R.styleable.KeyboardView_keyTypeface, Typeface.NORMAL));
|
R.styleable.Keyboard_Key_keyTypeface, Typeface.NORMAL));
|
||||||
}
|
}
|
||||||
params.mKeyLetterRatio = ResourceUtils.getFraction(keyboardViewAttr,
|
params.mKeyLetterRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
R.styleable.KeyboardView_keyLetterSize);
|
R.styleable.Keyboard_Key_keyLetterSize);
|
||||||
params.mKeyLetterSize = ResourceUtils.getDimensionPixelSize(keyboardViewAttr,
|
params.mKeyLetterSize = ResourceUtils.getDimensionPixelSize(keyAttr,
|
||||||
R.styleable.KeyboardView_keyLetterSize);
|
R.styleable.Keyboard_Key_keyLetterSize);
|
||||||
params.mKeyHintLetterRatio = ResourceUtils.getFraction(keyboardViewAttr,
|
params.mKeyHintLetterRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
R.styleable.KeyboardView_keyHintLetterRatio);
|
R.styleable.Keyboard_Key_keyHintLetterRatio);
|
||||||
params.mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(keyboardViewAttr,
|
params.mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(keyAttr,
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintRatio);
|
R.styleable.Keyboard_Key_keyShiftedLetterHintRatio);
|
||||||
|
|
||||||
params.mMoreKeysTemplate = keyboardAttr.getResourceId(
|
params.mMoreKeysTemplate = keyboardAttr.getResourceId(
|
||||||
R.styleable.Keyboard_moreKeysTemplate, 0);
|
R.styleable.Keyboard_moreKeysTemplate, 0);
|
||||||
|
@ -334,7 +332,6 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
params.mTouchPositionCorrection.load(data);
|
params.mTouchPositionCorrection.load(data);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
keyboardViewAttr.recycle();
|
|
||||||
keyAttr.recycle();
|
keyAttr.recycle();
|
||||||
keyboardAttr.recycle();
|
keyboardAttr.recycle();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue