Merge remote-tracking branch 'goog/master' into HEAD

Conflicts:
	java/res/values/keyboard-icons-ics.xml

Change-Id: I8b9b0758a81efd984cc9af52280ef75a807cd991
main
satok 2011-06-27 22:47:11 +09:00
commit b2d1967e1c
30 changed files with 66 additions and 53 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1008 B

View File

@ -24,5 +24,4 @@
android:textSize="40sp" android:textSize="40sp"
android:minWidth="32dip" android:minWidth="32dip"
android:gravity="center" android:gravity="center"
style="?attr/keyPreviewStyle"
/> />

View File

@ -22,7 +22,6 @@
<attr name="latinKeyboardStyle" format="reference" /> <attr name="latinKeyboardStyle" format="reference" />
<!-- KeyboardView style --> <!-- KeyboardView style -->
<attr name="keyboardViewStyle" format="reference" /> <attr name="keyboardViewStyle" format="reference" />
<attr name="keyPreviewStyle" format="reference" />
<!-- PopupMiniKeyboardView style --> <!-- PopupMiniKeyboardView style -->
<attr name="popupMiniKeyboardViewStyle" format="reference" /> <attr name="popupMiniKeyboardViewStyle" format="reference" />
<attr name="popupMiniKeyboardPanelStyle" format="reference" /> <attr name="popupMiniKeyboardPanelStyle" format="reference" />
@ -70,6 +69,12 @@
<!-- 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. -->
<attr name="keyPreviewBackground" format="reference" />
<!-- The background for spacebar press feedback. -->
<attr name="keyPreviewSpacebarBackground" 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. -->

View File

@ -30,8 +30,6 @@
<dimen name="popup_key_height">0.330in</dimen> <dimen name="popup_key_height">0.330in</dimen>
<dimen name="keyboard_top_padding">0.00in</dimen> <dimen name="keyboard_top_padding">0.00in</dimen>
<dimen name="keyboard_bottom_padding">0.06in</dimen> <dimen name="keyboard_bottom_padding">0.06in</dimen>
<dimen name="key_bottom_gap_stone">0.00in</dimen>
<dimen name="key_horizontal_gap_stone">0.00in</dimen>
<dimen name="keyboard_horizontal_edges_padding">0.0in</dimen> <dimen name="keyboard_horizontal_edges_padding">0.0in</dimen>
<dimen name="mini_keyboard_horizontal_padding">16dip</dimen> <dimen name="mini_keyboard_horizontal_padding">16dip</dimen>
<dimen name="mini_keyboard_key_horizontal_padding">8dip</dimen> <dimen name="mini_keyboard_key_horizontal_padding">8dip</dimen>

View File

@ -15,7 +15,7 @@
--> -->
<resources> <resources>
<style name="KeyboardIcons.Black" parent="android:Theme.Light"> <style name="KeyboardIcons.Black">
<!-- Keyboard icons --> <!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_bkeyboard_shift</item> <item name="iconShiftKey">@drawable/sym_bkeyboard_shift</item>
<item name="iconToSymbolKeyWithShortcut">@drawable/sym_bkeyboard_123_mic</item> <item name="iconToSymbolKeyWithShortcut">@drawable/sym_bkeyboard_123_mic</item>
@ -34,8 +34,8 @@
<!-- LatinKeyboard icons --> <!-- LatinKeyboard icons -->
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item> <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
<item name="spacebarArrowLeftIcon">@drawable/sym_keyboard_language_arrows_left</item> <item name="spacebarArrowLeftIcon">@null</item>
<item name="spacebarArrowRightIcon">@drawable/sym_keyboard_language_arrows_right</item> <item name="spacebarArrowRightIcon">@null</item>
<item name="spacebarArrowPreviewLeftIcon">@drawable/sym_keyboard_feedback_language_arrows_left</item> <item name="spacebarArrowPreviewLeftIcon">@drawable/sym_keyboard_feedback_language_arrows_left</item>
<item name="spacebarArrowPreviewRightIcon">@drawable/sym_keyboard_feedback_language_arrows_right</item> <item name="spacebarArrowPreviewRightIcon">@drawable/sym_keyboard_feedback_language_arrows_right</item>
</style> </style>

