am 639c93f4: Remove unused Key.keyLabelFlags\' values
* commit '639c93f43bc51a8328d7dc11a09a3bd77974aeae': Remove unused Key.keyLabelFlags' valuesmain
commit
9c6abf3ece
|
@ -49,8 +49,6 @@
|
|||
<fraction name="config_key_hint_label_ratio">52%</fraction>
|
||||
<fraction name="config_key_shifted_letter_hint_ratio">40%</fraction>
|
||||
<fraction name="config_language_on_spacebar_text_ratio">40.000%</fraction>
|
||||
<!-- left or right padding of label alignment -->
|
||||
<dimen name="config_key_label_horizontal_padding">8dp</dimen>
|
||||
|
||||
<!-- For 5-row keyboard -->
|
||||
<fraction name="config_key_vertical_gap_5row">3.20%p</fraction>
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
<fraction name="config_key_hint_label_ratio">34%</fraction>
|
||||
<fraction name="config_key_shifted_letter_hint_ratio">29%</fraction>
|
||||
<fraction name="config_language_on_spacebar_text_ratio">30.0%</fraction>
|
||||
<!-- left or right padding of label alignment -->
|
||||
<dimen name="config_key_label_horizontal_padding">18dp</dimen>
|
||||
<dimen name="config_key_shifted_letter_hint_padding">4dp</dimen>
|
||||
|
||||
<!-- For 5-row keyboard -->
|
||||
|
|
|
@ -52,8 +52,6 @@
|
|||
<fraction name="config_key_hint_label_ratio">28%</fraction>
|
||||
<fraction name="config_key_shifted_letter_hint_ratio">22%</fraction>
|
||||
<fraction name="config_language_on_spacebar_text_ratio">28.0%</fraction>
|
||||
<!-- left or right padding of label alignment -->
|
||||
<dimen name="config_key_label_horizontal_padding">6dp</dimen>
|
||||
<dimen name="config_key_hint_letter_padding">3dp</dimen>
|
||||
<dimen name="config_key_shifted_letter_hint_padding">3dp</dimen>
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
<fraction name="config_key_hint_label_ratio">28%</fraction>
|
||||
<fraction name="config_key_shifted_letter_hint_ratio">24%</fraction>
|
||||
<fraction name="config_language_on_spacebar_text_ratio">24.00%</fraction>
|
||||
<!-- left or right padding of label alignment -->
|
||||
<dimen name="config_key_label_horizontal_padding">18dp</dimen>
|
||||
|
||||
<!-- For 5-row keyboard -->
|
||||
<fraction name="config_key_vertical_gap_5row">2.65%p</fraction>
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
<fraction name="config_key_hint_label_ratio">28%</fraction>
|
||||
<fraction name="config_key_shifted_letter_hint_ratio">26%</fraction>
|
||||
<fraction name="config_language_on_spacebar_text_ratio">29.03%</fraction>
|
||||
<!-- left or right padding of label alignment -->
|
||||
<dimen name="config_key_label_horizontal_padding">6dp</dimen>
|
||||
<dimen name="config_key_hint_letter_padding">3dp</dimen>
|
||||
<dimen name="config_key_shifted_letter_hint_padding">3dp</dimen>
|
||||
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
{@link StateListDrawable}, with the following possible states: normal, pressed. -->
|
||||
<attr name="spacebarBackground" format="reference" />
|
||||
<attr name="spacebarIconWidthRatio" format="float" />
|
||||
<!-- 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.-->
|
||||
|
@ -291,9 +289,6 @@
|
|||
<!-- The key label flags. -->
|
||||
<attr name="keyLabelFlags" format="integer">
|
||||
<!-- This should be aligned with Key.LABEL_FLAGS__* -->
|
||||
<flag name="alignLeft" value="0x01" />
|
||||
<flag name="alignRight" value="0x02" />
|
||||
<flag name="alignButtom" value="0x04" />
|
||||
<flag name="alignLeftOfCenter" value="0x08" />
|
||||
<flag name="fontNormal" value="0x10" />
|
||||
<flag name="fontMonoSpace" value="0x20" />
|
||||
|
@ -306,9 +301,6 @@
|
|||
<flag name="hasPopupHint" value="0x200" />
|
||||
<flag name="hasShiftedLetterHint" value="0x400" />
|
||||
<flag name="hasHintLabel" value="0x800" />
|
||||
<!-- These two flags are currently unused. Leave these for possible future use. -->
|
||||
<flag name="withIconLeft" value="0x1000" />
|
||||
<flag name="withIconRight" value="0x2000" />
|
||||
<flag name="autoXScale" value="0x4000" />
|
||||
<!-- The autoScale value implies autoXScale bit on to optimize scaling code path. -->
|
||||
<flag name="autoScale" value="0xc000" />
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
<fraction name="config_key_hint_label_ratio">44%</fraction>
|
||||
<fraction name="config_key_shifted_letter_hint_ratio">35%</fraction>
|
||||
<fraction name="config_language_on_spacebar_text_ratio">33.735%</fraction>
|
||||
<dimen name="config_key_label_horizontal_padding">4dp</dimen>
|
||||
<dimen name="config_key_hint_letter_padding">1dp</dimen>
|
||||
<dimen name="config_key_shifted_letter_hint_padding">2dp</dimen>
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
<item name="keyHintLabelRatio">@fraction/config_key_hint_label_ratio</item>
|
||||
<item name="keyShiftedLetterHintRatio">@fraction/config_key_shifted_letter_hint_ratio</item>
|
||||
<item name="keyTypeface">normal</item>
|
||||
<item name="keyLabelHorizontalPadding">@dimen/config_key_label_horizontal_padding</item>
|
||||
<item name="keyHintLetterPadding">@dimen/config_key_hint_letter_padding</item>
|
||||
<item name="keyPopupHintLetterPadding">@dimen/config_key_popup_hint_letter_padding</item>
|
||||
<item name="keyShiftedLetterHintPadding">@dimen/config_key_shifted_letter_hint_padding</item>
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
<key-style
|
||||
latin:styleName="numSpaceKeyStyle"
|
||||
latin:keySpec="!icon/space_key_for_number_layout|!code/key_space"
|
||||
latin:keyLabelFlags="alignButtom"
|
||||
latin:keyActionFlags="enableLongPress"
|
||||
latin:parentStyle="numKeyBaseStyle" />
|
||||
<!-- Override defaultEnterKeyStyle in key_styles_enter.xml -->
|
||||
|
|
|
@ -58,9 +58,6 @@ public class Key implements Comparable<Key> {
|
|||
private final String mHintLabel;
|
||||
/** Flags of the label */
|
||||
private final int mLabelFlags;
|
||||
private static final int LABEL_FLAGS_ALIGN_LEFT = 0x01;
|
||||
private static final int LABEL_FLAGS_ALIGN_RIGHT = 0x02;
|
||||
private static final int LABEL_FLAGS_ALIGN_BUTTOM = 0x04;
|
||||
private static final int LABEL_FLAGS_ALIGN_LEFT_OF_CENTER = 0x08;
|
||||
// Font typeface specification.
|
||||
private static final int LABEL_FLAGS_FONT_MASK = 0x30;
|
||||
|
@ -78,8 +75,6 @@ public class Key implements Comparable<Key> {
|
|||
private static final int LABEL_FLAGS_HAS_POPUP_HINT = 0x200;
|
||||
private static final int LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT = 0x400;
|
||||
private static final int LABEL_FLAGS_HAS_HINT_LABEL = 0x800;
|
||||
private static final int LABEL_FLAGS_WITH_ICON_LEFT = 0x1000;
|
||||
private static final int LABEL_FLAGS_WITH_ICON_RIGHT = 0x2000;
|
||||
// The bit to calculate the ratio of key label width against key width. If autoXScale bit is on
|
||||
// and autoYScale bit is off, the key label may be shrunk only for X-direction.
|
||||
// If both autoXScale and autoYScale bits are on, the key label text size may be auto scaled.
|
||||
|
@ -646,18 +641,6 @@ public class Key implements Comparable<Key> {
|
|||
return Typeface.DEFAULT_BOLD;
|
||||
}
|
||||
|
||||
public final boolean isAlignLeft() {
|
||||
return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT) != 0;
|
||||
}
|
||||
|
||||
public final boolean isAlignRight() {
|
||||
return (mLabelFlags & LABEL_FLAGS_ALIGN_RIGHT) != 0;
|
||||
}
|
||||
|
||||
public final boolean isAlignButtom() {
|
||||
return (mLabelFlags & LABEL_FLAGS_ALIGN_BUTTOM) != 0;
|
||||
}
|
||||
|
||||
public final boolean isAlignLeftOfCenter() {
|
||||
return (mLabelFlags & LABEL_FLAGS_ALIGN_LEFT_OF_CENTER) != 0;
|
||||
}
|
||||
|
@ -675,14 +658,6 @@ public class Key implements Comparable<Key> {
|
|||
return (mLabelFlags & LABEL_FLAGS_HAS_HINT_LABEL) != 0;
|
||||
}
|
||||
|
||||
public final boolean hasLabelWithIconLeft() {
|
||||
return (mLabelFlags & LABEL_FLAGS_WITH_ICON_LEFT) != 0;
|
||||
}
|
||||
|
||||
public final boolean hasLabelWithIconRight() {
|
||||
return (mLabelFlags & LABEL_FLAGS_WITH_ICON_RIGHT) != 0;
|
||||
}
|
||||
|
||||
public final boolean needsAutoXScale() {
|
||||
return (mLabelFlags & LABEL_FLAGS_AUTO_X_SCALE) != 0;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ import java.util.HashSet;
|
|||
* @attr ref R.styleable#KeyboardView_functionalKeyBackground
|
||||
* @attr ref R.styleable#KeyboardView_spacebarBackground
|
||||
* @attr ref R.styleable#KeyboardView_spacebarIconWidthRatio
|
||||
* @attr ref R.styleable#KeyboardView_keyLabelHorizontalPadding
|
||||
* @attr ref R.styleable#KeyboardView_keyHintLetterPadding
|
||||
* @attr ref R.styleable#KeyboardView_keyPopupHintLetterPadding
|
||||
* @attr ref R.styleable#KeyboardView_keyShiftedLetterHintPadding
|
||||
|
@ -74,7 +73,6 @@ import java.util.HashSet;
|
|||
public class KeyboardView extends View {
|
||||
// XML attributes
|
||||
private final KeyVisualAttributes mKeyVisualAttributes;
|
||||
private final int mKeyLabelHorizontalPadding;
|
||||
private final float mKeyHintLetterPadding;
|
||||
private final float mKeyPopupHintLetterPadding;
|
||||
private final float mKeyShiftedLetterHintPadding;
|
||||
|
@ -90,11 +88,6 @@ public class KeyboardView extends View {
|
|||
// HORIZONTAL ELLIPSIS "...", character for popup hint.
|
||||
private static final String POPUP_HINT_CHAR = "\u2026";
|
||||
|
||||
// Margin between the label and the icon on a key that has both of them.
|
||||
// Specified by the fraction of the key width.
|
||||
// TODO: Use resource parameter for this value.
|
||||
private static final float LABEL_ICON_MARGIN = 0.05f;
|
||||
|
||||
// The maximum key label width in the proportion to the key width.
|
||||
private static final float MAX_LABEL_RATIO = 0.90f;
|
||||
|
||||
|
@ -137,8 +130,6 @@ public class KeyboardView extends View {
|
|||
mSpacebarBackground = (spacebarBackground != null) ? spacebarBackground : mKeyBackground;
|
||||
mSpacebarIconWidthRatio = keyboardViewAttr.getFloat(
|
||||
R.styleable.KeyboardView_spacebarIconWidthRatio, 1.0f);
|
||||
mKeyLabelHorizontalPadding = keyboardViewAttr.getDimensionPixelOffset(
|
||||
R.styleable.KeyboardView_keyLabelHorizontalPadding, 0);
|
||||
mKeyHintLetterPadding = keyboardViewAttr.getDimension(
|
||||
R.styleable.KeyboardView_keyHintLetterPadding, 0.0f);
|
||||
mKeyPopupHintLetterPadding = keyboardViewAttr.getDimension(
|
||||
|
@ -376,27 +367,10 @@ public class KeyboardView extends View {
|
|||
final float baseline = centerY + labelCharHeight / 2.0f;
|
||||
|
||||
// Horizontal label text alignment
|
||||
float labelWidth = 0.0f;
|
||||
if (key.isAlignLeft()) {
|
||||
positionX = mKeyLabelHorizontalPadding;
|
||||
paint.setTextAlign(Align.LEFT);
|
||||
} else if (key.isAlignRight()) {
|
||||
positionX = keyWidth - mKeyLabelHorizontalPadding;
|
||||
paint.setTextAlign(Align.RIGHT);
|
||||
} else if (key.isAlignLeftOfCenter()) {
|
||||
if (key.isAlignLeftOfCenter()) {
|
||||
// TODO: Parameterise this?
|
||||
positionX = centerX - labelCharWidth * 7.0f / 4.0f;
|
||||
paint.setTextAlign(Align.LEFT);
|
||||
} else if (key.hasLabelWithIconLeft() && icon != null) {
|
||||
labelWidth = TypefaceUtils.getStringWidth(label, paint) + icon.getIntrinsicWidth()
|
||||
+ LABEL_ICON_MARGIN * keyWidth;
|
||||
positionX = centerX + labelWidth / 2.0f;
|
||||
paint.setTextAlign(Align.RIGHT);
|
||||
} else if (key.hasLabelWithIconRight() && icon != null) {
|
||||
labelWidth = TypefaceUtils.getStringWidth(label, paint) + icon.getIntrinsicWidth()
|
||||
+ LABEL_ICON_MARGIN * keyWidth;
|
||||
positionX = centerX - labelWidth / 2.0f;
|
||||
paint.setTextAlign(Align.LEFT);
|
||||
} else {
|
||||
positionX = centerX;
|
||||
paint.setTextAlign(Align.CENTER);
|
||||
|
@ -430,19 +404,6 @@ public class KeyboardView extends View {
|
|||
// Turn off drop shadow and reset x-scale.
|
||||
paint.clearShadowLayer();
|
||||
paint.setTextScaleX(1.0f);
|
||||
|
||||
if (icon != null) {
|
||||
final int iconWidth = icon.getIntrinsicWidth();
|
||||
final int iconHeight = icon.getIntrinsicHeight();
|
||||
final int iconY = (keyHeight - iconHeight) / 2;
|
||||
if (key.hasLabelWithIconLeft()) {
|
||||
final int iconX = (int)(centerX - labelWidth / 2.0f);
|
||||
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
|
||||
} else if (key.hasLabelWithIconRight()) {
|
||||
final int iconX = (int)(centerX + labelWidth / 2.0f - iconWidth);
|
||||
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw hint label.
|
||||
|
@ -493,16 +454,9 @@ public class KeyboardView extends View {
|
|||
iconWidth = Math.min(icon.getIntrinsicWidth(), keyWidth);
|
||||
}
|
||||
final int iconHeight = icon.getIntrinsicHeight();
|
||||
final int iconY = key.isAlignButtom() ? keyHeight - iconHeight
|
||||
: (keyHeight - iconHeight) / 2;
|
||||
final int iconX;
|
||||
if (key.isAlignLeft()) {
|
||||
iconX = mKeyLabelHorizontalPadding;
|
||||
} else if (key.isAlignRight()) {
|
||||
iconX = keyWidth - mKeyLabelHorizontalPadding - iconWidth;
|
||||
} else { // Align center
|
||||
iconX = (keyWidth - iconWidth) / 2;
|
||||
}
|
||||
// Align center.
|
||||
final int iconY = (keyHeight - iconHeight) / 2;
|
||||
final int iconX = (keyWidth - iconWidth) / 2;
|
||||
drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue