From d773bf38a3c8f49ea56de67d3b828f8126f46ed2 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 28 Jun 2011 16:32:39 +0900 Subject: Cleanup key drawing code This change also modifies 9-patch drawables to fix the following issues. In order to draw key background drawable just on the coordinates we want, we have to know where an actual "visible" part is in the drawable. The only clue we can use is "padding" of the drawable. To achieve this, the 9-patch drawable must have its "visible" part marked as "content". Please refer the Bug: 4948171 for more detailed explanation. This change also reverts the following "black" drawables back from Gingerbread because recent change broke these (I70019a91). * drawable-hdpi/sym_bkeyboard_*.png * drawable-hdpi/btn_keyboard_key_*_stone.9.png Bug: 4948171 Change-Id: I6e4d03b3144caa95c793aac97af22df34c5f454f --- java/src/com/android/inputmethod/keyboard/Keyboard.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'java/src/com/android/inputmethod/keyboard/Keyboard.java') diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 20327c5b2..280c0c9d8 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -19,6 +19,7 @@ package com.android.inputmethod.keyboard; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; +import android.text.TextUtils; import android.util.Log; import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; @@ -345,15 +346,23 @@ public class Keyboard { } public boolean isAlphaKeyboard() { - return mId != null && mId.isAlphabetKeyboard(); + return mId.isAlphabetKeyboard(); } public boolean isPhoneKeyboard() { - return mId != null && mId.isPhoneKeyboard(); + return mId.isPhoneKeyboard(); } public boolean isNumberKeyboard() { - return mId != null && mId.isNumberKeyboard(); + return mId.isNumberKeyboard(); + } + + public CharSequence adjustLabelCase(CharSequence label) { + if (isShiftedOrShiftLocked() && !TextUtils.isEmpty(label) && label.length() < 3 + && Character.isLowerCase(label.charAt(0))) { + return label.toString().toUpperCase(mId.mLocale); + } + return label; } // TODO: Move this function to ProximityInfo and make this private. -- cgit v1.2.3