Remove reference to system theme
This change also introduces * Background for space key preview * Tune stone theme Change-Id: I84fca0baf2392582da870d2ff77b3e99c28faf7b
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 729 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 790 B After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1,008 B |
|
@ -24,5 +24,4 @@
|
|||
android:textSize="40sp"
|
||||
android:minWidth="32dip"
|
||||
android:gravity="center"
|
||||
style="?attr/keyPreviewStyle"
|
||||
/>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<attr name="latinKeyboardStyle" format="reference" />
|
||||
<!-- KeyboardView style -->
|
||||
<attr name="keyboardViewStyle" format="reference" />
|
||||
<attr name="keyPreviewStyle" format="reference" />
|
||||
<!-- PopupMiniKeyboardView style -->
|
||||
<attr name="popupMiniKeyboardViewStyle" format="reference" />
|
||||
<attr name="popupMiniKeyboardPanelStyle" format="reference" />
|
||||
|
@ -70,6 +69,12 @@
|
|||
|
||||
<!-- Layout resource for key press feedback.-->
|
||||
<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. -->
|
||||
<attr name="keyPreviewOffset" format="dimension" />
|
||||
<!-- Height of the key press feedback popup. -->
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
<dimen name="popup_key_height">0.330in</dimen>
|
||||
<dimen name="keyboard_top_padding">0.00in</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="mini_keyboard_horizontal_padding">16dip</dimen>
|
||||
<dimen name="mini_keyboard_key_horizontal_padding">8dip</dimen>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<style name="KeyboardIcons.Black" parent="android:Theme.Light">
|
||||
<style name="KeyboardIcons.Black">
|
||||
<!-- Keyboard icons -->
|
||||
<item name="iconShiftKey">@drawable/sym_bkeyboard_shift</item>
|
||||
<item name="iconToSymbolKeyWithShortcut">@drawable/sym_bkeyboard_123_mic</item>
|
||||
|
@ -34,8 +34,8 @@
|
|||
<!-- LatinKeyboard icons -->
|
||||
<item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led</item>
|
||||
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
|
||||
<item name="spacebarArrowLeftIcon">@drawable/sym_keyboard_language_arrows_left</item>
|
||||
<item name="spacebarArrowRightIcon">@drawable/sym_keyboard_language_arrows_right</item>
|
||||
<item name="spacebarArrowLeftIcon">@null</item>
|
||||
<item name="spacebarArrowRightIcon">@null</item>
|
||||
<item name="spacebarArrowPreviewLeftIcon">@drawable/sym_keyboard_feedback_language_arrows_left</item>
|
||||
<item name="spacebarArrowPreviewRightIcon">@drawable/sym_keyboard_feedback_language_arrows_right</item>
|
||||
</style>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<style name="KeyboardIcons.IceCreamSandwich" parent="android:Theme.Holo">
|
||||
<style name="KeyboardIcons.IceCreamSandwich">
|
||||
<!-- Keyboard icons -->
|
||||
<!-- TODO: The following holo icon for phone (drawable-hdpi and drawable-xhdpi) are too
|
||||
large for phone.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<style name="KeyboardIcons" parent="android:Theme">
|
||||
<style name="KeyboardIcons">
|
||||
<!-- Keyboard icons -->
|
||||
<item name="iconShiftKey">@drawable/sym_keyboard_shift</item>
|
||||
<item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic</item>
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
<item name="keyUppercaseLetterActivatedColor">#CCE0E4E5</item>
|
||||
<item name="keyPopupHintIcon">@drawable/hint_popup</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="keyPreviewHeight">@dimen/key_preview_height</item>
|
||||
<item name="keyPreviewTextRatio">@fraction/key_preview_text_ratio</item>
|
||||
|
@ -61,10 +64,6 @@
|
|||
<item name="shadowRadius">2.75</item>
|
||||
<item name="backgroundDimAmount">0.5</item>
|
||||
</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">
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key_popup</item>
|
||||
<item name="keyHysteresisDistance">0dip</item>
|
||||
|
@ -99,18 +98,18 @@
|
|||
</style>
|
||||
<!-- Theme "Stone" -->
|
||||
<style name="Keyboard.Stone" parent="Keyboard">
|
||||
<item name="horizontalGap">@dimen/key_horizontal_gap_stone</item>
|
||||
<item name="verticalGap">@dimen/key_bottom_gap_stone</item>
|
||||
<item name="horizontalGap">@dimen/key_horizontal_gap</item>
|
||||
<item name="verticalGap">@dimen/key_bottom_gap</item>
|
||||
</style>
|
||||
<style name="LatinKeyboard.Stone" parent="LatinKeyboard">
|
||||
<item name="spacebarTextColor">#FF444444</item>
|
||||
<item name="spacebarTextShadowColor">#80FFFFFF</item>
|
||||
<item name="spacebarTextColor">#FF000000</item>
|
||||
<item name="spacebarTextShadowColor">#D0FFFFFF</item>
|
||||
</style>
|
||||
<style name="KeyboardView.Stone" parent="KeyboardView">
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key_stone</item>
|
||||
<item name="keyTextColor">#FF000000</item>
|
||||
<item name="keyTextInactivatedColor">#FF808080</item>
|
||||
<item name="keyHintLetterColor">#80FFFFFF</item>
|
||||
<item name="keyHintLetterColor">#80000000</item>
|
||||
<item name="keyHintLabelColor">#E0000000</item>
|
||||
<item name="keyUppercaseLetterInactivatedColor">#66000000</item>
|
||||
<item name="keyUppercaseLetterActivatedColor">#CC000000</item>
|
||||
|
@ -153,14 +152,14 @@
|
|||
<item name="keyHintLabelColor">#A0FFFFFF</item>
|
||||
<item name="keyUppercaseLetterInactivatedColor">#66E0E4E5</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="keyPreviewOffset">@dimen/key_preview_offset_ics</item>
|
||||
<item name="shadowColor">#00000000</item>
|
||||
<item name="shadowRadius">0.0</item>
|
||||
</style>
|
||||
<style name="KeyPreviewStyle.IceCreamSandwich">
|
||||
<item name="android:background">@drawable/keyboard_key_feedback_ics</item>
|
||||
</style>
|
||||
<style name="PopupMiniKeyboardView.IceCreamSandwich" parent="PopupMiniKeyboardView">
|
||||
<item name="android:background">@null</item>
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<item name="keyboardStyle">@style/Keyboard</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
|
||||
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
|
||||
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
|
||||
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<item name="keyboardStyle">@style/Keyboard</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView</item>
|
||||
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
|
||||
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView</item>
|
||||
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<item name="keyboardStyle">@style/Keyboard</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
|
||||
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
|
||||
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Gingerbread</item>
|
||||
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<item name="keyboardStyle">@style/Keyboard.IceCreamSandwich</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard.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="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle.IceCreamSandwich</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<item name="keyboardStyle">@style/Keyboard.Stone</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
|
||||
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
|
||||
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
|
||||
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<item name="keyboardStyle">@style/Keyboard.Stone</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
|
||||
<item name="keyPreviewStyle">@style/KeyPreviewStyle</item>
|
||||
<item name="popupMiniKeyboardViewStyle">@style/PopupMiniKeyboardView.Stone</item>
|
||||
<item name="popupMiniKeyboardPanelStyle">@style/PopupMiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
|
|
@ -118,6 +118,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
|||
private final float mBackgroundDimAmount;
|
||||
private final float mKeyHysteresisDistance;
|
||||
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 mPreviewHeight;
|
||||
private final int mPopupLayout;
|
||||
|
@ -138,9 +142,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
|||
|
||||
// Key preview
|
||||
private boolean mInForeground;
|
||||
private TextView mPreviewText;
|
||||
private Drawable mPreviewBackground;
|
||||
private float mPreviewTextRatio;
|
||||
private final TextView mPreviewText;
|
||||
private int mPreviewTextSize;
|
||||
private boolean mShowKeyPreviewPopup = true;
|
||||
private final int mDelayBeforePreview;
|
||||
|
@ -342,7 +344,18 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
|||
R.styleable.KeyboardView_keyHysteresisDistance, 0);
|
||||
mVerticalCorrection = a.getDimensionPixelOffset(
|
||||
R.styleable.KeyboardView_verticalCorrection, 0);
|
||||
mPreviewTextColor = a.getColor(R.styleable.KeyboardView_keyPreviewTextColor, 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);
|
||||
mPreviewHeight = a.getDimensionPixelSize(R.styleable.KeyboardView_keyPreviewHeight, 80);
|
||||
mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio);
|
||||
|
@ -374,12 +387,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
|||
|
||||
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);
|
||||
mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview);
|
||||
mKeyLabelHorizontalPadding = (int)res.getDimension(
|
||||
|
@ -1010,7 +1017,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
|||
previewText.setText(null);
|
||||
}
|
||||
if (key.mCode == Keyboard.CODE_SPACE) {
|
||||
previewText.setBackgroundColor(Color.TRANSPARENT);
|
||||
previewText.setBackgroundDrawable(mPreviewSpacebarBackground);
|
||||
} else {
|
||||
previewText.setBackgroundDrawable(mPreviewBackground);
|
||||
}
|
||||
|
|
|
@ -216,8 +216,12 @@ public class LatinKeyboard extends Keyboard {
|
|||
// Layout local language name and left and right arrow on spacebar.
|
||||
private static String layoutSpacebar(Paint paint, Locale locale, Drawable icon, Drawable lArrow,
|
||||
Drawable rArrow, int width, int height, float origTextSize) {
|
||||
final float arrowWidth = lArrow.getIntrinsicWidth();
|
||||
final float arrowHeight = lArrow.getIntrinsicHeight();
|
||||
final float arrowWidth;
|
||||
if (lArrow != null && rArrow != null) {
|
||||
arrowWidth = lArrow.getIntrinsicWidth();
|
||||
} else {
|
||||
arrowWidth = 0;
|
||||
}
|
||||
final float maxTextWidth = width - (arrowWidth + arrowWidth);
|
||||
final Rect bounds = new Rect();
|
||||
|
||||
|
@ -251,14 +255,17 @@ public class LatinKeyboard extends Keyboard {
|
|||
paint.setTextSize(textSize);
|
||||
|
||||
// Place left and right arrow just before and after language text.
|
||||
final float textHeight = -paint.ascent() + paint.descent();
|
||||
final float baseline = (icon != null) ? height * SPACEBAR_LANGUAGE_BASELINE
|
||||
: height / 2 + textHeight / 2;
|
||||
final int top = (int)(baseline - arrowHeight);
|
||||
final float remains = (width - textWidth) / 2;
|
||||
lArrow.setBounds((int)(remains - arrowWidth), top, (int)remains, (int)baseline);
|
||||
rArrow.setBounds((int)(remains + textWidth), top, (int)(remains + textWidth + arrowWidth),
|
||||
(int)baseline);
|
||||
if (lArrow != null && rArrow != null) {
|
||||
final float textHeight = -paint.ascent() + paint.descent();
|
||||
final float baseline = (icon != null) ? height * SPACEBAR_LANGUAGE_BASELINE
|
||||
: height / 2 + textHeight / 2;
|
||||
final int arrowHeight = lArrow.getIntrinsicHeight();
|
||||
final int top = (int)(baseline - arrowHeight);
|
||||
final float remains = (width - textWidth) / 2;
|
||||
lArrow.setBounds((int)(remains - arrowWidth), top, (int)remains, (int)baseline);
|
||||
rArrow.setBounds((int)(remains + textWidth), top,
|
||||
(int)(remains + textWidth + arrowWidth), (int)baseline);
|
||||
}
|
||||
|
||||
return language;
|
||||
}
|
||||
|
@ -323,7 +330,8 @@ public class LatinKeyboard extends Keyboard {
|
|||
// 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.
|
||||
// TODO: Sort out how to enable language switch on these layouts.
|
||||
if (mSubtypeSwitcher.useSpacebarLanguageSwitcher()
|
||||
if (mSpacebarArrowLeftIcon != null && mSpacebarArrowRightIcon != null
|
||||
&& mSubtypeSwitcher.useSpacebarLanguageSwitcher()
|
||||
&& mSubtypeSwitcher.getEnabledKeyboardLocaleCount() > 1
|
||||
&& !(isPhoneKeyboard() || isNumberKeyboard())) {
|
||||
mSpacebarArrowLeftIcon.setColorFilter(getSpacebarDrawableFilter(textFadeFactor));
|
||||
|
|
|
@ -70,12 +70,15 @@ public class SlidingLocaleDrawable extends Drawable {
|
|||
mTextPaint = textPaint;
|
||||
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);
|
||||
mSpacebarTextColor = a.getColor(R.styleable.LatinKeyboard_spacebarTextColor, 0);
|
||||
mLeftDrawable = a.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewLeftIcon);
|
||||
mRightDrawable = a.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewRightIcon);
|
||||
a.recycle();
|
||||
mLeftDrawable = lka.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewLeftIcon);
|
||||
mRightDrawable = lka.getDrawable(R.styleable.LatinKeyboard_spacebarArrowPreviewRightIcon);
|
||||
lka.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();
|
||||
}
|
||||
|
|