Revert "Revert "Fix key letter size of 5-rows Thai keyboard""
This reverts commit 7a5ca9982f
.
Depends: Ia4fa5046b3106e2710b9d5df1a6cc5f2cf995ec7
Change-Id: I0b9d0125380efe898943dc26ae884378145c44a3
main
parent
b590d69e1f
commit
61bc66b324
|
@ -53,6 +53,8 @@
|
||||||
<fraction name="key_uppercase_letter_ratio">40%</fraction>
|
<fraction name="key_uppercase_letter_ratio">40%</fraction>
|
||||||
<fraction name="key_preview_text_ratio">90%</fraction>
|
<fraction name="key_preview_text_ratio">90%</fraction>
|
||||||
<fraction name="spacebar_text_ratio">40.000%</fraction>
|
<fraction name="spacebar_text_ratio">40.000%</fraction>
|
||||||
|
<fraction name="key_letter_ratio_5rows">78%</fraction>
|
||||||
|
<fraction name="key_uppercase_letter_ratio_5rows">48%</fraction>
|
||||||
<dimen name="key_preview_offset">0.0dp</dimen>
|
<dimen name="key_preview_offset">0.0dp</dimen>
|
||||||
|
|
||||||
<dimen name="key_preview_offset_ics">1.6dp</dimen>
|
<dimen name="key_preview_offset_ics">1.6dp</dimen>
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
<fraction name="key_hint_label_ratio">34%</fraction>
|
<fraction name="key_hint_label_ratio">34%</fraction>
|
||||||
<fraction name="key_uppercase_letter_ratio">29%</fraction>
|
<fraction name="key_uppercase_letter_ratio">29%</fraction>
|
||||||
<fraction name="spacebar_text_ratio">30.0%</fraction>
|
<fraction name="spacebar_text_ratio">30.0%</fraction>
|
||||||
|
<fraction name="key_letter_ratio_5rows">62%</fraction>
|
||||||
|
<fraction name="key_uppercase_letter_ratio_5rows">36%</fraction>
|
||||||
<dimen name="key_uppercase_letter_padding">4dp</dimen>
|
<dimen name="key_uppercase_letter_padding">4dp</dimen>
|
||||||
|
|
||||||
<dimen name="suggestions_strip_padding">252.0dp</dimen>
|
<dimen name="suggestions_strip_padding">252.0dp</dimen>
|
||||||
|
|
|
@ -63,6 +63,8 @@
|
||||||
<fraction name="key_uppercase_letter_ratio">22%</fraction>
|
<fraction name="key_uppercase_letter_ratio">22%</fraction>
|
||||||
<fraction name="key_preview_text_ratio">50%</fraction>
|
<fraction name="key_preview_text_ratio">50%</fraction>
|
||||||
<fraction name="spacebar_text_ratio">28.0%</fraction>
|
<fraction name="spacebar_text_ratio">28.0%</fraction>
|
||||||
|
<fraction name="key_letter_ratio_5rows">52%</fraction>
|
||||||
|
<fraction name="key_uppercase_letter_ratio_5rows">27%</fraction>
|
||||||
<dimen name="key_preview_height">94.5dp</dimen>
|
<dimen name="key_preview_height">94.5dp</dimen>
|
||||||
<dimen name="key_preview_offset">16.0dp</dimen>
|
<dimen name="key_preview_offset">16.0dp</dimen>
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
<fraction name="key_hint_label_ratio">28%</fraction>
|
<fraction name="key_hint_label_ratio">28%</fraction>
|
||||||
<fraction name="key_uppercase_letter_ratio">24%</fraction>
|
<fraction name="key_uppercase_letter_ratio">24%</fraction>
|
||||||
<fraction name="spacebar_text_ratio">24.00%</fraction>
|
<fraction name="spacebar_text_ratio">24.00%</fraction>
|
||||||
|
<fraction name="key_letter_ratio_5rows">53%</fraction>
|
||||||
|
<fraction name="key_uppercase_letter_ratio_5rows">30%</fraction>
|
||||||
<dimen name="key_preview_height">107.1dp</dimen>
|
<dimen name="key_preview_height">107.1dp</dimen>
|
||||||
|
|
||||||
<dimen name="key_preview_offset_ics">8.0dp</dimen>
|
<dimen name="key_preview_offset_ics">8.0dp</dimen>
|
||||||
|
|
|
@ -64,6 +64,8 @@
|
||||||
<fraction name="key_uppercase_letter_ratio">26%</fraction>
|
<fraction name="key_uppercase_letter_ratio">26%</fraction>
|
||||||
<fraction name="key_preview_text_ratio">50%</fraction>
|
<fraction name="key_preview_text_ratio">50%</fraction>
|
||||||
<fraction name="spacebar_text_ratio">29.03%</fraction>
|
<fraction name="spacebar_text_ratio">29.03%</fraction>
|
||||||
|
<fraction name="key_letter_ratio_5rows">51%</fraction>
|
||||||
|
<fraction name="key_uppercase_letter_ratio_5rows">33%</fraction>
|
||||||
<dimen name="key_preview_height">94.5dp</dimen>
|
<dimen name="key_preview_height">94.5dp</dimen>
|
||||||
<dimen name="key_preview_offset">16.0dp</dimen>
|
<dimen name="key_preview_offset">16.0dp</dimen>
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,8 @@
|
||||||
<fraction name="key_uppercase_letter_ratio">35%</fraction>
|
<fraction name="key_uppercase_letter_ratio">35%</fraction>
|
||||||
<fraction name="key_preview_text_ratio">82%</fraction>
|
<fraction name="key_preview_text_ratio">82%</fraction>
|
||||||
<fraction name="spacebar_text_ratio">33.735%</fraction>
|
<fraction name="spacebar_text_ratio">33.735%</fraction>
|
||||||
|
<fraction name="key_letter_ratio_5rows">64%</fraction>
|
||||||
|
<fraction name="key_uppercase_letter_ratio_5rows">41%</fraction>
|
||||||
<dimen name="key_preview_height">80dp</dimen>
|
<dimen name="key_preview_height">80dp</dimen>
|
||||||
<dimen name="key_preview_offset">-8.0dp</dimen>
|
<dimen name="key_preview_offset">-8.0dp</dimen>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
latin:rowHeight="20%p"
|
latin:rowHeight="20%p"
|
||||||
latin:verticalGap="3.20%p"
|
latin:verticalGap="3.20%p"
|
||||||
latin:keyTypeface="normal"
|
latin:keyTypeface="normal"
|
||||||
|
latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
|
||||||
|
latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
|
||||||
latin:touchPositionCorrectionData="@null"
|
latin:touchPositionCorrectionData="@null"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
latin:rowHeight="20%p"
|
latin:rowHeight="20%p"
|
||||||
latin:verticalGap="3.20%p"
|
latin:verticalGap="3.20%p"
|
||||||
latin:keyTypeface="normal"
|
latin:keyTypeface="normal"
|
||||||
|
latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
|
||||||
|
latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
|
||||||
latin:touchPositionCorrectionData="@null"
|
latin:touchPositionCorrectionData="@null"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
latin:rowHeight="20%p"
|
latin:rowHeight="20%p"
|
||||||
latin:verticalGap="2.65%p"
|
latin:verticalGap="2.65%p"
|
||||||
latin:keyTypeface="normal"
|
latin:keyTypeface="normal"
|
||||||
|
latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
|
||||||
|
latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
|
||||||
latin:touchPositionCorrectionData="@null"
|
latin:touchPositionCorrectionData="@null"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
latin:rowHeight="20%p"
|
latin:rowHeight="20%p"
|
||||||
latin:verticalGap="2.95%p"
|
latin:verticalGap="2.95%p"
|
||||||
latin:keyTypeface="normal"
|
latin:keyTypeface="normal"
|
||||||
|
latin:keyLetterSize="@fraction/key_letter_ratio_5rows"
|
||||||
|
latin:keyShiftedLetterHintRatio="@fraction/key_uppercase_letter_ratio_5rows"
|
||||||
latin:touchPositionCorrectionData="@null"
|
latin:touchPositionCorrectionData="@null"
|
||||||
>
|
>
|
||||||
<include
|
<include
|
||||||
|
|
|
@ -124,6 +124,10 @@ public class Keyboard {
|
||||||
|
|
||||||
/** Per keyboard key visual parameters */
|
/** Per keyboard key visual parameters */
|
||||||
public final Typeface mKeyTypeface;
|
public final Typeface mKeyTypeface;
|
||||||
|
public final float mKeyLetterRatio;
|
||||||
|
public final int mKeyLetterSize;
|
||||||
|
public final float mKeyHintLetterRatio;
|
||||||
|
public final float mKeyShiftedLetterHintRatio;
|
||||||
|
|
||||||
public final int mMostCommonKeyHeight;
|
public final int mMostCommonKeyHeight;
|
||||||
public final int mMostCommonKeyWidth;
|
public final int mMostCommonKeyWidth;
|
||||||
|
@ -156,6 +160,10 @@ public class Keyboard {
|
||||||
mMaxMoreKeysKeyboardColumn = params.mMaxMoreKeysKeyboardColumn;
|
mMaxMoreKeysKeyboardColumn = params.mMaxMoreKeysKeyboardColumn;
|
||||||
|
|
||||||
mKeyTypeface = params.mKeyTypeface;
|
mKeyTypeface = params.mKeyTypeface;
|
||||||
|
mKeyLetterRatio = params.mKeyLetterRatio;
|
||||||
|
mKeyLetterSize = params.mKeyLetterSize;
|
||||||
|
mKeyHintLetterRatio = params.mKeyHintLetterRatio;
|
||||||
|
mKeyShiftedLetterHintRatio = params.mKeyShiftedLetterHintRatio;
|
||||||
|
|
||||||
mTopPadding = params.mTopPadding;
|
mTopPadding = params.mTopPadding;
|
||||||
mVerticalGap = params.mVerticalGap;
|
mVerticalGap = params.mVerticalGap;
|
||||||
|
@ -253,6 +261,10 @@ public class Keyboard {
|
||||||
public int mHorizontalCenterPadding;
|
public int mHorizontalCenterPadding;
|
||||||
|
|
||||||
public Typeface mKeyTypeface = null;
|
public Typeface mKeyTypeface = null;
|
||||||
|
public float mKeyLetterRatio = ResourceUtils.UNDEFINED_RATIO;
|
||||||
|
public int mKeyLetterSize = ResourceUtils.UNDEFINED_DIMENSION;
|
||||||
|
public float mKeyHintLetterRatio = ResourceUtils.UNDEFINED_RATIO;;
|
||||||
|
public float mKeyShiftedLetterHintRatio = ResourceUtils.UNDEFINED_RATIO;
|
||||||
|
|
||||||
public int mDefaultRowHeight;
|
public int mDefaultRowHeight;
|
||||||
public int mDefaultKeyWidth;
|
public int mDefaultKeyWidth;
|
||||||
|
@ -813,6 +825,14 @@ public class Keyboard {
|
||||||
params.mKeyTypeface = Typeface.defaultFromStyle(keyboardViewAttr.getInt(
|
params.mKeyTypeface = Typeface.defaultFromStyle(keyboardViewAttr.getInt(
|
||||||
R.styleable.KeyboardView_keyTypeface, Typeface.NORMAL));
|
R.styleable.KeyboardView_keyTypeface, Typeface.NORMAL));
|
||||||
}
|
}
|
||||||
|
params.mKeyLetterRatio = ResourceUtils.getFraction(keyboardViewAttr,
|
||||||
|
R.styleable.KeyboardView_keyLetterSize);
|
||||||
|
params.mKeyLetterSize = ResourceUtils.getDimensionPixelSize(keyboardViewAttr,
|
||||||
|
R.styleable.KeyboardView_keyLetterSize);
|
||||||
|
params.mKeyHintLetterRatio = ResourceUtils.getFraction(keyboardViewAttr,
|
||||||
|
R.styleable.KeyboardView_keyHintLetterRatio);
|
||||||
|
params.mKeyShiftedLetterHintRatio = ResourceUtils.getFraction(keyboardViewAttr,
|
||||||
|
R.styleable.KeyboardView_keyShiftedLetterHintRatio);
|
||||||
|
|
||||||
params.mMoreKeysTemplate = keyboardAttr.getResourceId(
|
params.mMoreKeysTemplate = keyboardAttr.getResourceId(
|
||||||
R.styleable.Keyboard_moreKeysTemplate, 0);
|
R.styleable.Keyboard_moreKeysTemplate, 0);
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
|
|
||||||
// Miscellaneous constants
|
// Miscellaneous constants
|
||||||
private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
|
private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
|
||||||
|
|
||||||
// XML attributes
|
// XML attributes
|
||||||
protected final float mVerticalCorrection;
|
protected final float mVerticalCorrection;
|
||||||
protected final int mMoreKeysLayout;
|
protected final int mMoreKeysLayout;
|
||||||
|
@ -197,6 +198,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
|
|
||||||
private final Typeface mKeyTypefaceFromKeyboardView;
|
private final Typeface mKeyTypefaceFromKeyboardView;
|
||||||
private final float mKeyLetterRatio;
|
private final float mKeyLetterRatio;
|
||||||
|
private final int mKeyLetterSizeFromKeyboardView;
|
||||||
private final float mKeyLargeLetterRatio;
|
private final float mKeyLargeLetterRatio;
|
||||||
private final float mKeyLabelRatio;
|
private final float mKeyLabelRatio;
|
||||||
private final float mKeyLargeLabelRatio;
|
private final float mKeyLargeLabelRatio;
|
||||||
|
@ -217,16 +219,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
|
|
||||||
public KeyDrawParams(final TypedArray a) {
|
public KeyDrawParams(final TypedArray a) {
|
||||||
mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground);
|
mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground);
|
||||||
if (!ResourceUtils.isValidFraction(mKeyLetterRatio = ResourceUtils.getFraction(a,
|
mKeyLetterRatio = ResourceUtils.getFraction(a, R.styleable.KeyboardView_keyLetterSize);
|
||||||
R.styleable.KeyboardView_keyLetterSize))) {
|
mKeyLetterSizeFromKeyboardView = ResourceUtils.getDimensionPixelSize(a,
|
||||||
mKeyLetterSize = ResourceUtils.getDimensionPixelSize(a,
|
|
||||||
R.styleable.KeyboardView_keyLetterSize);
|
R.styleable.KeyboardView_keyLetterSize);
|
||||||
}
|
mKeyLabelRatio = ResourceUtils.getFraction(a, R.styleable.KeyboardView_keyLabelSize);
|
||||||
if (!ResourceUtils.isValidFraction(mKeyLabelRatio = ResourceUtils.getFraction(a,
|
|
||||||
R.styleable.KeyboardView_keyLabelSize))) {
|
|
||||||
mKeyLabelSize = ResourceUtils.getDimensionPixelSize(a,
|
mKeyLabelSize = ResourceUtils.getDimensionPixelSize(a,
|
||||||
R.styleable.KeyboardView_keyLabelSize);
|
R.styleable.KeyboardView_keyLabelSize);
|
||||||
}
|
|
||||||
mKeyLargeLabelRatio = ResourceUtils.getFraction(a,
|
mKeyLargeLabelRatio = ResourceUtils.getFraction(a,
|
||||||
R.styleable.KeyboardView_keyLargeLabelRatio);
|
R.styleable.KeyboardView_keyLargeLabelRatio);
|
||||||
mKeyLargeLetterRatio = ResourceUtils.getFraction(a,
|
mKeyLargeLetterRatio = ResourceUtils.getFraction(a,
|
||||||
|
@ -245,19 +243,23 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
R.styleable.KeyboardView_keyPopupHintLetterPadding, 0);
|
R.styleable.KeyboardView_keyPopupHintLetterPadding, 0);
|
||||||
mKeyShiftedLetterHintPadding = a.getDimension(
|
mKeyShiftedLetterHintPadding = a.getDimension(
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintPadding, 0);
|
R.styleable.KeyboardView_keyShiftedLetterHintPadding, 0);
|
||||||
mKeyTextColor = a.getColor(R.styleable.KeyboardView_keyTextColor, 0xFF000000);
|
mKeyTextColor = a.getColor(
|
||||||
|
R.styleable.KeyboardView_keyTextColor, Color.WHITE);
|
||||||
mKeyTextInactivatedColor = a.getColor(
|
mKeyTextInactivatedColor = a.getColor(
|
||||||
R.styleable.KeyboardView_keyTextInactivatedColor, 0xFF000000);
|
R.styleable.KeyboardView_keyTextInactivatedColor, Color.WHITE);
|
||||||
mKeyHintLetterColor = a.getColor(R.styleable.KeyboardView_keyHintLetterColor, 0);
|
mKeyHintLetterColor = a.getColor(
|
||||||
mKeyHintLabelColor = a.getColor(R.styleable.KeyboardView_keyHintLabelColor, 0);
|
R.styleable.KeyboardView_keyHintLetterColor, Color.TRANSPARENT);
|
||||||
|
mKeyHintLabelColor = a.getColor(
|
||||||
|
R.styleable.KeyboardView_keyHintLabelColor, Color.TRANSPARENT);
|
||||||
mKeyShiftedLetterHintInactivatedColor = a.getColor(
|
mKeyShiftedLetterHintInactivatedColor = a.getColor(
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintInactivatedColor, 0);
|
R.styleable.KeyboardView_keyShiftedLetterHintInactivatedColor,
|
||||||
|
Color.TRANSPARENT);
|
||||||
mKeyShiftedLetterHintActivatedColor = a.getColor(
|
mKeyShiftedLetterHintActivatedColor = a.getColor(
|
||||||
R.styleable.KeyboardView_keyShiftedLetterHintActivatedColor, 0);
|
R.styleable.KeyboardView_keyShiftedLetterHintActivatedColor, Color.TRANSPARENT);
|
||||||
mKeyTypefaceFromKeyboardView = Typeface.defaultFromStyle(
|
mKeyTypefaceFromKeyboardView = Typeface.defaultFromStyle(
|
||||||
a.getInt(R.styleable.KeyboardView_keyTypeface, Typeface.NORMAL));
|
a.getInt(R.styleable.KeyboardView_keyTypeface, Typeface.NORMAL));
|
||||||
mKeyTypeface = mKeyTypefaceFromKeyboardView;
|
mKeyTypeface = mKeyTypefaceFromKeyboardView;
|
||||||
mShadowColor = a.getColor(R.styleable.KeyboardView_shadowColor, 0);
|
mShadowColor = a.getColor(R.styleable.KeyboardView_shadowColor, Color.TRANSPARENT);
|
||||||
mShadowRadius = a.getFloat(R.styleable.KeyboardView_shadowRadius, 0f);
|
mShadowRadius = a.getFloat(R.styleable.KeyboardView_shadowRadius, 0f);
|
||||||
|
|
||||||
mKeyBackground.getPadding(mPadding);
|
mKeyBackground.getPadding(mPadding);
|
||||||
|
@ -267,19 +269,42 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
mKeyTypeface = (keyboard.mKeyTypeface != null)
|
mKeyTypeface = (keyboard.mKeyTypeface != null)
|
||||||
? keyboard.mKeyTypeface : mKeyTypefaceFromKeyboardView;
|
? keyboard.mKeyTypeface : mKeyTypefaceFromKeyboardView;
|
||||||
final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
|
final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
|
||||||
if (ResourceUtils.isValidFraction(mKeyLetterRatio)) {
|
mKeyLetterSize = selectTextSizeFromDimensionOrRatio(keyHeight,
|
||||||
mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio);
|
mKeyLetterSizeFromKeyboardView, mKeyLetterRatio,
|
||||||
}
|
mKeyLetterSizeFromKeyboardView);
|
||||||
|
// Override if size/ratio is specified in Keyboard.
|
||||||
|
mKeyLetterSize = selectTextSizeFromDimensionOrRatio(keyHeight, keyboard.mKeyLetterSize,
|
||||||
|
keyboard.mKeyLetterRatio, mKeyLetterSize);
|
||||||
if (ResourceUtils.isValidFraction(mKeyLabelRatio)) {
|
if (ResourceUtils.isValidFraction(mKeyLabelRatio)) {
|
||||||
mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio);
|
mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio);
|
||||||
}
|
}
|
||||||
mKeyLargeLabelSize = (int)(keyHeight * mKeyLargeLabelRatio);
|
mKeyLargeLabelSize = (int)(keyHeight * mKeyLargeLabelRatio);
|
||||||
mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio);
|
mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio);
|
||||||
mKeyHintLetterSize = (int)(keyHeight * mKeyHintLetterRatio);
|
mKeyHintLetterSize = selectTextSizeFromKeyboardOrView(keyHeight,
|
||||||
mKeyShiftedLetterHintSize = (int)(keyHeight * mKeyShiftedLetterHintRatio);
|
keyboard.mKeyHintLetterRatio, mKeyHintLetterRatio);
|
||||||
|
mKeyShiftedLetterHintSize = selectTextSizeFromKeyboardOrView(keyHeight,
|
||||||
|
keyboard.mKeyShiftedLetterHintRatio, mKeyShiftedLetterHintRatio);
|
||||||
mKeyHintLabelSize = (int)(keyHeight * mKeyHintLabelRatio);
|
mKeyHintLabelSize = (int)(keyHeight * mKeyHintLabelRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final int selectTextSizeFromDimensionOrRatio(final int keyHeight,
|
||||||
|
final int dimens, final float ratio, final int defaultDimens) {
|
||||||
|
if (ResourceUtils.isValidDimensionPixelSize(dimens)) {
|
||||||
|
return dimens;
|
||||||
|
}
|
||||||
|
if (ResourceUtils.isValidFraction(ratio)) {
|
||||||
|
return (int)(keyHeight * ratio);
|
||||||
|
}
|
||||||
|
return defaultDimens;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int selectTextSizeFromKeyboardOrView(final int keyHeight,
|
||||||
|
final float ratioFromKeyboard, final float ratioFromView) {
|
||||||
|
final float ratio = ResourceUtils.isValidFraction(ratioFromKeyboard)
|
||||||
|
? ratioFromKeyboard : ratioFromView;
|
||||||
|
return (int)(keyHeight * ratio);
|
||||||
|
}
|
||||||
|
|
||||||
public void blendAlpha(final Paint paint) {
|
public void blendAlpha(final Paint paint) {
|
||||||
final int color = paint.getColor();
|
final int color = paint.getColor();
|
||||||
paint.setARGB((paint.getAlpha() * mAnimAlpha) / Constants.Color.ALPHA_OPAQUE,
|
paint.setARGB((paint.getAlpha() * mAnimAlpha) / Constants.Color.ALPHA_OPAQUE,
|
||||||
|
|
|
@ -55,6 +55,16 @@ public final class ResourceUtils {
|
||||||
return fraction >= 0.0f;
|
return fraction >= 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {@link Resources#getDimensionPixelSize(int)} returns at least one pixel size.
|
||||||
|
public static boolean isValidDimensionPixelSize(final int dimension) {
|
||||||
|
return dimension > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// {@link Resources#getDimensionPixelOffset(int)} may return zero pixel offset.
|
||||||
|
public static boolean isValidDimensionPixelOffset(final int dimension) {
|
||||||
|
return dimension >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static float getFraction(final TypedArray a, final int index, final float defValue) {
|
public static float getFraction(final TypedArray a, final int index, final float defValue) {
|
||||||
final TypedValue value = a.peekValue(index);
|
final TypedValue value = a.peekValue(index);
|
||||||
if (value == null || !isFractionValue(value)) {
|
if (value == null || !isFractionValue(value)) {
|
||||||
|
|
Loading…
Reference in New Issue