View File

@ -15,7 +15,7 @@
--> -->
<resources> <resources>
<style name="KeyboardIcons.IceCreamSandwich" parent="android:Theme"> <style name="KeyboardIcons.IceCreamSandwich">
<!-- Keyboard icons --> <!-- Keyboard icons -->
<!-- TODO: The following holo icon for phone (drawable-hdpi and drawable-xhdpi) are too <!-- TODO: The following holo icon for phone (drawable-hdpi and drawable-xhdpi) are too
large for phone. large for phone.

View File

@ -15,7 +15,7 @@
--> -->
<resources> <resources>
<style name="KeyboardIcons" parent="android:Theme"> <style name="KeyboardIcons">
<!-- Keyboard icons --> <!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift</item> <item name="iconShiftKey">@drawable/sym_keyboard_shift</item>
<item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic</item> <item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic</item>

View File

@ -51,6 +51,9 @@
<item name="keyUppercaseLetterActivatedColor">#CCE0E4E5</item> <item name="keyUppercaseLetterActivatedColor">#CCE0E4E5</item>
<item name="keyPopupHintIcon">@drawable/hint_popup</item> <item name="keyPopupHintIcon">@drawable/hint_popup</item>
<item name="keyPreviewLayout">@layout/key_preview</item> <item name="keyPreviewLayout">@layout/key_preview</item>
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback</item>
<item name="keyPreviewSpacebarBackground">@drawable/keyboard_key_feedback</item>
<item name="keyPreviewTextColor">#FFFFFFFF</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>
<item name="keyPreviewTextRatio">@fraction/key_preview_text_ratio</item> <item name="keyPreviewTextRatio">@fraction/key_preview_text_ratio</item>
@ -61,10 +64,6 @@
<item name="shadowRadius">2.75</item> <item name="shadowRadius">2.75</item>
<item name="backgroundDimAmount">0.5</item> <item name="backgroundDimAmount">0.5</item>
</style> </style>
<style name="KeyPreviewStyle">
<item name="android:background">@drawable/keyboard_key_feedback</item>
<item name="android:textColor">#FFFFFFFF</item>
</style>
<style name="PopupMiniKeyboardView" parent="KeyboardView"> <style name="PopupMiniKeyboardView" parent="KeyboardView">
<item name="keyBackground">@drawable/btn_keyboard_key_popup</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup</item>
<item name="keyHysteresisDistance">0dip</item> <item name="keyHysteresisDistance">0dip</item>
@ -99,18 +98,18 @@
</style> </style>
<!-- Theme "Stone" --> <!-- Theme "Stone" -->
<style name="Keyboard.Stone" parent="Keyboard"> <style name="Keyboard.Stone" parent="Keyboard">
<item name="horizontalGap">@dimen/key_horizontal_gap_stone</item> <item name="horizontalGap">@dimen/key_horizontal_gap</item>
<item name="verticalGap">@dimen/key_bottom_gap_stone</item> <item name="verticalGap">@dimen/key_bottom_gap</item>
</style> </style>
<style name="LatinKeyboard.Stone" parent="LatinKeyboard"> <style name="LatinKeyboard.Stone" parent="LatinKeyboard">
<item name="spacebarTextColor">#FF444444</item> <item name="spacebarTextColor">#FF000000</item>
<item name="spacebarTextShadowColor">#80FFFFFF</item> <item name="spacebarTextShadowColor">#D0FFFFFF</item>
</style> </style>
<style name="KeyboardView.Stone" parent="KeyboardView"> <style name="KeyboardView.Stone" parent="KeyboardView">
<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="keyTextInactivatedColor">#FF808080</item> <item name="keyTextInactivatedColor">#FF808080</item>
<item name="keyHintLetterColor">#80FFFFFF</item> <item name="keyHintLetterColor">#80000000</item>
<item name="keyHintLabelColor">#E0000000</item> <item name="keyHintLabelColor">#E0000000</item>
<item name="keyUppercaseLetterInactivatedColor">#66000000</item> <item name="keyUppercaseLetterInactivatedColor">#66000000</item>
<item name="keyUppercaseLetterActivatedColor">#CC000000</item> <item name="keyUppercaseLetterActivatedColor">#CC000000</item>
@ -153,14 +152,14 @@
<item name="keyHintLabelColor">#A0FFFFFF</item> <item name="keyHintLabelColor">#A0FFFFFF</item>
<item name="keyUppercaseLetterInactivatedColor">#66E0E4E5</item> <item name="keyUppercaseLetterInactivatedColor">#66E0E4E5</item>
<item name="keyUppercaseLetterActivatedColor">#FFFFFFFF</item> <item name="keyUppercaseLetterActivatedColor">#FFFFFFFF</item>
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_ics</item>
<item name="keyPreviewSpacebarBackground">@drawable/transparent</item>
<item name="keyPreviewTextColor">#FFFFFFFF</item>
<item name="keyPreviewHeight">@dimen/key_preview_height_ics</item> <item name="keyPreviewHeight">@dimen/key_preview_height_ics</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="shadowColor">#00000000</item>
<item name="shadowRadius">0.0</item> <item name="shadowRadius">0.0</item>
</style> </style>
<style name="KeyPreviewStyle.IceCreamSandwich">
<item name="android:background">@drawable/keyboard_key_feedback_ics</item>
</style>
<style name="PopupMiniKeyboardView.IceCreamSandwich" parent="PopupMiniKeyboardView"> <style name="PopupMiniKeyboardView.IceCreamSandwich" parent="PopupMiniKeyboardView">
<item name="android:background">@null</item> <item name="android:background">@null</item>
<item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item> <item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item>

