Merge "Tweak tablet keyboard design"
commit
bd20db25be
|
@ -17,5 +17,4 @@
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_pressed="true"
|
<item android:state_pressed="true"
|
||||||
android:drawable="@drawable/btn_keyboard_key_popup_selected_holo" />
|
android:drawable="@drawable/btn_keyboard_key_popup_selected_holo" />
|
||||||
<item android:drawable="@drawable/btn_keyboard_key_light_popup_normal" />
|
|
||||||
</selector>
|
</selector>
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:background="@drawable/keyboard_popup_panel_background_holo"
|
android:background="@drawable/keyboard_popup_panel_background_holo"
|
||||||
android:paddingLeft="44dip"
|
android:paddingLeft="40dip"
|
||||||
android:paddingRight="32dip"
|
android:paddingRight="40dip"
|
||||||
>
|
>
|
||||||
<com.android.inputmethod.latin.BaseKeyboardView
|
<com.android.inputmethod.latin.BaseKeyboardView
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
|
|
|
@ -28,8 +28,7 @@
|
||||||
android:paddingTop="@dimen/keyboard_top_padding"
|
android:paddingTop="@dimen/keyboard_top_padding"
|
||||||
android:paddingBottom="@dimen/keyboard_bottom_padding"
|
android:paddingBottom="@dimen/keyboard_bottom_padding"
|
||||||
android:background="@drawable/keyboard_dark_background"
|
android:background="@drawable/keyboard_dark_background"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
latin:keyBackground="@drawable/btn_keyboard_key_gingerbread"
|
latin:keyBackground="@drawable/btn_keyboard_key_gingerbread"
|
||||||
latin:keyTextStyle="bold"
|
latin:keyLetterStyle="bold"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -28,10 +28,12 @@
|
||||||
android:paddingTop="@dimen/keyboard_top_padding"
|
android:paddingTop="@dimen/keyboard_top_padding"
|
||||||
android:paddingBottom="@dimen/keyboard_bottom_padding"
|
android:paddingBottom="@dimen/keyboard_bottom_padding"
|
||||||
android:background="@drawable/keyboard_background_holo"
|
android:background="@drawable/keyboard_background_holo"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
latin:keyBackground="@drawable/btn_keyboard_key_honeycomb"
|
latin:keyBackground="@drawable/btn_keyboard_key_honeycomb"
|
||||||
latin:keyPreviewLayout="@layout/key_preview_honeycomb"
|
latin:keyPreviewLayout="@layout/key_preview_honeycomb"
|
||||||
latin:popupLayout="@layout/keyboard_popup_honeycomb"
|
latin:popupLayout="@layout/keyboard_popup_honeycomb"
|
||||||
latin:keyTextStyle="bold"
|
latin:keyTextColorDisabled="#FF353535"
|
||||||
|
latin:keyLetterStyle="bold"
|
||||||
|
latin:shadowColor="#00000000"
|
||||||
|
latin:shadowRadius="0.0"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -26,12 +26,11 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/keyboard_background"
|
android:background="@drawable/keyboard_background"
|
||||||
android:textStyle="bold"
|
|
||||||
|
|
||||||
latin:keyBackground="@drawable/btn_keyboard_key_stone"
|
latin:keyBackground="@drawable/btn_keyboard_key_stone"
|
||||||
latin:keyTextColor="@color/latinkeyboard_key_color_black"
|
latin:keyTextColor="@color/latinkeyboard_key_color_black"
|
||||||
latin:shadowColor="@color/latinkeyboard_key_color_white"
|
latin:shadowColor="@color/latinkeyboard_key_color_white"
|
||||||
latin:keyTextStyle="bold"
|
latin:keyLetterStyle="bold"
|
||||||
latin:colorScheme="black"
|
latin:colorScheme="black"
|
||||||
latin:popupLayout="@layout/input_stone_popup"
|
latin:popupLayout="@layout/input_stone_popup"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<dimen name="key_label_text_size">18dip</dimen>
|
||||||
|
<!-- left or right padding of label alignment -->
|
||||||
|
<dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
|
||||||
|
</resources>
|
|
@ -23,7 +23,7 @@
|
||||||
<dimen name="key_height">13.0mm</dimen>
|
<dimen name="key_height">13.0mm</dimen>
|
||||||
<dimen name="key_bottom_gap">1.5mm</dimen>
|
<dimen name="key_bottom_gap">1.5mm</dimen>
|
||||||
<dimen name="key_horizontal_gap">2.0mm</dimen>
|
<dimen name="key_horizontal_gap">2.0mm</dimen>
|
||||||
<dimen name="popup_key_height">15.0mm</dimen>
|
<dimen name="popup_key_height">13.0mm</dimen>
|
||||||
<dimen name="keyboard_top_padding">1.0mm</dimen>
|
<dimen name="keyboard_top_padding">1.0mm</dimen>
|
||||||
<dimen name="keyboard_bottom_padding">1.0mm</dimen>
|
<dimen name="keyboard_bottom_padding">1.0mm</dimen>
|
||||||
<!-- key_height x 1.0 -->
|
<!-- key_height x 1.0 -->
|
||||||
|
@ -34,11 +34,11 @@
|
||||||
<!-- popup_key_height x -1.0 -->
|
<!-- popup_key_height x -1.0 -->
|
||||||
<dimen name="mini_keyboard_vertical_correction">-13.0mm</dimen>
|
<dimen name="mini_keyboard_vertical_correction">-13.0mm</dimen>
|
||||||
|
|
||||||
<dimen name="key_text_size">24dip</dimen>
|
<dimen name="key_letter_size">24dip</dimen>
|
||||||
<dimen name="key_label_text_size">18dip</dimen>
|
<dimen name="key_label_text_size">14dip</dimen>
|
||||||
<dimen name="key_preview_text_size_large">24dip</dimen>
|
<dimen name="key_preview_text_size_large">24dip</dimen>
|
||||||
<!-- left or right padding for of label alignment -->
|
<!-- left or right padding of label alignment -->
|
||||||
<dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
|
<dimen name="key_label_horizontal_alignment_padding">4dip</dimen>
|
||||||
|
|
||||||
<dimen name="candidate_strip_height">46dip</dimen>
|
<dimen name="candidate_strip_height">46dip</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
checkable+checked+pressed. -->
|
checkable+checked+pressed. -->
|
||||||
<attr name="keyBackground" format="reference" />
|
<attr name="keyBackground" format="reference" />
|
||||||
|
|
||||||
<!-- Size of the text for character keys. -->
|
<!-- Size of the text for one letter character keys. -->
|
||||||
<attr name="keyTextSize" format="dimension" />
|
<attr name="keyLetterSize" format="dimension" />
|
||||||
|
|
||||||
<!-- Size of the text for custom keys with some text and no icon. -->
|
<!-- Size of the text for custom keys with some text and no icon. -->
|
||||||
<attr name="labelTextSize" format="dimension" />
|
<attr name="labelTextSize" format="dimension" />
|
||||||
|
@ -34,6 +34,9 @@
|
||||||
<!-- Color to use for the label in a key. -->
|
<!-- Color to use for the label in a key. -->
|
||||||
<attr name="keyTextColor" format="color" />
|
<attr name="keyTextColor" format="color" />
|
||||||
|
|
||||||
|
<!-- Color to use for the label in a key when in disabled state. -->
|
||||||
|
<attr name="keyTextColorDisabled" format="color" />
|
||||||
|
|
||||||
<!-- Layout resource for key press feedback.-->
|
<!-- Layout resource for key press feedback.-->
|
||||||
<attr name="keyPreviewLayout" format="reference" />
|
<attr name="keyPreviewLayout" format="reference" />
|
||||||
|
|
||||||
|
@ -56,10 +59,12 @@
|
||||||
<attr name="shadowRadius" format="float" />
|
<attr name="shadowRadius" format="float" />
|
||||||
<attr name="backgroundDimAmount" format="float" />
|
<attr name="backgroundDimAmount" format="float" />
|
||||||
|
|
||||||
<attr name="keyTextStyle">
|
<attr name="keyLetterStyle">
|
||||||
|
<!-- This should be aligned with Typeface.NORMAL etc. -->
|
||||||
<enum name="normal" value="0" />
|
<enum name="normal" value="0" />
|
||||||
<enum name="bold" value="1" />
|
<enum name="bold" value="1" />
|
||||||
<enum name="italic" value="2" />
|
<enum name="italic" value="2" />
|
||||||
|
<enum name="boldItalic" value="3" />
|
||||||
</attr>
|
</attr>
|
||||||
|
|
||||||
<attr name="colorScheme">
|
<attr name="colorScheme">
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
<!-- popup_key_height x -1.0 -->
|
<!-- popup_key_height x -1.0 -->
|
||||||
<dimen name="mini_keyboard_vertical_correction">-0.325in</dimen>
|
<dimen name="mini_keyboard_vertical_correction">-0.325in</dimen>
|
||||||
|
|
||||||
<dimen name="key_text_size">0.13in</dimen>
|
<dimen name="key_letter_size">0.13in</dimen>
|
||||||
<dimen name="key_label_text_size">0.083in</dimen>
|
<dimen name="key_label_text_size">0.083in</dimen>
|
||||||
<dimen name="key_preview_text_size_large">40sp</dimen>
|
<dimen name="key_preview_text_size_large">40sp</dimen>
|
||||||
<!-- left or right padding for of label alignment -->
|
<!-- left or right padding of label alignment -->
|
||||||
<dimen name="key_label_horizontal_alignment_padding">0.13in</dimen>
|
<dimen name="key_label_horizontal_alignment_padding">0.13in</dimen>
|
||||||
<dimen name="key_preview_offset">0.000in</dimen>
|
<dimen name="key_preview_offset">0.000in</dimen>
|
||||||
<!-- We use "inch", not "dip" because this value tries dealing with physical distance related
|
<!-- We use "inch", not "dip" because this value tries dealing with physical distance related
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
<item name="android:background">@drawable/keyboard_background</item>
|
<item name="android:background">@drawable/keyboard_background</item>
|
||||||
|
|
||||||
<item name="keyBackground">@drawable/btn_keyboard_key</item>
|
<item name="keyBackground">@drawable/btn_keyboard_key</item>
|
||||||
<item name="keyTextSize">@dimen/key_text_size</item>
|
<item name="keyLetterSize">@dimen/key_letter_size</item>
|
||||||
|
<item name="keyLetterStyle">normal</item>
|
||||||
<item name="keyTextColor">#FFFFFFFF</item>
|
<item name="keyTextColor">#FFFFFFFF</item>
|
||||||
|
<item name="keyTextColorDisabled">#FFFFFFFF</item>
|
||||||
<item name="keyPreviewLayout">@layout/key_preview</item>
|
<item name="keyPreviewLayout">@layout/key_preview</item>
|
||||||
<item name="keyPreviewOffset">@dimen/key_preview_offset</item>
|
<item name="keyPreviewOffset">@dimen/key_preview_offset</item>
|
||||||
<item name="keyPreviewHeight">@dimen/key_preview_height</item>
|
<item name="keyPreviewHeight">@dimen/key_preview_height</item>
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
<Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
latin:keyWidth="5.0%p"
|
latin:keyWidth="3.5%p"
|
||||||
latin:horizontalGap="@dimen/key_horizontal_gap"
|
latin:horizontalGap="0px"
|
||||||
latin:verticalGap="0px"
|
latin:verticalGap="0px"
|
||||||
latin:keyHeight="@dimen/key_height"
|
latin:keyHeight="@dimen/popup_key_height"
|
||||||
>
|
>
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<Keyboard
|
<Keyboard
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
latin:keyWidth="5.0%p"
|
latin:keyWidth="4.0%p"
|
||||||
latin:horizontalGap="0px"
|
latin:horizontalGap="0px"
|
||||||
latin:verticalGap="0px"
|
latin:verticalGap="0px"
|
||||||
latin:keyHeight="@dimen/popup_key_height"
|
latin:keyHeight="@dimen/popup_key_height"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<Keyboard
|
<Keyboard
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
latin:keyWidth="5.0%p"
|
latin:keyWidth="4.0%p"
|
||||||
latin:horizontalGap="0px"
|
latin:horizontalGap="0px"
|
||||||
latin:verticalGap="0px"
|
latin:verticalGap="0px"
|
||||||
latin:keyHeight="@dimen/popup_key_height"
|
latin:keyHeight="@dimen/popup_key_height"
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
<Row>
|
<Row>
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
latin:keyLabelOption="alignLeft"
|
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<!-- To match one character label size with "More", I placed spaces around the char ','
|
<!-- To match one character label size with "More", I placed spaces around the char ','
|
||||||
and '.'. -->
|
and '.'. -->
|
||||||
|
|
|
@ -69,7 +69,6 @@
|
||||||
<Row>
|
<Row>
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
latin:keyLabelOption="alignLeft"
|
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<Spacer
|
<Spacer
|
||||||
latin:horizontalGap="4.458%p" />
|
latin:horizontalGap="4.458%p" />
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
<Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
latin:keyWidth="7.5%p"
|
latin:keyWidth="5.0%p"
|
||||||
latin:horizontalGap="@dimen/key_horizontal_gap"
|
latin:horizontalGap="0px"
|
||||||
latin:verticalGap="0px"
|
latin:verticalGap="0px"
|
||||||
latin:keyHeight="@dimen/key_height"
|
latin:keyHeight="@dimen/popup_key_height"
|
||||||
>
|
>
|
||||||
</Keyboard>
|
</Keyboard>
|
||||||
|
|
|
@ -124,7 +124,6 @@
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
latin:keyLabelOption="alignLeft"
|
|
||||||
latin:keyWidth="15.192%p"
|
latin:keyWidth="15.192%p"
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<Key
|
<Key
|
||||||
|
@ -155,7 +154,6 @@
|
||||||
latin:popupCharacters="¿" />
|
latin:popupCharacters="¿" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
latin:keyLabelOption="alignRight"
|
|
||||||
latin:keyWidth="12.530%p"
|
latin:keyWidth="12.530%p"
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyEdgeFlags="right" />
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
@ -104,7 +104,6 @@
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
latin:keyLabelOption="alignLeft"
|
|
||||||
latin:keyWidth="15.192%p"
|
latin:keyWidth="15.192%p"
|
||||||
latin:keyEdgeFlags="left" />
|
latin:keyEdgeFlags="left" />
|
||||||
<Key
|
<Key
|
||||||
|
@ -131,7 +130,6 @@
|
||||||
latin:keyLabel="¿" />
|
latin:keyLabel="¿" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="moreKeyStyle"
|
latin:keyStyle="moreKeyStyle"
|
||||||
latin:keyLabelOption="alignRight"
|
|
||||||
latin:keyWidth="12.530%p"
|
latin:keyWidth="12.530%p"
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyEdgeFlags="right" />
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<Keyboard
|
<Keyboard
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
latin:keyWidth="15%p"
|
latin:keyWidth="5.5%p"
|
||||||
latin:horizontalGap="0px"
|
latin:horizontalGap="0px"
|
||||||
latin:verticalGap="0px"
|
latin:verticalGap="0px"
|
||||||
latin:keyHeight="@dimen/popup_key_height"
|
latin:keyHeight="@dimen/popup_key_height"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<Keyboard
|
<Keyboard
|
||||||
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||||
latin:keyWidth="7.5%p"
|
latin:keyWidth="5.0%p"
|
||||||
latin:horizontalGap="0px"
|
latin:horizontalGap="0px"
|
||||||
latin:verticalGap="0px"
|
latin:verticalGap="0px"
|
||||||
latin:keyHeight="@dimen/popup_key_height"
|
latin:keyHeight="@dimen/popup_key_height"
|
||||||
|
|
|
@ -537,7 +537,8 @@ public class BaseKeyboard {
|
||||||
column = 0;
|
column = 0;
|
||||||
}
|
}
|
||||||
final Key key = new Key(row);
|
final Key key = new Key(row);
|
||||||
key.x = x;
|
// Horizontal gap is divided equally to both sides of the key.
|
||||||
|
key.x = x + key.gap / 2;
|
||||||
key.y = y;
|
key.y = y;
|
||||||
key.label = String.valueOf(c);
|
key.label = String.valueOf(c);
|
||||||
key.codes = new int[] { c };
|
key.codes = new int[] { c };
|
||||||
|
|
|
@ -170,9 +170,10 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1;
|
private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1;
|
||||||
|
|
||||||
// XML attribute
|
// XML attribute
|
||||||
private int mKeyTextSize;
|
private int mKeyLetterSize;
|
||||||
private int mKeyTextColor;
|
private int mKeyTextColor;
|
||||||
private Typeface mKeyTextStyle = Typeface.DEFAULT;
|
private int mKeyTextColorDisabled;
|
||||||
|
private Typeface mKeyLetterStyle = Typeface.DEFAULT;
|
||||||
private int mLabelTextSize;
|
private int mLabelTextSize;
|
||||||
private int mColorScheme = COLOR_SCHEME_WHITE;
|
private int mColorScheme = COLOR_SCHEME_WHITE;
|
||||||
private int mShadowColor;
|
private int mShadowColor;
|
||||||
|
@ -455,12 +456,15 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
case R.styleable.BaseKeyboardView_keyPreviewHeight:
|
case R.styleable.BaseKeyboardView_keyPreviewHeight:
|
||||||
mPreviewHeight = a.getDimensionPixelSize(attr, 80);
|
mPreviewHeight = a.getDimensionPixelSize(attr, 80);
|
||||||
break;
|
break;
|
||||||
case R.styleable.BaseKeyboardView_keyTextSize:
|
case R.styleable.BaseKeyboardView_keyLetterSize:
|
||||||
mKeyTextSize = a.getDimensionPixelSize(attr, 18);
|
mKeyLetterSize = a.getDimensionPixelSize(attr, 18);
|
||||||
break;
|
break;
|
||||||
case R.styleable.BaseKeyboardView_keyTextColor:
|
case R.styleable.BaseKeyboardView_keyTextColor:
|
||||||
mKeyTextColor = a.getColor(attr, 0xFF000000);
|
mKeyTextColor = a.getColor(attr, 0xFF000000);
|
||||||
break;
|
break;
|
||||||
|
case R.styleable.BaseKeyboardView_keyTextColorDisabled:
|
||||||
|
mKeyTextColorDisabled = a.getColor(attr, 0xFF000000);
|
||||||
|
break;
|
||||||
case R.styleable.BaseKeyboardView_labelTextSize:
|
case R.styleable.BaseKeyboardView_labelTextSize:
|
||||||
mLabelTextSize = a.getDimensionPixelSize(attr, 14);
|
mLabelTextSize = a.getDimensionPixelSize(attr, 14);
|
||||||
break;
|
break;
|
||||||
|
@ -477,20 +481,8 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
case R.styleable.BaseKeyboardView_backgroundDimAmount:
|
case R.styleable.BaseKeyboardView_backgroundDimAmount:
|
||||||
mBackgroundDimAmount = a.getFloat(attr, 0.5f);
|
mBackgroundDimAmount = a.getFloat(attr, 0.5f);
|
||||||
break;
|
break;
|
||||||
//case android.R.styleable.
|
case R.styleable.BaseKeyboardView_keyLetterStyle:
|
||||||
case R.styleable.BaseKeyboardView_keyTextStyle:
|
mKeyLetterStyle = Typeface.defaultFromStyle(a.getInt(attr, Typeface.NORMAL));
|
||||||
int textStyle = a.getInt(attr, 0);
|
|
||||||
switch (textStyle) {
|
|
||||||
case 0:
|
|
||||||
mKeyTextStyle = Typeface.DEFAULT;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
mKeyTextStyle = Typeface.DEFAULT_BOLD;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mKeyTextStyle = Typeface.defaultFromStyle(textStyle);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case R.styleable.BaseKeyboardView_colorScheme:
|
case R.styleable.BaseKeyboardView_colorScheme:
|
||||||
mColorScheme = a.getInt(attr, COLOR_SCHEME_WHITE);
|
mColorScheme = a.getInt(attr, COLOR_SCHEME_WHITE);
|
||||||
|
@ -787,7 +779,6 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
final boolean isManualTemporaryUpperCase = (mKeyboard instanceof LatinKeyboard
|
final boolean isManualTemporaryUpperCase = (mKeyboard instanceof LatinKeyboard
|
||||||
&& ((LatinKeyboard)mKeyboard).isManualTemporaryUpperCase());
|
&& ((LatinKeyboard)mKeyboard).isManualTemporaryUpperCase());
|
||||||
|
|
||||||
paint.setColor(mKeyTextColor);
|
|
||||||
boolean drawSingleKey = false;
|
boolean drawSingleKey = false;
|
||||||
if (invalidKey != null && canvas.getClipBounds(clipRegion)) {
|
if (invalidKey != null && canvas.getClipBounds(clipRegion)) {
|
||||||
// TODO we should use Rect.inset and Rect.contains here.
|
// TODO we should use Rect.inset and Rect.contains here.
|
||||||
|
@ -820,7 +811,6 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
keyBackground.draw(canvas);
|
keyBackground.draw(canvas);
|
||||||
|
|
||||||
final int rowHeight = padding.top + key.height;
|
final int rowHeight = padding.top + key.height;
|
||||||
boolean drawHintIcon = true;
|
|
||||||
// Draw key label
|
// Draw key label
|
||||||
if (label != null) {
|
if (label != null) {
|
||||||
// For characters, use large font. For labels like "Done", use small font.
|
// For characters, use large font. For labels like "Done", use small font.
|
||||||
|
@ -858,6 +848,11 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
if (DEBUG_SHOW_ALIGN && label.length() > 1)
|
if (DEBUG_SHOW_ALIGN && label.length() > 1)
|
||||||
drawVerticalLine(canvas, positionX, rowHeight, 0xc0008080, new Paint());
|
drawVerticalLine(canvas, positionX, rowHeight, 0xc0008080, new Paint());
|
||||||
}
|
}
|
||||||
|
if (key.manualTemporaryUpperCaseHintIcon != null && isManualTemporaryUpperCase) {
|
||||||
|
paint.setColor(mKeyTextColorDisabled);
|
||||||
|
} else {
|
||||||
|
paint.setColor(mKeyTextColor);
|
||||||
|
}
|
||||||
// Set a drop shadow for the text
|
// Set a drop shadow for the text
|
||||||
paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor);
|
paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor);
|
||||||
canvas.drawText(label, positionX, baseline, paint);
|
canvas.drawText(label, positionX, baseline, paint);
|
||||||
|
@ -892,7 +887,7 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
|
drawRectangle(canvas, drawableX, drawableY, drawableWidth, drawableHeight,
|
||||||
0x80c00000, new Paint());
|
0x80c00000, new Paint());
|
||||||
}
|
}
|
||||||
if (key.hintIcon != null && drawHintIcon) {
|
if (key.hintIcon != null) {
|
||||||
final int drawableWidth = key.width;
|
final int drawableWidth = key.width;
|
||||||
final int drawableHeight = key.height;
|
final int drawableHeight = key.height;
|
||||||
final int drawableX = 0;
|
final int drawableX = 0;
|
||||||
|
@ -954,18 +949,20 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
private int getLabelSizeAndSetPaint(CharSequence label, Key key, Paint paint) {
|
private int getLabelSizeAndSetPaint(CharSequence label, Key key, Paint paint) {
|
||||||
// For characters, use large font. For labels like "Done", use small font.
|
// For characters, use large font. For labels like "Done", use small font.
|
||||||
final int labelSize;
|
final int labelSize;
|
||||||
|
final Typeface labelStyle;
|
||||||
if (label.length() > 1 && key.codes.length < 2) {
|
if (label.length() > 1 && key.codes.length < 2) {
|
||||||
labelSize = mLabelTextSize;
|
labelSize = mLabelTextSize;
|
||||||
if ((key.labelOption & KEY_LABEL_OPTION_FONT_NORMAL) != 0) {
|
if ((key.labelOption & KEY_LABEL_OPTION_FONT_NORMAL) != 0) {
|
||||||
paint.setTypeface(Typeface.DEFAULT);
|
labelStyle = Typeface.DEFAULT;
|
||||||
} else {
|
} else {
|
||||||
paint.setTypeface(Typeface.DEFAULT_BOLD);
|
labelStyle = Typeface.DEFAULT_BOLD;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
labelSize = mKeyTextSize;
|
labelSize = mKeyLetterSize;
|
||||||
paint.setTypeface(mKeyTextStyle);
|
labelStyle = mKeyLetterStyle;
|
||||||
}
|
}
|
||||||
paint.setTextSize(labelSize);
|
paint.setTextSize(labelSize);
|
||||||
|
paint.setTypeface(labelStyle);
|
||||||
return labelSize;
|
return labelSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,11 +1058,11 @@ public class BaseKeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
mPreviewText.setCompoundDrawables(null, null, null, null);
|
mPreviewText.setCompoundDrawables(null, null, null, null);
|
||||||
mPreviewText.setText(adjustCase(tracker.getPreviewText(key)));
|
mPreviewText.setText(adjustCase(tracker.getPreviewText(key)));
|
||||||
if (key.label.length() > 1 && key.codes.length < 2) {
|
if (key.label.length() > 1 && key.codes.length < 2) {
|
||||||
mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyTextSize);
|
mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyLetterSize);
|
||||||
mPreviewText.setTypeface(Typeface.DEFAULT_BOLD);
|
mPreviewText.setTypeface(Typeface.DEFAULT_BOLD);
|
||||||
} else {
|
} else {
|
||||||
mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge);
|
mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge);
|
||||||
mPreviewText.setTypeface(mKeyTextStyle);
|
mPreviewText.setTypeface(mKeyLetterStyle);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mPreviewText.setCompoundDrawables(null, null, null,
|
mPreviewText.setCompoundDrawables(null, null, null,
|
||||||
|
|
Loading…
Reference in New Issue