summaryrefslogtreecommitdiff
path: root/java/src/com/android/inputmethod/keyboard/Keyboard.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-06-28 16:32:39 +0900
committerTadashi G. Takaoka <takaoka@google.com>2011-06-29 18:34:57 +0900
commitd773bf38a3c8f49ea56de67d3b828f8126f46ed2 (patch)
treeb402a558ecf37cc1ff6f2bc584abf9a537fee5b6 /java/src/com/android/inputmethod/keyboard/Keyboard.java
parent98d2e4c840e7adf9d5fbb008fb3312914b1ed36b (diff)
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
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/Keyboard.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java15
1 files changed, 12 insertions, 3 deletions
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.