View File

@ -19,7 +19,6 @@
<item name="keyboardStyle">@style/Keyboard</item> <item name="keyboardStyle">@style/Keyboard</item>
<item name="latinKeyboardStyle">@style/LatinKeyboard</item> <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item> <item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>

View File

@ -19,7 +19,6 @@
<item name="keyboardStyle">@style/Keyboard</item> <item name="keyboardStyle">@style/Keyboard</item>
<item name="latinKeyboardStyle">@style/LatinKeyboard</item> <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView</item> <item name="keyboardViewStyle">@style/KeyboardView</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>

View File

@ -19,7 +19,6 @@
<item name="keyboardStyle">@style/Keyboard</item> <item name="keyboardStyle">@style/Keyboard</item>
<item name="latinKeyboardStyle">@style/LatinKeyboard</item> <item name="latinKeyboardStyle">@style/LatinKeyboard</item>
<item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item> <item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>

View File

@ -19,7 +19,6 @@
<item name="keyboardStyle">@style/Keyboard.IceCreamSandwich</item> <item name="keyboardStyle">@style/Keyboard.IceCreamSandwich</item>
<item name="latinKeyboardStyle">@style/LatinKeyboard.IceCreamSandwich</item> <item name="latinKeyboardStyle">@style/LatinKeyboard.IceCreamSandwich</item>
<item name="keyboardViewStyle">@style/KeyboardView.IceCreamSandwich</item> <item name="keyboardViewStyle">@style/KeyboardView.IceCreamSandwich</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle.IceCreamSandwich</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.IceCreamSandwich</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.IceCreamSandwich</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.IceCreamSandwich</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.IceCreamSandwich</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item>

View File

@ -19,7 +19,6 @@
<item name="keyboardStyle">@style/Keyboard.Stone</item> <item name="keyboardStyle">@style/Keyboard.Stone</item>
<item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item> <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
<item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item> <item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>

View File

@ -19,7 +19,6 @@
<item name="keyboardStyle">@style/Keyboard.Stone</item> <item name="keyboardStyle">@style/Keyboard.Stone</item>
<item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item> <item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
<item name="keyboardViewStyle">@style/KeyboardView.Stone</item> <item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item> <item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item> <item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item> <item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>

View File

@ -118,6 +118,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
private final float mBackgroundDimAmount; private final float mBackgroundDimAmount;
private final float mKeyHysteresisDistance; private final float mKeyHysteresisDistance;
private final float mVerticalCorrection; private final float mVerticalCorrection;
private final Drawable mPreviewBackground;
private final Drawable mPreviewSpacebarBackground;
private final int mPreviewTextColor;
private final float mPreviewTextRatio;
private final int mPreviewOffset; private final int mPreviewOffset;
private final int mPreviewHeight; private final int mPreviewHeight;
private final int mPopupLayout; private final int mPopupLayout;
@ -138,9 +142,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// Key preview // Key preview
private boolean mInForeground; private boolean mInForeground;
private TextView mPreviewText; private final TextView mPreviewText;
private Drawable mPreviewBackground;
private float mPreviewTextRatio;
private int mPreviewTextSize; private int mPreviewTextSize;
private boolean mShowKeyPreviewPopup = true; private boolean mShowKeyPreviewPopup = true;
private final int mDelayBeforePreview; private final int mDelayBeforePreview;
@ -342,7 +344,18 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
R.styleable.KeyboardView_keyHysteresisDistance, 0); R.styleable.KeyboardView_keyHysteresisDistance, 0);
mVerticalCorrection = a.getDimensionPixelOffset( mVerticalCorrection = a.getDimensionPixelOffset(
R.styleable.KeyboardView_verticalCorrection, 0); R.styleable.KeyboardView_verticalCorrection, 0);
mPreviewTextColor = a.getColor(R.styleable.KeyboardView_keyPreviewTextColor, 0);
final int previewLayout = a.getResourceId(R.styleable.KeyboardView_keyPreviewLayout, 0); final int previewLayout = a.getResourceId(R.styleable.KeyboardView_keyPreviewLayout, 0);
if (previewLayout != 0) {
mPreviewText = (TextView) LayoutInflater.from(context).inflate(previewLayout, null);
mPreviewText.setTextColor(mPreviewTextColor);
} else {
mPreviewText = null;
mShowKeyPreviewPopup = false;
}
mPreviewBackground = a.getDrawable(R.styleable.KeyboardView_keyPreviewBackground);
mPreviewSpacebarBackground = a.getDrawable(
R.styleable.KeyboardView_keyPreviewSpacebarBackground);
mPreviewOffset = a.getDimensionPixelOffset(R.styleable.KeyboardView_keyPreviewOffset, 0); mPreviewOffset = a.getDimensionPixelOffset(R.styleable.KeyboardView_keyPreviewOffset, 0);
mPreviewHeight = a.getDimensionPixelSize(R.styleable.KeyboardView_keyPreviewHeight, 80); mPreviewHeight = a.getDimensionPixelSize(R.styleable.KeyboardView_keyPreviewHeight, 80);
mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio); mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio);
@ -374,12 +387,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
final Resources res = getResources(); final Resources res = getResources();
if (previewLayout != 0) {
mPreviewText = (TextView) LayoutInflater.from(context).inflate(previewLayout, null);
mPreviewBackground = mPreviewText.getBackground();
} else {
mShowKeyPreviewPopup = false;
}
mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview); mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview);
mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview); mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview);
mKeyLabelHorizontalPadding = (int)res.getDimension( mKeyLabelHorizontalPadding = (int)res.getDimension(
@ -1010,7 +1017,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
previewText.setText(null); previewText.setText(null);
} }
if (key.mCode == Keyboard.CODE_SPACE) { if (key.mCode == Keyboard.CODE_SPACE) {
previewText.setBackgroundColor(Color.TRANSPARENT); previewText.setBackgroundDrawable(mPreviewSpacebarBackground);
} else { } else {
previewText.setBackgroundDrawable(mPreviewBackground); previewText.setBackgroundDrawable(mPreviewBackground);
} }

View File

