diff --git a/java/res/values/donottranslate-more-keys.xml b/java/res/values/donottranslate-more-keys.xml index 40d81177f..afce24515 100644 --- a/java/res/values/donottranslate-more-keys.xml +++ b/java/res/values/donottranslate-more-keys.xml @@ -115,6 +115,7 @@ ⁿ,∅ + !fixedColumnOrder!2,!hasLabels!,\@string/label_time_am,\@string/label_time_pm \@icon/settingsKey|\@integer/key_settings , diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index 94da9462f..d6a15deb0 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -58,6 +58,10 @@ *# + + "AM" + + "PM" 0 diff --git a/java/res/xml-sw600dp/rows_number_normal.xml b/java/res/xml-sw600dp/rows_number_normal.xml index 1c38a6265..3704c5284 100644 --- a/java/res/xml-sw600dp/rows_number_normal.xml +++ b/java/res/xml-sw600dp/rows_number_normal.xml @@ -63,10 +63,24 @@ latin:keyLabel="/" latin:keyStyle="numKeyStyle" latin:keyWidth="9.25%p" /> - + + + + + + + + - + + + + + + + + - + + + + + + + + - + + + + + + + + + @@ -91,10 +94,11 @@ latin:keyLabel="9" latin:keyHintLabel="WXYZ" latin:parentStyle="numberKeyStyle" /> - + @@ -108,15 +112,17 @@ latin:code="@integer/key_switch_alpha_symbol" latin:keyLabel="@string/label_to_phone_numeric_key" latin:parentStyle="numModeKeyStyle" /> + + diff --git a/java/res/xml/rows_number_normal.xml b/java/res/xml/rows_number_normal.xml index b581fb5cd..91b1fe989 100644 --- a/java/res/xml/rows_number_normal.xml +++ b/java/res/xml/rows_number_normal.xml @@ -46,10 +46,32 @@ - + + + + + + + + + + + - + + + + + + + + + + + + + + + diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 30ed59e18..c6cdf7986 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -85,8 +85,6 @@ public class Keyboard { public static final int CODE_CLOSING_SQUARE_BRACKET = ']'; public static final int CODE_CLOSING_CURLY_BRACKET = '}'; public static final int CODE_CLOSING_ANGLE_BRACKET = '>'; - public static final int CODE_DIGIT0 = '0'; - public static final int CODE_PLUS = '+'; private static final int MINIMUM_LETTER_CODE = CODE_TAB; /** Special keys code. Must be negative. @@ -184,19 +182,12 @@ public class Keyboard { return null; } - // TODO: Remove this method. - public boolean isShiftLocked() { - return mId.isAlphabetShiftLockedKeyboard(); - } - // TODO: Remove this method. public boolean isShiftedOrShiftLocked() { - return mId.isAlphabetShiftedOrShiftLockedKeyboard(); - } - - // TODO: Remove this method. - public boolean isManualShifted() { - return mId.isAlphabetManualShiftedKeyboard(); + // Alphabet mode have unshifted, manual shifted, automatic shifted, shift locked, and + // shift lock shifted element. So that unshifed element is the only one that is NOT in + // shifted or shift locked state. + return mId.isAlphabetKeyboard() && mId.mElementId != KeyboardId.ELEMENT_ALPHABET; } public static boolean isLetterCode(int code) { diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index ed4a89e0f..f5752962e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -36,6 +36,9 @@ public class KeyboardId { public static final int MODE_IM = 3; public static final int MODE_PHONE = 4; public static final int MODE_NUMBER = 5; + public static final int MODE_DATE = 6; + public static final int MODE_TIME = 7; + public static final int MODE_DATETIME = 8; public static final int ELEMENT_ALPHABET = 0; public static final int ELEMENT_ALPHABET_MANUAL_SHIFTED = 1; @@ -123,31 +126,6 @@ public class KeyboardId { return mElementId < ELEMENT_SYMBOLS; } - public boolean isAlphabetShiftLockedKeyboard() { - return mElementId == ELEMENT_ALPHABET_SHIFT_LOCKED - || mElementId == ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED; - } - - public boolean isAlphabetShiftedOrShiftLockedKeyboard() { - return isAlphabetKeyboard() && mElementId != ELEMENT_ALPHABET; - } - - public boolean isAlphabetManualShiftedKeyboard() { - return mElementId == ELEMENT_ALPHABET_MANUAL_SHIFTED; - } - - public boolean isSymbolsKeyboard() { - return mElementId == ELEMENT_SYMBOLS || mElementId == ELEMENT_SYMBOLS_SHIFTED; - } - - public boolean isPhoneKeyboard() { - return mElementId == ELEMENT_PHONE || mElementId == ELEMENT_PHONE_SYMBOLS; - } - - public boolean isPhoneShiftKeyboard() { - return mElementId == ELEMENT_PHONE_SYMBOLS; - } - public boolean navigateNext() { return EditorInfoCompatUtils.hasFlagNavigateNext(mEditorInfo.imeOptions); } @@ -242,6 +220,9 @@ public class KeyboardId { case MODE_IM: return "im"; case MODE_PHONE: return "phone"; case MODE_NUMBER: return "number"; + case MODE_DATE: return "date"; + case MODE_TIME: return "time"; + case MODE_DATETIME: return "datetime"; default: return null; } } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java index 6e62f743b..ee882edc0 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java @@ -131,6 +131,9 @@ public class KeyboardSet { } break; case KeyboardId.MODE_NUMBER: + case KeyboardId.MODE_DATE: + case KeyboardId.MODE_TIME: + case KeyboardId.MODE_DATETIME: keyboardSetElementId = KeyboardId.ELEMENT_NUMBER; break; default: diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index d65253ede..78e0ee230 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -849,7 +849,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { final KeyPreviewDrawParams params = mKeyPreviewDrawParams; final int keyDrawX = key.mX + key.mVisualInsetsLeft; final int keyDrawWidth = key.mWidth - key.mVisualInsetsLeft - key.mVisualInsetsRight; - // What we show as preview should match what we show on key top in onBufferDraw(). + // What we show as preview should match what we show on a key top in onBufferDraw(). if (key.mLabel != null) { // TODO Should take care of temporaryShiftLabel here. previewText.setCompoundDrawables(null, null, null, null); diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 432959508..89dad7be5 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -481,11 +481,10 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke */ protected boolean onLongPress(Key parentKey, PointerTracker tracker) { final int primaryCode = parentKey.mCode; - final Keyboard keyboard = getKeyboard(); - if (primaryCode == Keyboard.CODE_DIGIT0 && keyboard.mId.isPhoneKeyboard()) { + if (parentKey.mAltCode != Keyboard.CODE_UNSPECIFIED) { + // Long press on a key that has altCode defined. tracker.onLongPressed(); - // Long pressing on 0 in phone number keypad gives you a '+'. - invokeCodeInput(Keyboard.CODE_PLUS); + invokeCodeInput(parentKey.mAltCode); invokeReleaseKey(primaryCode); KeyboardSwitcher.getInstance().hapticAndAudioFeedback(primaryCode); return true; diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 6d63e95f6..47ea9ee8a 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -563,8 +563,16 @@ public class Utils { switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: - case InputType.TYPE_CLASS_DATETIME: return KeyboardId.MODE_NUMBER; + case InputType.TYPE_CLASS_DATETIME: + switch (variation) { + case InputType.TYPE_DATETIME_VARIATION_DATE: + return KeyboardId.MODE_DATE; + case InputType.TYPE_DATETIME_VARIATION_TIME: + return KeyboardId.MODE_TIME; + default: // InputType.TYPE_DATETIME_VARIATION_NORMAL + return KeyboardId.MODE_DATETIME; + } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: