diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 003b011f3af600feccc529f6b9ada586adc52c0e..9a2227321d1786eb45a76ad3de6d633d74f9dd2c 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -52,7 +52,9 @@ <attr name="spacebarIconWidthRatio" format="float" /> <!-- 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.--> + <!-- Popup hint letter string--> + <attr name="keyPopupHintLetter" format="string" /> + <!-- Bottom padding of popup hint letter to the edge of the key.--> <attr name="keyPopupHintLetterPadding" format="dimension" /> <!-- Right padding of shifted letter hint to the edge of the key.--> <attr name="keyShiftedLetterHintPadding" format="dimension" /> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 6118ce17798fa313a26326d8c6ff329fb6051aac..a6f390cbbd468028a540c0862e45145e518e29d7 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -60,6 +60,8 @@ <item name="keyPreviewTextColor">@color/key_text_color_holo</item> <!-- A negative value to disable key text shadow layer. --> <item name="keyTextShadowRadius">-1.0</item> + <!-- U+2026: "…" HORIZONTAL ELLIPSIS --> + <item name="keyPopupHintLetter">…</item> </style> <style name="MainKeyboardView.ICS" diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml index 193386062d3de0f4db7d8f2882da7ad695323004..8782a76aaba097237d6c86ef63d49c6965d1bc3a 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -60,6 +60,8 @@ <item name="keyPreviewTextColor">@color/key_text_color_holo</item> <!-- A negative value to disable key text shadow layer. --> <item name="keyTextShadowRadius">-1.0</item> + <!-- U+2026: "…" HORIZONTAL ELLIPSIS --> + <item name="keyPopupHintLetter">…</item> </style> <style name="MainKeyboardView.KLP" diff --git a/java/res/values/themes-lxx-dark.xml b/java/res/values/themes-lxx-dark.xml index 0a13158588ea9b9c56fc2eeeb7bf0eceb14b71ef..fa6aa62e5aa9301fc8523658e0bb1ed13a43615f 100644 --- a/java/res/values/themes-lxx-dark.xml +++ b/java/res/values/themes-lxx-dark.xml @@ -61,6 +61,7 @@ <item name="keyPreviewTextColor">@color/key_text_color_lxx_dark</item> <!-- A negative value to disable key text shadow layer. --> <item name="keyTextShadowRadius">-1.0</item> + <item name="keyPopupHintLetter"></item> <!-- No popup hint letter --> </style> <style name="MainKeyboardView.LXX_Dark" diff --git a/java/res/values/themes-lxx-light.xml b/java/res/values/themes-lxx-light.xml index eccecdd8761f513b8903ea9af688b16c70d43088..e7350f924fb777212d2bf86d3956f9b9dce10325 100644 --- a/java/res/values/themes-lxx-light.xml +++ b/java/res/values/themes-lxx-light.xml @@ -61,6 +61,7 @@ <item name="keyPreviewTextColor">@color/key_text_color_lxx_light</item> <!-- A negative value to disable key text shadow layer. --> <item name="keyTextShadowRadius">-1.0</item> + <item name="keyPopupHintLetter"></item> <!-- No popup hint letter --> </style> <style name="MainKeyboardView.LXX_Light" diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index f967f620a5c17e5e4a395834eedfba229feac82f..5af0be64955a89254392950a7faba2021ef63a5c 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -29,6 +29,7 @@ import android.graphics.Region; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; +import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; @@ -48,6 +49,7 @@ import java.util.HashSet; * @attr ref R.styleable#KeyboardView_spacebarBackground * @attr ref R.styleable#KeyboardView_spacebarIconWidthRatio * @attr ref R.styleable#KeyboardView_keyHintLetterPadding + * @attr ref R.styleable#KeyboardView_keyPopupHintLetter * @attr ref R.styleable#KeyboardView_keyPopupHintLetterPadding * @attr ref R.styleable#KeyboardView_keyShiftedLetterHintPadding * @attr ref R.styleable#KeyboardView_keyTextShadowRadius @@ -74,6 +76,7 @@ public class KeyboardView extends View { // XML attributes private final KeyVisualAttributes mKeyVisualAttributes; private final float mKeyHintLetterPadding; + private final String mKeyPopupHintLetter; private final float mKeyPopupHintLetterPadding; private final float mKeyShiftedLetterHintPadding; private final float mKeyTextShadowRadius; @@ -85,9 +88,6 @@ public class KeyboardView extends View { private final Rect mKeyBackgroundPadding = new Rect(); private static final float KET_TEXT_SHADOW_RADIUS_DISABLED = -1.0f; - // HORIZONTAL ELLIPSIS "...", character for popup hint. - private static final String POPUP_HINT_CHAR = "\u2026"; - // The maximum key label width in the proportion to the key width. private static final float MAX_LABEL_RATIO = 0.90f; @@ -132,6 +132,8 @@ public class KeyboardView extends View { R.styleable.KeyboardView_spacebarIconWidthRatio, 1.0f); mKeyHintLetterPadding = keyboardViewAttr.getDimension( R.styleable.KeyboardView_keyHintLetterPadding, 0.0f); + mKeyPopupHintLetter = keyboardViewAttr.getString( + R.styleable.KeyboardView_keyPopupHintLetter); mKeyPopupHintLetterPadding = keyboardViewAttr.getDimension( R.styleable.KeyboardView_keyPopupHintLetterPadding, 0.0f); mKeyShiftedLetterHintPadding = keyboardViewAttr.getDimension( @@ -468,6 +470,9 @@ public class KeyboardView extends View { // Draw popup hint "..." at the bottom right corner of the key. protected void drawKeyPopupHint(final Key key, final Canvas canvas, final Paint paint, final KeyDrawParams params) { + if (TextUtils.isEmpty(mKeyPopupHintLetter)) { + return; + } final int keyWidth = key.getDrawWidth(); final int keyHeight = key.getHeight(); @@ -478,7 +483,7 @@ public class KeyboardView extends View { final float hintX = keyWidth - mKeyHintLetterPadding - TypefaceUtils.getReferenceCharWidth(paint) / 2.0f; final float hintY = keyHeight - mKeyPopupHintLetterPadding; - canvas.drawText(POPUP_HINT_CHAR, hintX, hintY, paint); + canvas.drawText(mKeyPopupHintLetter, hintX, hintY, paint); } protected static void drawIcon(final Canvas canvas, final Drawable icon, final int x,