@ -216,8 +216,12 @@ public class LatinKeyboard extends Keyboard {
// Layout local language name and left and right arrow on spacebar. // Layout local language name and left and right arrow on spacebar.
private static String layoutSpacebar(Paint paint, Locale locale, Drawable icon, Drawable lArrow, private static String layoutSpacebar(Paint paint, Locale locale, Drawable icon, Drawable lArrow,
Drawable rArrow, int width, int height, float origTextSize) { Drawable rArrow, int width, int height, float origTextSize) {
final float arrowWidth = lArrow.getIntrinsicWidth(); final float arrowWidth;
final float arrowHeight = lArrow.getIntrinsicHeight(); if (lArrow != null && rArrow != null) {
arrowWidth = lArrow.getIntrinsicWidth();
} else {
arrowWidth = 0;
}
final float maxTextWidth = width - (arrowWidth + arrowWidth); final float maxTextWidth = width - (arrowWidth + arrowWidth);
final Rect bounds = new Rect(); final Rect bounds = new Rect();
@ -251,14 +255,17 @@ public class LatinKeyboard extends Keyboard {
paint.setTextSize(textSize); paint.setTextSize(textSize);
// Place left and right arrow just before and after language text. // Place left and right arrow just before and after language text.
if (lArrow != null && rArrow != null) {
final float textHeight = -paint.ascent() + paint.descent(); final float textHeight = -paint.ascent() + paint.descent();
final float baseline = (icon != null) ? height * SPACEBAR_LANGUAGE_BASELINE final float baseline = (icon != null) ? height * SPACEBAR_LANGUAGE_BASELINE
: height / 2 + textHeight / 2; : height / 2 + textHeight / 2;
final int arrowHeight = lArrow.getIntrinsicHeight();
final int top = (int)(baseline - arrowHeight); final int top = (int)(baseline - arrowHeight);
final float remains = (width - textWidth) / 2; final float remains = (width - textWidth) / 2;
lArrow.setBounds((int)(remains - arrowWidth), top, (int)remains, (int)baseline); lArrow.setBounds((int)(remains - arrowWidth), top, (int)remains, (int)baseline);
rArrow.setBounds((int)(remains + textWidth), top, (int)(remains + textWidth + arrowWidth), rArrow.setBounds((int)(remains + textWidth), top,
(int)baseline); (int)(remains + textWidth + arrowWidth), (int)baseline);
}
return language; return language;
} }
@ -323,7 +330,8 @@ public class LatinKeyboard extends Keyboard {
// Put arrows that are already laid out on either side of the text // Put arrows that are already laid out on either side of the text
// Because language switch is disabled on phone and number layouts, hide arrows. // Because language switch is disabled on phone and number layouts, hide arrows.
// TODO: Sort out how to enable language switch on these layouts. // TODO: Sort out how to enable language switch on these layouts.
if (mSubtypeSwitcher.useSpacebarLanguageSwitcher() if (mSpacebarArrowLeftIcon != null && mSpacebarArrowRightIcon != null
&& mSubtypeSwitcher.useSpacebarLanguageSwitcher()
&& mSubtypeSwitcher.getEnabledKeyboardLocaleCount() > 1 && mSubtypeSwitcher.getEnabledKeyboardLocaleCount() > 1
&& !(isPhoneKeyboard() || isNumberKeyboard())) { && !(isPhoneKeyboard() || isNumberKeyboard())) {
mSpacebarArrowLeftIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor)); mSpacebarArrowLeftIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor));

View File

@ -70,12 +70,15 @@ public class SlidingLocaleDrawable extends Drawable {
mTextPaint = textPaint; mTextPaint = textPaint;
mMiddleX = (background != null) ? (mWidth - mBackground.getIntrinsicWidth()) / 2 : 0; mMiddleX = (background != null) ? (mWidth - mBackground.getIntrinsicWidth()) / 2 : 0;
final TypedArray a = context.obtainStyledAttributes( final TypedArray lka = context.obtainStyledAttributes(
null, R.styleable.LatinKeyboard, R.attr.latinKeyboardStyle, R.style.LatinKeyboard); null, R.styleable.LatinKeyboard, R.attr.latinKeyboardStyle, R.style.LatinKeyboard);
mSpacebarTextColor = a.getColor(R.styleable.LatinKeyboard_spacebarTextColor, 0); mLeftDrawable = lka.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewLeftIcon);
mLeftDrawable = a.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewLeftIcon); mRightDrawable = lka.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewRightIcon);
mRightDrawable = a.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewRightIcon); lka.recycle();
a.recycle(); final TypedArray kva = context.obtainStyledAttributes(
null, R.styleable.KeyboardView, R.attr.keyboardViewStyle, R.style.KeyboardView);
mSpacebarTextColor = kva.getColor(R.styleable.KeyboardView_keyPreviewTextColor, 0);
kva.recycle();
mThreshold = ViewConfiguration.get(context).getScaledTouchSlop(); mThreshold = ViewConfiguration.get(context).getScaledTouchSlop();
} }