From abd7bba981aa3edb1a71df5eaeba113533764d51 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 23 Sep 2010 12:42:15 +0900 Subject: Disable invoking VoiceIME using swipe right action Bug: 3028268 Change-Id: I4bcf35051d5e82b60bb6a346a80ad6c3c03c31cb --- .../com/android/inputmethod/latin/LatinIME.java | 42 ++++++---------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d9cd7276b..2c0b80961 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -133,12 +133,7 @@ public class LatinIME extends InputMethodService private static final int MSG_START_TUTORIAL = 1; private static final int MSG_UPDATE_SHIFT_STATE = 2; private static final int MSG_VOICE_RESULTS = 3; - private static final int MSG_START_LISTENING_AFTER_SWIPE = 4; - private static final int MSG_UPDATE_OLD_SUGGESTIONS = 5; - - // If we detect a swipe gesture within N ms of typing, then swipe is - // ignored, since it may in fact be two key presses in quick succession. - private static final long MIN_MILLIS_AFTER_TYPING_BEFORE_SWIPE = 1000; + private static final int MSG_UPDATE_OLD_SUGGESTIONS = 4; // How many continuous deletes at which to start deleting at a higher speed. private static final int DELETE_ACCELERATE_AT = 20; @@ -245,7 +240,6 @@ public class LatinIME extends InputMethodService private String mSuggestPuncs; private VoiceInput mVoiceInput; private VoiceResults mVoiceResults = new VoiceResults(); - private long mSwipeTriggerTimeMillis; private boolean mConfigurationChanging; // Keeps track of most recently inserted text (multi-character key) for reverting @@ -339,10 +333,6 @@ public class LatinIME extends InputMethodService case MSG_VOICE_RESULTS: handleVoiceResults(); break; - case MSG_START_LISTENING_AFTER_SWIPE: - if (mLastKeyTime < mSwipeTriggerTimeMillis) { - startListening(true); - } } } }; @@ -2187,21 +2177,6 @@ public class LatinIME extends InputMethodService return mWord.isCapitalized(); } - public void swipeRight() { - if (userHasNotTypedRecently() && VOICE_INSTALLED && mEnableVoice && - fieldCanDoVoice(makeFieldContext())) { - startListening(true /* was a swipe */); - } - - if (LatinKeyboardView.DEBUG_AUTO_PLAY) { - ClipboardManager cm = ((ClipboardManager)getSystemService(CLIPBOARD_SERVICE)); - CharSequence text = cm.getText(); - if (!TextUtils.isEmpty(text)) { - mKeyboardSwitcher.getInputView().startPlaying(text.toString()); - } - } - } - private void toggleLanguage(boolean reset, boolean next) { if (reset) { mLanguageSwitcher.reset(); @@ -2233,6 +2208,16 @@ public class LatinIME extends InputMethodService } } + public void swipeRight() { + if (LatinKeyboardView.DEBUG_AUTO_PLAY) { + ClipboardManager cm = ((ClipboardManager)getSystemService(CLIPBOARD_SERVICE)); + CharSequence text = cm.getText(); + if (!TextUtils.isEmpty(text)) { + mKeyboardSwitcher.getInputView().startPlaying(text.toString()); + } + } + } + public void swipeLeft() { } @@ -2315,11 +2300,6 @@ public class LatinIME extends InputMethodService } } - private boolean userHasNotTypedRecently() { - return (SystemClock.uptimeMillis() - mLastKeyTime) - > MIN_MILLIS_AFTER_TYPING_BEFORE_SWIPE; - } - private void playKeyClick(int primaryCode) { // if mAudioManager is null, we don't have the ringer state yet // mAudioManager will be set by updateRingerMode -- cgit v1.2.3-83-g751a From a96d8a11e84ef9219eb40a815e82ad8a3d852ca5 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 23 Sep 2010 13:06:03 +0900 Subject: Use SystemClock.uptimeMillis() for event time Change-Id: If20f289992f829ae3a0a2a1eb60a4fc9b35c308a --- java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index dafbb669e..eeccb965c 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -33,6 +33,7 @@ import android.inputmethodservice.Keyboard; import android.inputmethodservice.Keyboard.Key; import android.os.Handler; import android.os.Message; +import android.os.SystemClock; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; @@ -1157,7 +1158,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mMiniKeyboardPopup.showAtLocation(this, Gravity.NO_GRAVITY, x, y); // Inject down event on the key to mini keyboard. - long eventTime = System.currentTimeMillis(); + long eventTime = SystemClock.uptimeMillis(); mMiniKeyboardPopupTime = eventTime; MotionEvent downEvent = generateMiniKeyboardMotionEvent(MotionEvent.ACTION_DOWN, popupKey.x + popupKey.width / 2, popupKey.y + popupKey.height / 2, eventTime); -- cgit v1.2.3-83-g751a From d1a8e3088bb6267a31e3351d304796d1507e3af6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 23 Sep 2010 12:31:22 +0900 Subject: Fix ArrayIndexOutOfBoundsException in WordComposer Bug: 3028277 Change-Id: I1c4d8dca4db8a70f851589d1fbd45a16ea1bfc1b --- .../android/inputmethod/latin/WordComposer.java | 26 +++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 6772d53ea..fe4c68576 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -25,14 +25,14 @@ public class WordComposer { /** * The list of unicode values for each keystroke (including surrounding keys) */ - private ArrayList mCodes; + private final ArrayList mCodes; /** * The word chosen from the candidate list, until it is committed. */ private String mPreferredWord; - private StringBuilder mTypedWord; + private final StringBuilder mTypedWord; private int mCapsCount; @@ -116,11 +116,14 @@ public class WordComposer { * Delete the last keystroke as a result of hitting backspace. */ public void deleteLast() { - mCodes.remove(mCodes.size() - 1); - final int lastPos = mTypedWord.length() - 1; - char last = mTypedWord.charAt(lastPos); - mTypedWord.deleteCharAt(lastPos); - if (Character.isUpperCase(last)) mCapsCount--; + final int codesSize = mCodes.size(); + if (codesSize > 0) { + mCodes.remove(codesSize - 1); + final int lastPos = mTypedWord.length() - 1; + char last = mTypedWord.charAt(lastPos); + mTypedWord.deleteCharAt(lastPos); + if (Character.isUpperCase(last)) mCapsCount--; + } } /** @@ -132,15 +135,6 @@ public class WordComposer { if (wordSize == 0) { return null; } -// StringBuffer sb = new StringBuffer(wordSize); -// for (int i = 0; i < wordSize; i++) { -// char c = (char) mCodes.get(i)[0]; -// if (i == 0 && mIsCapitalized) { -// c = Character.toUpperCase(c); -// } -// sb.append(c); -// } -// return sb; return mTypedWord; } -- cgit v1.2.3-83-g751a From 77542988b809fba6a59aa86982eb4d9e4269477e Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 23 Sep 2010 15:53:05 +0900 Subject: Tune left and right padding of popup mini keyboard This change also fix popup window display position calculation. Bug: 3029284 Change-Id: I28bf3e4deb46a428dc8422a3a165183e00608604 --- java/res/layout/keyboard_popup.xml | 2 ++ java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'java/src') diff --git a/java/res/layout/keyboard_popup.xml b/java/res/layout/keyboard_popup.xml index 9a52e2cbd..27388e06b 100644 --- a/java/res/layout/keyboard_popup.xml +++ b/java/res/layout/keyboard_popup.xml @@ -23,6 +23,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:background="@drawable/keyboard_popup_panel_background" + android:paddingLeft="16dip" + android:paddingRight="16dip" > Date: Thu, 23 Sep 2010 20:04:13 +0900 Subject: Fixed popup mini-keyboard position This change reverts I28bf3e4deb46a428dc8422a3a165183e00608604 partly Bug: 3029284 Change-Id: I0701ab9dfa1cfddbecbef3d32e525c0a143fc297 --- java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 92266c5f1..eeccb965c 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -1129,7 +1129,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (isNumberAtLeftmost) { popupX -= container.getPaddingLeft(); } else { - popupX += popupKey.width + container.getPaddingLeft(); + popupX += popupKey.width + getPaddingLeft(); popupX -= container.getMeasuredWidth(); popupX += container.getPaddingRight(); } -- cgit v1.2.3-83-g751a From 1bebdcb4e422c0d9e52833dfd3bc0a8b9e07a266 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 24 Sep 2010 15:46:06 +0900 Subject: Move RingCharBuffer as a singleton in Util Change-Id: I08d09555a99a64038374e62019777d331c48319b --- .../com/android/inputmethod/latin/LatinIME.java | 4 +- .../android/inputmethod/latin/LatinIMEUtil.java | 88 ++++++++++++++++++++++ .../android/inputmethod/latin/LatinImeLogger.java | 2 +- 3 files changed, 92 insertions(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 2c0b80961..696f530d3 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -16,6 +16,7 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.LatinIMEUtil.RingCharBuffer; import com.android.inputmethod.voice.FieldContext; import com.android.inputmethod.voice.SettingsUtil; import com.android.inputmethod.voice.VoiceInput; @@ -1197,7 +1198,8 @@ public class LatinIME extends InputMethodService if (primaryCode != KEYCODE_ENTER) { mJustAddedAutoSpace = false; } - LatinImeLogger.logOnInputChar((char)primaryCode, x, y); + RingCharBuffer.getInstance().push((char)primaryCode, x, y); + LatinImeLogger.logOnInputChar(); if (isWordSeparator(primaryCode)) { handleSeparator(primaryCode); } else { diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java index 34b52845e..85ecaee50 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java +++ b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java @@ -80,4 +80,92 @@ public class LatinIMEUtil { return ((InputMethodManager) context.getSystemService( Context.INPUT_METHOD_SERVICE)).getEnabledInputMethodList().size() > 1; } + + /* package */ static class RingCharBuffer { + private static RingCharBuffer sRingCharBuffer = new RingCharBuffer(); + private static final char PLACEHOLDER_DELIMITER_CHAR = '\uFFFC'; + private static final int INVALID_COORDINATE = -2; + /* package */ static final int BUFSIZE = 20; + private Context mContext; + private boolean mEnabled = false; + private int mEnd = 0; + /* package */ int mLength = 0; + private char[] mCharBuf = new char[BUFSIZE]; + private int[] mXBuf = new int[BUFSIZE]; + private int[] mYBuf = new int[BUFSIZE]; + + private RingCharBuffer() { + } + public static RingCharBuffer getInstance() { + return sRingCharBuffer; + } + public static RingCharBuffer init(Context context, boolean enabled) { + sRingCharBuffer.mContext = context; + sRingCharBuffer.mEnabled = enabled; + return sRingCharBuffer; + } + private int normalize(int in) { + int ret = in % BUFSIZE; + return ret < 0 ? ret + BUFSIZE : ret; + } + public void push(char c, int x, int y) { + if (!mEnabled) return; + mCharBuf[mEnd] = c; + mXBuf[mEnd] = x; + mYBuf[mEnd] = y; + mEnd = normalize(mEnd + 1); + if (mLength < BUFSIZE) { + ++mLength; + } + } + public char pop() { + if (mLength < 1) { + return PLACEHOLDER_DELIMITER_CHAR; + } else { + mEnd = normalize(mEnd - 1); + --mLength; + return mCharBuf[mEnd]; + } + } + public char getLastChar() { + if (mLength < 1) { + return PLACEHOLDER_DELIMITER_CHAR; + } else { + return mCharBuf[normalize(mEnd - 1)]; + } + } + public int getPreviousX(char c, int back) { + int index = normalize(mEnd - 2 - back); + if (mLength <= back + || Character.toLowerCase(c) != Character.toLowerCase(mCharBuf[index])) { + return INVALID_COORDINATE; + } else { + return mXBuf[index]; + } + } + public int getPreviousY(char c, int back) { + int index = normalize(mEnd - 2 - back); + if (mLength <= back + || Character.toLowerCase(c) != Character.toLowerCase(mCharBuf[index])) { + return INVALID_COORDINATE; + } else { + return mYBuf[index]; + } + } + public String getLastString() { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < mLength; ++i) { + char c = mCharBuf[normalize(mEnd - 1 - i)]; + if (!((LatinIME)mContext).isWordSeparator(c)) { + sb.append(c); + } else { + break; + } + } + return sb.reverse().toString(); + } + public void reset() { + mLength = 0; + } + } } diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index 007d0ccdd..6d15d216c 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -50,7 +50,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void logOnDelete() { } - public static void logOnInputChar(char c, int x, int y) { + public static void logOnInputChar() { } public static void logOnException(String metaData, Throwable e) { -- cgit v1.2.3-83-g751a From 0ae817c9aee319584cbb4df5b1fa74bca684eb06 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 16 Sep 2010 14:54:45 +0900 Subject: Add enter/exit animation style to prevew and mini keyboard TODO This animation style API of PopupWindow can be called only in Gingrebread or later. We should refactor this using reflection to be able to be compatible with Froyo. Bug: 3004787 Bug: 2973989 Change-Id: I2abfcc853b1a0af2bccee7bdf5fbd723456b7d34 --- java/res/anim/key_preview_fadein.xml | 29 ++++++++++++++++++++++ java/res/anim/key_preview_fadeout.xml | 29 ++++++++++++++++++++++ java/res/anim/mini_keyboard_fadein.xml | 29 ++++++++++++++++++++++ java/res/anim/mini_keyboard_fadeout.xml | 29 ++++++++++++++++++++++ java/res/values/config.xml | 28 +++++++++++++++++++++ java/res/values/styles.xml | 8 ++++++ .../inputmethod/latin/LatinKeyboardBaseView.java | 27 ++++++++++---------- 7 files changed, 166 insertions(+), 13 deletions(-) create mode 100644 java/res/anim/key_preview_fadein.xml create mode 100644 java/res/anim/key_preview_fadeout.xml create mode 100644 java/res/anim/mini_keyboard_fadein.xml create mode 100644 java/res/anim/mini_keyboard_fadeout.xml create mode 100644 java/res/values/config.xml (limited to 'java/src') diff --git a/java/res/anim/key_preview_fadein.xml b/java/res/anim/key_preview_fadein.xml new file mode 100644 index 000000000..9fad7b9a7 --- /dev/null +++ b/java/res/anim/key_preview_fadein.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/java/res/anim/key_preview_fadeout.xml b/java/res/anim/key_preview_fadeout.xml new file mode 100644 index 000000000..7de5123cd --- /dev/null +++ b/java/res/anim/key_preview_fadeout.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/java/res/anim/mini_keyboard_fadein.xml b/java/res/anim/mini_keyboard_fadein.xml new file mode 100644 index 000000000..9fad7b9a7 --- /dev/null +++ b/java/res/anim/mini_keyboard_fadein.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/java/res/anim/mini_keyboard_fadeout.xml b/java/res/anim/mini_keyboard_fadeout.xml new file mode 100644 index 000000000..7de5123cd --- /dev/null +++ b/java/res/anim/mini_keyboard_fadeout.xml @@ -0,0 +1,29 @@ + + + + + + diff --git a/java/res/values/config.xml b/java/res/values/config.xml new file mode 100644 index 000000000..6e941baaf --- /dev/null +++ b/java/res/values/config.xml @@ -0,0 +1,28 @@ + + + + + 0 + 10 + 0 + 90 + 0 + 100 + diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 60fffe873..5e239482f 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -33,4 +33,12 @@ 0.5 white + + diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index eeccb965c..3761dab14 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -154,8 +154,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } // Timing constants - private static final int DELAY_BEFORE_PREVIEW = 0; - private static final int DELAY_AFTER_PREVIEW = 100; private static final int REPEAT_INTERVAL = PointerTracker.REPEAT_INTERVAL; // Miscellaneous constants @@ -194,6 +192,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private int mPopupPreviewOffsetY; private int mWindowY; private int mPopupPreviewDisplayedY; + private final int mDelayBeforePreview; + private final int mDelayAfterPreview; // Popup mini keyboard private PopupWindow mMiniKeyboardPopup; @@ -255,7 +255,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx showKey(msg.arg1, (PointerTracker)msg.obj); break; case MSG_DISMISS_PREVIEW: - mPreviewText.setVisibility(INVISIBLE); + mPreviewPopup.dismiss(); break; case MSG_REPEAT_KEY: { final PointerTracker tracker = (PointerTracker)msg.obj; @@ -460,6 +460,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } } + final Resources res = getResources(); + mPreviewPopup = new PopupWindow(context); if (previewLayout != 0) { mPreviewText = (TextView) inflate.inflate(previewLayout, null); @@ -470,10 +472,14 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mShowPreview = false; } mPreviewPopup.setTouchable(false); - mMiniKeyboardParent = this; + mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation); + mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview); + mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview); + mMiniKeyboardParent = this; mMiniKeyboardPopup = new PopupWindow(context); mMiniKeyboardPopup.setBackgroundDrawable(null); + mMiniKeyboardPopup.setAnimationStyle(R.style.MiniKeyboardAnimation); mPaint = new Paint(); mPaint.setAntiAlias(true); @@ -485,7 +491,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mMiniKeyboardCache = new HashMap(); mKeyBackground.getPadding(mPadding); - final Resources res = getResources(); mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density); // TODO: Refer frameworks/base/core/res/res/values/config.xml mDisambiguateSwipe = res.getBoolean(R.bool.config_swipeDisambiguation); @@ -657,9 +662,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx public void setPopupOffset(int x, int y) { mPopupPreviewOffsetX = x; mPopupPreviewOffsetY = y; - if (mPreviewPopup.isShowing()) { - mPreviewPopup.dismiss(); - } + mPreviewPopup.dismiss(); } /** @@ -895,9 +898,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx || (hidePreviewOrShowSpaceKeyPreview && isLanguageSwitchEnabled))) { if (keyIndex == NOT_A_KEY) { mHandler.cancelPopupPreview(); - mHandler.dismissPreview(DELAY_AFTER_PREVIEW); + mHandler.dismissPreview(mDelayAfterPreview); } else if (tracker != null) { - mHandler.popupPreview(DELAY_BEFORE_PREVIEW, keyIndex, tracker); + mHandler.popupPreview(mDelayBeforePreview, keyIndex, tracker); } } } @@ -1375,9 +1378,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } public void closing() { - if (mPreviewPopup.isShowing()) { - mPreviewPopup.dismiss(); - } + mPreviewPopup.dismiss(); mHandler.cancelAllMessages(); dismissPopupKeyboard(); -- cgit v1.2.3-83-g751a From 336bc6bfebe8f965572682e5d5f1d66829ee7e17 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Thu, 16 Sep 2010 19:14:13 +0900 Subject: Keep addWordToDictionary from doing disk I/O on main thread bug: 2999524 Change-Id: Id8b04d38079cfa1dadd5955eb7f83085e60eb8e2 --- java/src/com/android/inputmethod/latin/UserDictionary.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/UserDictionary.java b/java/src/com/android/inputmethod/latin/UserDictionary.java index 3315cf6c9..49b95e9aa 100644 --- a/java/src/com/android/inputmethod/latin/UserDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserDictionary.java @@ -89,13 +89,19 @@ public class UserDictionary extends ExpandableDictionary { super.addWord(word, frequency); // Update the user dictionary provider - ContentValues values = new ContentValues(5); + final ContentValues values = new ContentValues(5); values.put(Words.WORD, word); values.put(Words.FREQUENCY, frequency); values.put(Words.LOCALE, mLocale); values.put(Words.APP_ID, 0); - getContext().getContentResolver().insert(Words.CONTENT_URI, values); + final ContentResolver contentResolver = getContext().getContentResolver(); + new Thread("addWord") { + public void run() { + contentResolver.insert(Words.CONTENT_URI, values); + } + }.start(); + // In case the above does a synchronous callback of the change observer setRequiresReload(false); } -- cgit v1.2.3-83-g751a From bf96661d33d0126adb60a48880ceba1ff055d4a4 Mon Sep 17 00:00:00 2001 From: satok Date: Mon, 27 Sep 2010 12:55:21 +0900 Subject: Add Debug Settings Activity Bug:3033472 Change-Id: I311c66ac3c612a30d7da3be8ee35a352f49016ac --- java/AndroidManifest.xml | 6 ++ java/res/values/strings.xml | 4 ++ java/res/xml/prefs.xml | 16 ----- java/res/xml/prefs_for_debug.xml | 45 +++++++++++++ .../com/android/inputmethod/latin/LatinIME.java | 7 +- .../inputmethod/latin/LatinIMEDebugSettings.java | 75 ++++++++++++++++++++++ .../inputmethod/latin/LatinIMESettings.java | 35 ---------- 7 files changed, 136 insertions(+), 52 deletions(-) create mode 100644 java/res/xml/prefs_for_debug.xml create mode 100644 java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java (limited to 'java/src') diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml index 642c717d3..b1e5ec6f6 100755 --- a/java/AndroidManifest.xml +++ b/java/AndroidManifest.xml @@ -26,6 +26,12 @@ + + + + + + diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 56dceef2d..17921ff33 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -372,4 +372,8 @@ keyboard voice + + + Android keyboard Debug settings + Debug Mode diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index a554ad27b..7bcf19334 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -51,14 +51,6 @@ android:defaultValue="true" /> - - - + + + + + + + + + + + diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 696f530d3..4729585f6 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -40,6 +40,7 @@ import android.os.Debug; import android.os.Handler; import android.os.Message; import android.os.SystemClock; +import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.speech.SpeechRecognizer; import android.text.ClipboardManager; @@ -2399,7 +2400,11 @@ public class LatinIME extends InputMethodService launchSettings(LatinIMESettings.class); } - protected void launchSettings(Class settingsClass) { + public void launchDebugSettings() { + launchSettings(LatinIMEDebugSettings.class); + } + + protected void launchSettings (Class settingsClass) { handleClose(); Intent intent = new Intent(); intent.setClass(LatinIME.this, settingsClass); diff --git a/java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java b/java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java new file mode 100644 index 000000000..cba1a0af9 --- /dev/null +++ b/java/src/com/android/inputmethod/latin/LatinIMEDebugSettings.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.android.inputmethod.latin; + +import android.content.SharedPreferences; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager.NameNotFoundException; +import android.os.Bundle; +import android.preference.CheckBoxPreference; +import android.preference.PreferenceActivity; +import android.util.Log; + +public class LatinIMEDebugSettings extends PreferenceActivity + implements SharedPreferences.OnSharedPreferenceChangeListener { + + private static final String TAG = "LatinIMEDebugSettings"; + private static final String DEBUG_MODE_KEY = "debug_mode"; + + private CheckBoxPreference mDebugMode; + + @Override + protected void onCreate(Bundle icicle) { + super.onCreate(icicle); + addPreferencesFromResource(R.xml.prefs_for_debug); + SharedPreferences prefs = getPreferenceManager().getSharedPreferences(); + prefs.registerOnSharedPreferenceChangeListener(this); + + mDebugMode = (CheckBoxPreference) findPreference(DEBUG_MODE_KEY); + updateDebugMode(); + } + + public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { + if (key.equals(DEBUG_MODE_KEY)) { + if (mDebugMode != null) { + mDebugMode.setChecked(prefs.getBoolean(DEBUG_MODE_KEY, false)); + updateDebugMode(); + } + } + } + + private void updateDebugMode() { + if (mDebugMode == null) { + return; + } + boolean isDebugMode = mDebugMode.isChecked(); + String version = ""; + try { + PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); + version = "Version " + info.versionName; + } catch (NameNotFoundException e) { + Log.e(TAG, "Could not find version info."); + } + if (!isDebugMode) { + mDebugMode.setTitle(version); + mDebugMode.setSummary(""); + } else { + mDebugMode.setTitle(getResources().getString(R.string.prefs_debug_mode)); + mDebugMode.setSummary(version); + } + } +} diff --git a/java/src/com/android/inputmethod/latin/LatinIMESettings.java b/java/src/com/android/inputmethod/latin/LatinIMESettings.java index f9534d265..ffff33da2 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMESettings.java +++ b/java/src/com/android/inputmethod/latin/LatinIMESettings.java @@ -24,8 +24,6 @@ import android.app.Dialog; import android.app.backup.BackupManager; import android.content.DialogInterface; import android.content.SharedPreferences; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; @@ -45,7 +43,6 @@ public class LatinIMESettings extends PreferenceActivity private static final String QUICK_FIXES_KEY = "quick_fixes"; private static final String PREDICTION_SETTINGS_KEY = "prediction_settings"; private static final String VOICE_SETTINGS_KEY = "voice_mode"; - private static final String DEBUG_MODE_KEY = "debug_mode"; /* package */ static final String PREF_SETTINGS_KEY = "settings_key"; private static final String TAG = "LatinIMESettings"; @@ -54,7 +51,6 @@ public class LatinIMESettings extends PreferenceActivity private static final int VOICE_INPUT_CONFIRM_DIALOG = 0; private CheckBoxPreference mQuickFixes; - private CheckBoxPreference mDebugMode; private ListPreference mVoicePreference; private ListPreference mSettingsKeyPreference; private boolean mVoiceOn; @@ -77,9 +73,6 @@ public class LatinIMESettings extends PreferenceActivity mVoiceModeOff = getString(R.string.voice_mode_off); mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff)); mLogger = VoiceInputLogger.getLogger(this); - - mDebugMode = (CheckBoxPreference) findPreference(DEBUG_MODE_KEY); - updateDebugMode(); } @Override @@ -114,11 +107,6 @@ public class LatinIMESettings extends PreferenceActivity .equals(mVoiceModeOff)) { showVoiceConfirmation(); } - } else if (key.equals(DEBUG_MODE_KEY)) { - if (mDebugMode != null) { - mDebugMode.setChecked(prefs.getBoolean(DEBUG_MODE_KEY, false)); - updateDebugMode(); - } } mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff)); updateVoiceModeSummary(); @@ -131,29 +119,6 @@ public class LatinIMESettings extends PreferenceActivity [mSettingsKeyPreference.findIndexOfValue(mSettingsKeyPreference.getValue())]); } - private void updateDebugMode() { - if (mDebugMode == null) { - return; - } - boolean isDebugMode = mDebugMode.isChecked(); - String version = ""; - try { - PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0); - version = "Version " + info.versionName; - } catch (NameNotFoundException e) { - Log.e(TAG, "Could not find version info."); - } - if (!isDebugMode) { - mDebugMode.setEnabled(false); - mDebugMode.setTitle(version); - mDebugMode.setSummary(""); - } else { - mDebugMode.setEnabled(true); - mDebugMode.setSummary(version); - mDebugMode.setSummary(""); - } - } - private void showVoiceConfirmation() { mOkClicked = false; showDialog(VOICE_INPUT_CONFIRM_DIALOG); -- cgit v1.2.3-83-g751a From b1fcbec73050160c5cebf00c7daeee2c90ad1a44 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 27 Sep 2010 17:07:09 +0900 Subject: Add xlarge keyboard layouts (tentative) This keyboard layout is tentative for UX study. This change added xlarge keyboard layouts only for "regular text", "symbol/number mode" and "symbol/number mode shifted". TODO other text mode variants should have dedicated layout. Change-Id: I36077efcec4b57c3b5cada0a851e1409a289eeb9 --- java/res/values-xlarge/dimens.xml | 3 +- java/res/values/dimens.xml | 1 + java/res/values/styles.xml | 2 +- java/res/xml-xlarge/kbd_qwerty.xml | 218 +++++++++++++++++++++ java/res/xml-xlarge/kbd_symbols.xml | 160 +++++++++++++++ java/res/xml-xlarge/kbd_symbols_shift.xml | 161 +++++++++++++++ .../android/inputmethod/latin/LatinKeyboard.java | 72 +++---- 7 files changed, 581 insertions(+), 36 deletions(-) create mode 100644 java/res/xml-xlarge/kbd_qwerty.xml create mode 100644 java/res/xml-xlarge/kbd_symbols.xml create mode 100644 java/res/xml-xlarge/kbd_symbols_shift.xml (limited to 'java/src') diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml index 4e1c52877..37e6b9ef0 100644 --- a/java/res/values-xlarge/dimens.xml +++ b/java/res/values-xlarge/dimens.xml @@ -22,5 +22,6 @@ 72dip 46dip 0dip - 35sp + 28sp + 0dip diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index b399af489..75efddf6c 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -31,4 +31,5 @@ 91.8dip + -10dip diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 5e239482f..f30c9f196 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -27,7 +27,7 @@ 14sp @layout/keyboard_popup 0.05in - -10dip + @dimen/keyboard_vertical_correction #BB000000 2.75 0.5 diff --git a/java/res/xml-xlarge/kbd_qwerty.xml b/java/res/xml-xlarge/kbd_qwerty.xml new file mode 100644 index 000000000..e710b34c7 --- /dev/null +++ b/java/res/xml-xlarge/kbd_qwerty.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml new file mode 100644 index 000000000..9ac7716e8 --- /dev/null +++ b/java/res/xml-xlarge/kbd_symbols.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml-xlarge/kbd_symbols_shift.xml b/java/res/xml-xlarge/kbd_symbols_shift.xml new file mode 100644 index 000000000..fbbf68ebd --- /dev/null +++ b/java/res/xml-xlarge/kbd_symbols_shift.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 14a503bc3..9e24ee322 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -36,6 +36,8 @@ import android.util.Log; import android.view.ViewConfiguration; import android.view.inputmethod.EditorInfo; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -48,7 +50,7 @@ public class LatinKeyboard extends Keyboard { private Drawable mShiftLockIcon; private Drawable mShiftLockPreviewIcon; - private Drawable mOldShiftIcon; + private final HashMap mOldShiftIcons = new HashMap(); private Drawable mSpaceIcon; private Drawable mSpaceAutoCompletionIndicator; private Drawable mSpacePreviewIcon; @@ -58,7 +60,7 @@ public class LatinKeyboard extends Keyboard { private Drawable m123MicPreviewIcon; private final Drawable mButtonArrowLeftIcon; private final Drawable mButtonArrowRightIcon; - private Key mShiftKey; + private ArrayList mShiftKeys; private Key mEnterKey; private Key mF1Key; private Key mSpaceKey; @@ -170,6 +172,13 @@ public class LatinKeyboard extends Keyboard { case LatinIME.KEYCODE_SPACE: mSpaceKey = key; break; + case KEYCODE_SHIFT: + // NOTE: This protected method is being called from the base class constructor before + // mShiftKeys gets initialized. + if (mShiftKeys == null) + mShiftKeys = new ArrayList(); + mShiftKeys.add(key); + break; case KEYCODE_MODE_CHANGE: m123Key = key; m123Label = key.label; @@ -195,7 +204,7 @@ public class LatinKeyboard extends Keyboard { return key; } - void setImeOptions(Resources res, int mode, int options) { + public void setImeOptions(Resources res, int mode, int options) { if (mEnterKey != null) { // Reset some of the rarely used attributes. mEnterKey.popupCharacters = null; @@ -253,61 +262,56 @@ public class LatinKeyboard extends Keyboard { } } } - - void enableShiftLock() { - int index = getShiftKeyIndex(); - if (index >= 0) { - mShiftKey = getKeys().get(index); - if (mShiftKey instanceof LatinKey) { - ((LatinKey)mShiftKey).enableShiftLock(); + + public void enableShiftLock() { + for (final Key key : mShiftKeys) { + if (key instanceof LatinKey) { + ((LatinKey)key).enableShiftLock(); } - mOldShiftIcon = mShiftKey.icon; + mOldShiftIcons.put(key, key.icon); } } - void setShiftLocked(boolean shiftLocked) { - if (mShiftKey != null) { - if (shiftLocked) { - mShiftKey.on = true; - mShiftKey.icon = mShiftLockIcon; - mShiftState = SHIFT_LOCKED; - } else { - mShiftKey.on = false; - mShiftKey.icon = mShiftLockIcon; - mShiftState = SHIFT_ON; - } + public void setShiftLocked(boolean shiftLocked) { + for (final Key key : mShiftKeys) { + key.on = shiftLocked; + key.icon = mShiftLockIcon; } + mShiftState = shiftLocked ? SHIFT_LOCKED : SHIFT_ON; } - boolean isShiftLocked() { + public boolean isShiftLocked() { return mShiftState == SHIFT_LOCKED; } @Override public boolean setShifted(boolean shiftState) { boolean shiftChanged = false; - if (mShiftKey != null) { + if (mShiftKeys.size() > 0) { + for (final Key key : mShiftKeys) { + if (shiftState == false) { + key.on = false; + key.icon = mOldShiftIcons.get(key); + } else if (mShiftState == SHIFT_OFF) { + key.icon = mShiftLockIcon; + } + } if (shiftState == false) { shiftChanged = mShiftState != SHIFT_OFF; mShiftState = SHIFT_OFF; - mShiftKey.on = false; - mShiftKey.icon = mOldShiftIcon; - } else { - if (mShiftState == SHIFT_OFF) { - shiftChanged = mShiftState == SHIFT_OFF; - mShiftState = SHIFT_ON; - mShiftKey.icon = mShiftLockIcon; - } + } else if (mShiftState == SHIFT_OFF) { + shiftChanged = mShiftState == SHIFT_OFF; + mShiftState = SHIFT_ON; } + return shiftChanged; } else { return super.setShifted(shiftState); } - return shiftChanged; } @Override public boolean isShifted() { - if (mShiftKey != null) { + if (mShiftKeys.size() > 0) { return mShiftState != SHIFT_OFF; } else { return super.isShifted(); -- cgit v1.2.3-83-g751a From 0b4ae1f578e768eec4ada90aeb81d11acb10eb2e Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Tue, 28 Sep 2010 00:32:35 +0900 Subject: Capitalize the displayed text in the suggestion bar when all of the user typed chars are upper case bug:3014227 Change-Id: Ic453e2fde57ce51be00f3a506e1c9328103ca99a --- .../com/android/inputmethod/latin/LatinIME.java | 6 ++--- .../src/com/android/inputmethod/latin/Suggest.java | 12 +++++++--- .../android/inputmethod/latin/WordComposer.java | 26 ++++++++++++++-------- 3 files changed, 29 insertions(+), 15 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 4729585f6..01f3ba66c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1389,7 +1389,7 @@ public class LatinIME extends InputMethodService if (mKeyboardSwitcher.getInputView().isShifted() && mKeyboardSwitcher.isAlphabetMode() && mComposing.length() == 0) { - mWord.setCapitalized(true); + mWord.setFirstCharCapitalized(true); } mComposing.append((char) primaryCode); mWord.add(primaryCode, keyCodes); @@ -2020,7 +2020,7 @@ public class LatinIME extends InputMethodService touching.word.charAt(i) }); } - foundWord.setCapitalized(Character.isUpperCase(touching.word.charAt(0))); + foundWord.setFirstCharCapitalized(Character.isUpperCase(touching.word.charAt(0))); } // Found a match, show suggestions if (foundWord != null || alternatives != null) { @@ -2177,7 +2177,7 @@ public class LatinIME extends InputMethodService } public boolean preferCapitalization() { - return mWord.isCapitalized(); + return mWord.isFirstCharCapitalized(); } private void toggleLanguage(boolean reset, boolean next) { diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 92bbe4362..3b898941f 100755 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -96,7 +96,10 @@ public class Suggest implements Dictionary.WordCallback { private boolean mHaveCorrection; private CharSequence mOriginalWord; private String mLowerOriginalWord; - private boolean mCapitalize; + + // TODO: Remove these member variables by passing more context to addWord() callback method + private boolean mIsFirstCharCapitalized; + private boolean mIsAllUpperCase; private int mCorrectionMode = CORRECTION_BASIC; @@ -219,7 +222,8 @@ public class Suggest implements Dictionary.WordCallback { boolean includeTypedWordIfValid, CharSequence prevWordForBigram) { LatinImeLogger.onStartSuggestion(prevWordForBigram); mHaveCorrection = false; - mCapitalize = wordComposer.isCapitalized(); + mIsFirstCharCapitalized = wordComposer.isFirstCharCapitalized(); + mIsAllUpperCase = wordComposer.isAllUpperCase(); collectGarbage(mSuggestions, mPrefMaxSuggestions); Arrays.fill(mPriorities, 0); Arrays.fill(mNextLettersFrequencies, 0); @@ -453,7 +457,9 @@ public class Suggest implements Dictionary.WordCallback { StringBuilder sb = poolSize > 0 ? (StringBuilder) mStringPool.remove(poolSize - 1) : new StringBuilder(getApproxMaxWordLength()); sb.setLength(0); - if (mCapitalize) { + if (mIsAllUpperCase) { + sb.append(new String(word, offset, length).toUpperCase()); + } else if (mIsFirstCharCapitalized) { sb.append(Character.toUpperCase(word[offset])); if (length > 1) { sb.append(word, offset + 1, length - 1); diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index fe4c68576..2e415b771 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -39,9 +39,9 @@ public class WordComposer { private boolean mAutoCapitalized; /** - * Whether the user chose to capitalize the word. + * Whether the user chose to capitalize the first char of the word. */ - private boolean mIsCapitalized; + private boolean mIsFirstCharCapitalized; public WordComposer() { mCodes = new ArrayList(12); @@ -54,7 +54,7 @@ public class WordComposer { mTypedWord = new StringBuilder(copy.mTypedWord); mCapsCount = copy.mCapsCount; mAutoCapitalized = copy.mAutoCapitalized; - mIsCapitalized = copy.mIsCapitalized; + mIsFirstCharCapitalized = copy.mIsFirstCharCapitalized; } /** @@ -62,7 +62,7 @@ public class WordComposer { */ public void reset() { mCodes.clear(); - mIsCapitalized = false; + mIsFirstCharCapitalized = false; mPreferredWord = null; mTypedWord.setLength(0); mCapsCount = 0; @@ -138,18 +138,26 @@ public class WordComposer { return mTypedWord; } - public void setCapitalized(boolean capitalized) { - mIsCapitalized = capitalized; + public void setFirstCharCapitalized(boolean capitalized) { + mIsFirstCharCapitalized = capitalized; } /** * Whether or not the user typed a capital letter as the first letter in the word * @return capitalization preference */ - public boolean isCapitalized() { - return mIsCapitalized; + public boolean isFirstCharCapitalized() { + return mIsFirstCharCapitalized; } - + + /** + * Whether or not all of the user typed chars are upper case + * @return true if all user typed chars are upper case, false otherwise + */ + public boolean isAllUpperCase() { + return (mCapsCount > 0) && (mCapsCount == size()); + } + /** * Stores the user's selected word, before it is actually committed to the text field. * @param preferred -- cgit v1.2.3-83-g751a From 8bfcac4d84ffcfd36f68bf42c179b2b46dd7462c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 28 Sep 2010 09:45:45 +0900 Subject: Fix NPE in LatinKeyboard when it represent phone keyboard Bug: 3041532 Change-Id: I1d846e9175bd033f056a8715287a936be2fe8f74 --- .../android/inputmethod/latin/LatinKeyboard.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 9e24ee322..76b90f8f3 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -158,9 +158,22 @@ public class LatinKeyboard extends Keyboard { mNumberHintIcons[9] = res.getDrawable(R.drawable.keyboard_hint_9); } + // TODO: delete this method and do initialization in constructor. + private void initializeMemberVariablesAsNeeded() { + if (mNumberHintKeys == null) + mNumberHintKeys = new Key[NUMBER_HINT_COUNT]; + if (mShiftKeys == null) + mShiftKeys = new ArrayList(); + } + @Override protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { + // TODO: This initialization is needed because this protected method is being called from + // the base class constructor before this class constructor gets called. We need to fix + // this. + initializeMemberVariablesAsNeeded(); + Key key = new LatinKey(res, parent, x, y, parser); switch (key.codes[0]) { case LatinIME.KEYCODE_ENTER: @@ -173,10 +186,6 @@ public class LatinKeyboard extends Keyboard { mSpaceKey = key; break; case KEYCODE_SHIFT: - // NOTE: This protected method is being called from the base class constructor before - // mShiftKeys gets initialized. - if (mShiftKeys == null) - mShiftKeys = new ArrayList(); mShiftKeys.add(key); break; case KEYCODE_MODE_CHANGE: @@ -186,11 +195,6 @@ public class LatinKeyboard extends Keyboard { } // For number hints on the upper-right corner of key - if (mNumberHintKeys == null) { - // NOTE: This protected method is being called from the base class constructor before - // mNumberHintKeys gets initialized. - mNumberHintKeys = new Key[NUMBER_HINT_COUNT]; - } int hintNumber = -1; if (LatinKeyboardBaseView.isNumberAtLeftmostPopupChar(key)) { hintNumber = key.popupCharacters.charAt(0) - '0'; -- cgit v1.2.3-83-g751a From 008e9b3e1a8c037e0275b19f284a7d2e76c9e140 Mon Sep 17 00:00:00 2001 From: satok Date: Tue, 28 Sep 2010 11:27:44 +0900 Subject: Fix Null pointer exception on closing and update assets Change-Id: I30fdac74685beae06b5c61140452b26b29ae4c39 --- .../btn_keyboard_key_normal_off_stone.9.png | Bin 2348 -> 2389 bytes .../btn_keyboard_key_normal_on_stone.9.png | Bin 2379 -> 2408 bytes .../drawable-hdpi/btn_keyboard_key_normal_stone.9.png | Bin 2211 -> 2213 bytes .../btn_keyboard_key_normal_off_stone.9.png | Bin 2348 -> 2389 bytes .../btn_keyboard_key_normal_on_stone.9.png | Bin 2379 -> 2408 bytes .../drawable-mdpi/btn_keyboard_key_normal_stone.9.png | Bin 2211 -> 2213 bytes java/src/com/android/inputmethod/latin/LatinIME.java | 7 ++++++- .../com/android/inputmethod/latin/LatinImeLogger.java | 4 ++-- 8 files changed, 8 insertions(+), 3 deletions(-) (limited to 'java/src') diff --git a/java/res/drawable-hdpi/btn_keyboard_key_normal_off_stone.9.png b/java/res/drawable-hdpi/btn_keyboard_key_normal_off_stone.9.png index b67732cd4..fad0ec458 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_normal_off_stone.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_normal_off_stone.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_normal_on_stone.9.png b/java/res/drawable-hdpi/btn_keyboard_key_normal_on_stone.9.png index 534f1cdfd..215f8157c 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_normal_on_stone.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_normal_on_stone.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_normal_stone.9.png b/java/res/drawable-hdpi/btn_keyboard_key_normal_stone.9.png index fba10b888..88acdd748 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_normal_stone.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_normal_stone.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_normal_off_stone.9.png b/java/res/drawable-mdpi/btn_keyboard_key_normal_off_stone.9.png index b67732cd4..fad0ec458 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_normal_off_stone.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_normal_off_stone.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_normal_on_stone.9.png b/java/res/drawable-mdpi/btn_keyboard_key_normal_on_stone.9.png index 534f1cdfd..215f8157c 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_normal_on_stone.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_normal_on_stone.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_normal_stone.9.png b/java/res/drawable-mdpi/btn_keyboard_key_normal_stone.9.png index fba10b888..88acdd748 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_normal_stone.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_normal_stone.9.png differ diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 01f3ba66c..26f8a328b 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1487,7 +1487,12 @@ public class LatinIME extends InputMethodService mVoiceInput.cancel(); } requestHideSelf(0); - mKeyboardSwitcher.getInputView().closing(); + if (mKeyboardSwitcher != null) { + LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView != null) { + inputView.closing(); + } + } TextEntryState.endSession(); } diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index 6d15d216c..a8ab9cc98 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -37,8 +37,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void onDestroy() { } - public static void logOnManualSuggestion(String before, String after, int position - , List suggestions) { + public static void logOnManualSuggestion( + String before, String after, int position, List suggestions) { } public static void logOnAutoSuggestion(String before, String after) { -- cgit v1.2.3-83-g751a From 6e5a3986854549a45c95770b5a88ae5577e93299 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 24 Sep 2010 20:45:24 +0900 Subject: Fixed key code and key coordinates when move debounce has been in action This change refactors a key index and pointer position variables into a separate static inner class KeyState . This change also disables time debouncing. Bug: 3033737 Change-Id: Ie4fc37316c260330d8f0861e0771ea903a99cfce --- .../android/inputmethod/latin/PointerTracker.java | 248 +++++++++++---------- 1 file changed, 129 insertions(+), 119 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index cb717cbe7..b56974ccf 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -42,7 +42,6 @@ public class PointerTracker { /* package */ static final int REPEAT_INTERVAL = 50; // ~20 keys per second private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout(); private static final int MULTITAP_INTERVAL = 800; // milliseconds - private static final int KEY_DEBOUNCE_TIME = 70; // Miscellaneous constants private static final int NOT_A_KEY = LatinKeyboardBaseView.NOT_A_KEY; @@ -57,10 +56,7 @@ public class PointerTracker { private Key[] mKeys; private int mKeyHysteresisDistanceSquared = -1; - private int mCurrentKey = NOT_A_KEY; - private int mStartX; - private int mStartY; - private long mDownTime; + private final KeyState mKeyState; // true if event is already translated to a key action (long press or mini-keyboard) private boolean mKeyAlreadyProcessed; @@ -68,18 +64,6 @@ public class PointerTracker { // true if this pointer is repeatable key private boolean mIsRepeatableKey; - // for move de-bouncing - private int mLastCodeX; - private int mLastCodeY; - private int mLastX; - private int mLastY; - - // for time de-bouncing - private int mLastKey; - private long mLastKeyTime; - private long mLastMoveTime; - private long mCurrentKeyTime; - // For multi-tap private int mLastSentIndex; private int mTapCount; @@ -90,6 +74,95 @@ public class PointerTracker { // pressed key private int mPreviousKey = NOT_A_KEY; + // This class keeps track of a key index and a position where this pointer is. + private static class KeyState { + private final KeyDetector mKeyDetector; + + // The position and time at which first down event occurred. + private int mStartX; + private int mStartY; + private long mDownTime; + + // The current key index where this pointer is. + private int mKeyIndex = NOT_A_KEY; + // The position where mKeyIndex was recognized for the first time. + private int mKeyX; + private int mKeyY; + + // Last pointer position. + private int mLastX; + private int mLastY; + + public KeyState(KeyDetector keyDetecor) { + mKeyDetector = keyDetecor; + } + + public int getKeyIndex() { + return mKeyIndex; + } + + public int getKeyX() { + return mKeyX; + } + + public int getKeyY() { + return mKeyY; + } + + public int getStartX() { + return mStartX; + } + + public int getStartY() { + return mStartY; + } + + public long getDownTime() { + return mDownTime; + } + + public int getLastX() { + return mLastX; + } + + public int getLastY() { + return mLastY; + } + + public int onDownKey(int x, int y, long eventTime) { + mStartX = x; + mStartY = y; + mDownTime = eventTime; + + return onMoveToNewKey(onMoveKeyInternal(x, y), x, y); + } + + private int onMoveKeyInternal(int x, int y) { + mLastX = x; + mLastY = y; + return mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); + } + + public int onMoveKey(int x, int y) { + return onMoveKeyInternal(x, y); + } + + public int onMoveToNewKey(int keyIndex, int x, int y) { + mKeyIndex = keyIndex; + mKeyX = x; + mKeyY = y; + return keyIndex; + } + + public int onUpKey(int x, int y) { + return onMoveKeyInternal(x, y); + } + + public void onSetKeyboard() { + mKeyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(mKeyX, mKeyY, null); + } + } + public PointerTracker(int id, UIHandler handler, KeyDetector keyDetector, UIProxy proxy, boolean hasDistinctMultitouch) { if (proxy == null || handler == null || keyDetector == null) @@ -98,6 +171,7 @@ public class PointerTracker { mProxy = proxy; mHandler = handler; mKeyDetector = keyDetector; + mKeyState = new KeyState(keyDetector); mHasDistinctMultitouch = hasDistinctMultitouch; resetMultiTap(); } @@ -112,7 +186,7 @@ public class PointerTracker { mKeys = keys; mKeyHysteresisDistanceSquared = (int)(keyHysteresisDistance * keyHysteresisDistance); // Update current key index because keyboard layout has been changed. - mCurrentKey = mKeyDetector.getKeyIndexAndNearbyCodes(mStartX, mStartY, null); + mKeyState.onSetKeyboard(); } private boolean isValidKeyIndex(int keyIndex) { @@ -133,7 +207,7 @@ public class PointerTracker { } public boolean isModifier() { - return isModifierInternal(mCurrentKey); + return isModifierInternal(mKeyState.getKeyIndex()); } public boolean isOnModifierKey(int x, int y) { @@ -190,21 +264,16 @@ public class PointerTracker { public void onDownEvent(int x, int y, long eventTime) { if (DEBUG) debugLog("onDownEvent:", x, y); - int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); - mCurrentKey = keyIndex; - mStartX = x; - mStartY = y; - mDownTime = eventTime; + int keyIndex = mKeyState.onDownKey(x, y, eventTime); mKeyAlreadyProcessed = false; mIsRepeatableKey = false; - startMoveDebouncing(x, y); - startTimeDebouncing(eventTime); checkMultiTap(eventTime, keyIndex); if (mListener != null) { int primaryCode = isValidKeyIndex(keyIndex) ? mKeys[keyIndex].codes[0] : 0; mListener.onPress(primaryCode); - // This onPress call may have changed keyboard layout and have updated mCurrentKey - keyIndex = mCurrentKey; + // This onPress call may have changed keyboard layout and have updated mKeyIndex. + // If that's the case, mKeyIndex has been updated in setKeyboard(). + keyIndex = mKeyState.getKeyIndex(); } if (isValidKeyIndex(keyIndex)) { if (mKeys[keyIndex].repeatable) { @@ -215,7 +284,6 @@ public class PointerTracker { mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } showKeyPreviewAndUpdateKey(keyIndex); - updateMoveDebouncing(x, y); } public void onMoveEvent(int x, int y, long eventTime) { @@ -223,44 +291,28 @@ public class PointerTracker { debugLog("onMoveEvent:", x, y); if (mKeyAlreadyProcessed) return; - int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); + KeyState keyState = mKeyState; + int keyIndex = keyState.onMoveKey(x, y); if (isValidKeyIndex(keyIndex)) { - if (mCurrentKey == NOT_A_KEY) { - updateTimeDebouncing(eventTime); - mCurrentKey = keyIndex; + if (keyState.getKeyIndex() == NOT_A_KEY) { + keyState.onMoveToNewKey(keyIndex, x, y); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); - } else if (isMinorMoveBounce(x, y, keyIndex, mCurrentKey)) { - updateTimeDebouncing(eventTime); - } else { + } else if (!isMinorMoveBounce(x, y, keyIndex)) { resetMultiTap(); - resetTimeDebouncing(eventTime, mCurrentKey); - resetMoveDebouncing(); - mCurrentKey = keyIndex; + keyState.onMoveToNewKey(keyIndex, x, y); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } } else { - if (mCurrentKey != NOT_A_KEY) { - updateTimeDebouncing(eventTime); - mCurrentKey = keyIndex; + if (keyState.getKeyIndex() != NOT_A_KEY) { + keyState.onMoveToNewKey(keyIndex, x ,y); mHandler.cancelLongPressTimer(); - } else if (isMinorMoveBounce(x, y, keyIndex, mCurrentKey)) { - updateTimeDebouncing(eventTime); - } else { + } else if (!isMinorMoveBounce(x, y, keyIndex)) { resetMultiTap(); - resetTimeDebouncing(eventTime, mCurrentKey); - resetMoveDebouncing(); - mCurrentKey = keyIndex; + keyState.onMoveToNewKey(keyIndex, x ,y); mHandler.cancelLongPressTimer(); } } - /* - * While time debouncing is in effect, mCurrentKey holds the new key and this tracker - * holds the last key. At ACTION_UP event if time debouncing will be in effect - * eventually, the last key should be sent as the result. In such case mCurrentKey - * should not be showed as popup preview. - */ - showKeyPreviewAndUpdateKey(isMinorTimeBounce() ? mLastKey : mCurrentKey); - updateMoveDebouncing(x, y); + showKeyPreviewAndUpdateKey(mKeyState.getKeyIndex()); } public void onUpEvent(int x, int y, long eventTime) { @@ -270,23 +322,18 @@ public class PointerTracker { return; mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); - int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); - if (isMinorMoveBounce(x, y, keyIndex, mCurrentKey)) { - updateTimeDebouncing(eventTime); - } else { - resetMultiTap(); - resetTimeDebouncing(eventTime, mCurrentKey); - mCurrentKey = keyIndex; - } - if (isMinorTimeBounce()) { - mCurrentKey = mLastKey; - x = mLastCodeX; - y = mLastCodeY; + int keyIndex = mKeyState.onUpKey(x, y); + if (isMinorMoveBounce(x, y, keyIndex)) { + // Use previous fixed key index and coordinates. + keyIndex = mKeyState.getKeyIndex(); + x = mKeyState.getKeyX(); + y = mKeyState.getKeyY(); } showKeyPreviewAndUpdateKey(NOT_A_KEY); if (!mIsRepeatableKey) { - detectAndSendKey(mCurrentKey, x, y, eventTime); + detectAndSendKey(keyIndex, x, y, eventTime); } + if (isValidKeyIndex(keyIndex)) mProxy.invalidateKey(mKeys[keyIndex]); } @@ -297,7 +344,7 @@ public class PointerTracker { mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); showKeyPreviewAndUpdateKey(NOT_A_KEY); - int keyIndex = mCurrentKey; + int keyIndex = mKeyState.getKeyIndex(); if (isValidKeyIndex(keyIndex)) mProxy.invalidateKey(mKeys[keyIndex]); } @@ -312,44 +359,30 @@ public class PointerTracker { } public int getLastX() { - return mLastX; + return mKeyState.getLastX(); } public int getLastY() { - return mLastY; + return mKeyState.getLastY(); } public long getDownTime() { - return mDownTime; + return mKeyState.getDownTime(); } // These package scope methods are only for debugging purpose. /* package */ int getStartX() { - return mStartX; + return mKeyState.getStartX(); } /* package */ int getStartY() { - return mStartY; + return mKeyState.getStartY(); } - private void startMoveDebouncing(int x, int y) { - mLastCodeX = x; - mLastCodeY = y; - } - - private void updateMoveDebouncing(int x, int y) { - mLastX = x; - mLastY = y; - } - - private void resetMoveDebouncing() { - mLastCodeX = mLastX; - mLastCodeY = mLastY; - } - - private boolean isMinorMoveBounce(int x, int y, int newKey, int curKey) { + private boolean isMinorMoveBounce(int x, int y, int newKey) { if (mKeys == null || mKeyHysteresisDistanceSquared < 0) throw new IllegalStateException("keyboard and/or hysteresis not set"); + int curKey = mKeyState.getKeyIndex(); if (newKey == curKey) { return true; } else if (isValidKeyIndex(curKey)) { @@ -371,30 +404,6 @@ public class PointerTracker { return dx * dx + dy * dy; } - private void startTimeDebouncing(long eventTime) { - mLastKey = NOT_A_KEY; - mLastKeyTime = 0; - mCurrentKeyTime = 0; - mLastMoveTime = eventTime; - } - - private void updateTimeDebouncing(long eventTime) { - mCurrentKeyTime += eventTime - mLastMoveTime; - mLastMoveTime = eventTime; - } - - private void resetTimeDebouncing(long eventTime, int currentKey) { - mLastKey = currentKey; - mLastKeyTime = mCurrentKeyTime + eventTime - mLastMoveTime; - mCurrentKeyTime = 0; - mLastMoveTime = eventTime; - } - - private boolean isMinorTimeBounce() { - return mCurrentKeyTime < mLastKeyTime && mCurrentKeyTime < KEY_DEBOUNCE_TIME - && mLastKey != NOT_A_KEY; - } - private void showKeyPreviewAndUpdateKey(int keyIndex) { updateKey(keyIndex); // The modifier key, such as shift key, should not be shown as preview when multi-touch is @@ -497,7 +506,8 @@ public class PointerTracker { } private void debugLog(String title, int x, int y) { - Key key = getKey(mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null)); + int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); + Key key = getKey(keyIndex); final String code; if (key == null) { code = "----"; @@ -505,7 +515,7 @@ public class PointerTracker { int primaryCode = key.codes[0]; code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode); } - Log.d(TAG, String.format("%s [%d] %3d,%3d %s %s", title, mPointerId, x, y, code, - isModifier() ? "modifier" : "")); + Log.d(TAG, String.format("%s [%d] %3d,%3d %3d(%s) %s", title, mPointerId, x, y, keyIndex, + code, isModifier() ? "modifier" : "")); } -} \ No newline at end of file +} -- cgit v1.2.3-83-g751a From afb353277928b9c13a97f2aefde7412f432e060a Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 29 Sep 2010 04:17:36 +0900 Subject: Mini keyboard works even while shift is being pressed Bug: 3038861 Change-Id: I94011ca80710ff6eb24e940104f7d9d3bb86840a --- .../android/inputmethod/latin/LatinKeyboardBaseView.java | 14 +++++++++++--- java/src/com/android/inputmethod/latin/PointerTracker.java | 5 +++-- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 3761dab14..75ef691c8 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -205,6 +205,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private long mMiniKeyboardPopupTime; private int[] mWindowOffset; private final float mMiniKeyboardSlideAllowance; + private int mMiniKeyboardTrackerId; /** Listener for {@link OnKeyboardActionListener}. */ private OnKeyboardActionListener mKeyboardActionListener; @@ -1023,6 +1024,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (result) { dismissKeyPreview(); tracker.setAlreadyProcessed(); + mMiniKeyboardTrackerId = tracker.mPointerId; } return result; } @@ -1258,9 +1260,15 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Needs to be called after the gesture detector gets a turn, as it may have // displayed the mini keyboard if (mMiniKeyboard != null) { - MotionEvent translated = generateMiniKeyboardMotionEvent(action, x, y, eventTime); - mMiniKeyboard.onTouchEvent(translated); - translated.recycle(); + final int miniKeyboardPointerIndex = me.findPointerIndex(mMiniKeyboardTrackerId); + if (miniKeyboardPointerIndex >= 0 && miniKeyboardPointerIndex < pointerCount) { + final int miniKeyboardX = (int)me.getX(miniKeyboardPointerIndex); + final int miniKeyboardY = (int)me.getY(miniKeyboardPointerIndex); + MotionEvent translated = generateMiniKeyboardMotionEvent(action, + miniKeyboardX, miniKeyboardY, eventTime); + mMiniKeyboard.onTouchEvent(translated); + translated.recycle(); + } return true; } diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index b56974ccf..b416a984c 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -515,7 +515,8 @@ public class PointerTracker { int primaryCode = key.codes[0]; code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode); } - Log.d(TAG, String.format("%s [%d] %3d,%3d %3d(%s) %s", title, mPointerId, x, y, keyIndex, - code, isModifier() ? "modifier" : "")); + Log.d(TAG, String.format("%s%s[%d] %3d,%3d %3d(%s) %s", title, + (mKeyAlreadyProcessed ? "-" : " "), mPointerId, x, y, keyIndex, code, + (isModifier() ? "modifier" : ""))); } } -- cgit v1.2.3-83-g751a From 179ada958b0bb46c6b9c8eb8b220d84dd3db855a Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 29 Sep 2010 14:30:01 +0900 Subject: Refactor CandidateView touch event handling This change also fixes tha the touch slop value is applyed only for initial movement of scrolling suggestion bar. Bug: 3004920 Change-Id: I62afdedc210156e41e8c84c48cade442f9d5a1aa --- java/res/values/dimens.xml | 1 + .../android/inputmethod/latin/CandidateView.java | 186 +++++++++------------ 2 files changed, 77 insertions(+), 110 deletions(-) (limited to 'java/src') diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 502157dcf..f83fc36a6 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -33,4 +33,5 @@ 91.8dip -54dip + 0.3in diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index 0f5b43009..9bbd30e24 100755 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -16,17 +16,13 @@ package com.android.inputmethod.latin; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Paint; +import android.graphics.Paint.Align; import android.graphics.Rect; import android.graphics.Typeface; -import android.graphics.Paint.Align; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Message; @@ -40,75 +36,82 @@ import android.view.ViewGroup.LayoutParams; import android.widget.PopupWindow; import android.widget.TextView; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class CandidateView extends View { private static final int OUT_OF_BOUNDS = -1; - private static final List EMPTY_LIST = new ArrayList(); private LatinIME mService; - private List mSuggestions = EMPTY_LIST; + private final ArrayList mSuggestions = new ArrayList(); private boolean mShowingCompletions; private CharSequence mSelectedString; private int mSelectedIndex; private int mTouchX = OUT_OF_BOUNDS; - private Drawable mSelectionHighlight; + private final Drawable mSelectionHighlight; private boolean mTypedWordValid; private boolean mHaveMinimalSuggestion; private Rect mBgPadding; - private TextView mPreviewText; - private PopupWindow mPreviewPopup; + private final TextView mPreviewText; + private final PopupWindow mPreviewPopup; + private final int mDelayAfterPreview; private int mCurrentWordIndex; private Drawable mDivider; private static final int MAX_SUGGESTIONS = 32; private static final int SCROLL_PIXELS = 20; - private static final int MSG_REMOVE_PREVIEW = 1; - private static final int MSG_REMOVE_THROUGH_PREVIEW = 2; - - private int[] mWordWidth = new int[MAX_SUGGESTIONS]; - private int[] mWordX = new int[MAX_SUGGESTIONS]; + private final int[] mWordWidth = new int[MAX_SUGGESTIONS]; + private final int[] mWordX = new int[MAX_SUGGESTIONS]; private int mPopupPreviewX; private int mPopupPreviewY; private static final int X_GAP = 10; - private int mColorNormal; - private int mColorRecommended; - private int mColorOther; - private Paint mPaint; - private int mDescent; + private final int mColorNormal; + private final int mColorRecommended; + private final int mColorOther; + private final Paint mPaint; + private final int mDescent; private boolean mScrolled; private boolean mShowingAddToDictionary; private CharSequence mAddToDictionaryHint; private int mTargetScrollX; - private int mMinTouchableWidth; + private final int mMinTouchableWidth; private int mTotalWidth; - private GestureDetector mGestureDetector; + private final GestureDetector mGestureDetector; + + private final UIHandler mHandler = new UIHandler(); + + private class UIHandler extends Handler { + private static final int MSG_DISMISS_PREVIEW = 1; - Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { - case MSG_REMOVE_PREVIEW: - mPreviewText.setVisibility(GONE); - break; - case MSG_REMOVE_THROUGH_PREVIEW: - mPreviewText.setVisibility(GONE); - if (mTouchX != OUT_OF_BOUNDS) { - removeHighlight(); - } + case MSG_DISMISS_PREVIEW: + mPreviewPopup.dismiss(); break; } } - }; + + public void dismissPreview(long delay) { + sendMessageDelayed(obtainMessage(MSG_DISMISS_PREVIEW), delay); + } + + public void cancelDismissPreview() { + removeMessages(MSG_DISMISS_PREVIEW); + } + } /** * Construct a CandidateView for showing suggested words for completion. @@ -129,6 +132,8 @@ public class CandidateView extends View { mPreviewPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); + mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation); + mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview); mColorNormal = res.getColor(R.color.candidate_normal); mColorRecommended = res.getColor(R.color.candidate_recommended); mColorOther = res.getColor(R.color.candidate_other); @@ -142,13 +147,10 @@ public class CandidateView extends View { mPaint.setStrokeWidth(0); mPaint.setTextAlign(Align.CENTER); mDescent = (int) mPaint.descent(); - // 50 pixels for a 160dpi device would mean about 0.3 inch - mMinTouchableWidth = (int) (getResources().getDisplayMetrics().density * 50); + mMinTouchableWidth = (int)res.getDimension(R.dimen.candidate_min_touchable_width); // Slightly reluctant to scroll to be able to easily choose the suggestion - // 50 pixels for a 160dpi device would mean about 0.3 inch - final int touchSlop = (int) (getResources().getDisplayMetrics().density * 50); - final int touchSlopSquare = touchSlop * touchSlop; + final int touchSlopSquare = mMinTouchableWidth * mMinTouchableWidth; mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { @Override public void onLongPress(MotionEvent me) { @@ -158,15 +160,25 @@ public class CandidateView extends View { } } } - + + @Override + public boolean onDown(MotionEvent e) { + mScrolled = false; + return false; + } + @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - final int deltaX = (int) (e2.getX() - e1.getX()); - final int deltaY = (int) (e2.getY() - e1.getY()); - final int distance = (deltaX * deltaX) + (deltaY * deltaY); - if (distance < touchSlopSquare) { - return false; + if (!mScrolled) { + // This is applied only when we recognize that scrolling is starting. + final int deltaX = (int) (e2.getX() - e1.getX()); + final int deltaY = (int) (e2.getY() - e1.getY()); + final int distance = (deltaX * deltaX) + (deltaY * deltaY); + if (distance < touchSlopSquare) { + return true; + } + mScrolled = true; } final int width = getWidth(); @@ -215,7 +227,6 @@ public class CandidateView extends View { super.onDraw(canvas); } mTotalWidth = 0; - if (mSuggestions == null) return; final int height = getHeight(); if (mBgPadding == null) { @@ -226,8 +237,8 @@ public class CandidateView extends View { mDivider.setBounds(0, 0, mDivider.getIntrinsicWidth(), mDivider.getIntrinsicHeight()); } - int x = 0; - final int count = Math.min(mSuggestions.size(), MAX_SUGGESTIONS); + + final int count = mSuggestions.size(); final Rect bgPadding = mBgPadding; final Paint paint = mPaint; final int touchX = mTouchX; @@ -238,25 +249,26 @@ public class CandidateView extends View { boolean existsAutoCompletion = false; + int x = 0; for (int i = 0; i < count; i++) { CharSequence suggestion = mSuggestions.get(i); if (suggestion == null) continue; + final int wordLength = suggestion.length(); + paint.setColor(mColorNormal); if (mHaveMinimalSuggestion && ((i == 1 && !typedWordValid) || (i == 0 && typedWordValid))) { paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setColor(mColorRecommended); existsAutoCompletion = true; - } else if (i != 0 || (suggestion.length() == 1 && count > 1)) { + } else if (i != 0 || (wordLength == 1 && count > 1)) { // HACK: even if i == 0, we use mColorOther when this suggestion's length is 1 and // there are multiple suggestions, such as the default punctuation list. paint.setColor(mColorOther); } - final int wordWidth; - if (mWordWidth[i] != 0) { - wordWidth = mWordWidth[i]; - } else { - float textWidth = paint.measureText(suggestion, 0, suggestion.length()); + int wordWidth; + if ((wordWidth = mWordWidth[i]) == 0) { + float textWidth = paint.measureText(suggestion, 0, wordLength); wordWidth = Math.max(mMinTouchableWidth, (int) textWidth + X_GAP * 2); mWordWidth[i] = wordWidth; } @@ -277,7 +289,7 @@ public class CandidateView extends View { } if (canvas != null) { - canvas.drawText(suggestion, 0, suggestion.length(), x + wordWidth / 2, y, paint); + canvas.drawText(suggestion, 0, wordLength, x + wordWidth / 2, y, paint); paint.setColor(mColorOther); canvas.translate(x + wordWidth, 0); // Draw a divider unless it's after the hint @@ -324,7 +336,12 @@ public class CandidateView extends View { boolean typedWordValid, boolean haveMinimalSuggestion) { clear(); if (suggestions != null) { - mSuggestions = new ArrayList(suggestions); + int insertCount = Math.min(suggestions.size(), MAX_SUGGESTIONS); + for (CharSequence suggestion : suggestions) { + mSuggestions.add(suggestion); + if (--insertCount == 0) + break; + } } mShowingCompletions = completions; mTypedWordValid = typedWordValid; @@ -355,50 +372,6 @@ public class CandidateView extends View { return true; } - public void scrollPrev() { - int i = 0; - final int count = Math.min(mSuggestions.size(), MAX_SUGGESTIONS); - int firstItem = 0; // Actually just before the first item, if at the boundary - while (i < count) { - if (mWordX[i] < getScrollX() - && mWordX[i] + mWordWidth[i] >= getScrollX() - 1) { - firstItem = i; - break; - } - i++; - } - int leftEdge = mWordX[firstItem] + mWordWidth[firstItem] - getWidth(); - if (leftEdge < 0) leftEdge = 0; - updateScrollPosition(leftEdge); - } - - public void scrollNext() { - int i = 0; - int scrollX = getScrollX(); - int targetX = scrollX; - final int count = Math.min(mSuggestions.size(), MAX_SUGGESTIONS); - int rightEdge = scrollX + getWidth(); - while (i < count) { - if (mWordX[i] <= rightEdge && - mWordX[i] + mWordWidth[i] >= rightEdge) { - targetX = Math.min(mWordX[i], mTotalWidth - getWidth()); - break; - } - i++; - } - updateScrollPosition(targetX); - } - - private void updateScrollPosition(int targetX) { - if (targetX != getScrollX()) { - // TODO: Animate - mTargetScrollX = targetX; - requestLayout(); - invalidate(); - mScrolled = true; - } - } - /* package */ List getSuggestions() { return mSuggestions; } @@ -406,7 +379,7 @@ public class CandidateView extends View { public void clear() { // Don't call mSuggestions.clear() because it's being used for logging // in LatinIME.pickSuggestionManually(). - mSuggestions = EMPTY_LIST; + mSuggestions.clear(); mTouchX = OUT_OF_BOUNDS; mSelectedString = null; mSelectedIndex = -1; @@ -414,9 +387,7 @@ public class CandidateView extends View { invalidate(); Arrays.fill(mWordWidth, 0); Arrays.fill(mWordX, 0); - if (mPreviewPopup.isShowing()) { - mPreviewPopup.dismiss(); - } + mPreviewPopup.dismiss(); } @Override @@ -433,7 +404,6 @@ public class CandidateView extends View { switch (action) { case MotionEvent.ACTION_DOWN: - mScrolled = false; invalidate(); break; case MotionEvent.ACTION_MOVE: @@ -453,7 +423,6 @@ public class CandidateView extends View { mSelectedIndex = -1; } } - invalidate(); break; case MotionEvent.ACTION_UP: if (!mScrolled) { @@ -473,8 +442,8 @@ public class CandidateView extends View { mSelectedString = null; mSelectedIndex = -1; removeHighlight(); - hidePreview(); requestLayout(); + mHandler.dismissPreview(mDelayAfterPreview); break; } return true; @@ -482,10 +451,7 @@ public class CandidateView extends View { private void hidePreview() { mCurrentWordIndex = OUT_OF_BOUNDS; - if (mPreviewPopup.isShowing()) { - mHandler.sendMessageDelayed(mHandler - .obtainMessage(MSG_REMOVE_PREVIEW), 60); - } + mPreviewPopup.dismiss(); } private void showPreview(int wordIndex, String altText) { @@ -496,6 +462,7 @@ public class CandidateView extends View { if (wordIndex == OUT_OF_BOUNDS) { hidePreview(); } else { + mHandler.cancelDismissPreview(); CharSequence word = altText != null? altText : mSuggestions.get(wordIndex); mPreviewText.setText(word); mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), @@ -508,7 +475,6 @@ public class CandidateView extends View { mPopupPreviewX = mWordX[wordIndex] - mPreviewText.getPaddingLeft() - getScrollX() + (mWordWidth[wordIndex] - wordWidth) / 2; mPopupPreviewY = - popupHeight; - mHandler.removeMessages(MSG_REMOVE_PREVIEW); int [] offsetInWindow = new int[2]; getLocationInWindow(offsetInWindow); if (mPreviewPopup.isShowing()) { -- cgit v1.2.3-83-g751a From b8fa10080dfac777fce7c8a7fc3180e8b540f9f5 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 28 Sep 2010 16:35:29 -0700 Subject: Check recorrection on focusing into a text field that has text already. Bug: 3004827 Change-Id: I00e9d925fcf17fa9f7a9aefe6572a648e023be11 --- .../com/android/inputmethod/latin/LatinIME.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 26f8a328b..0bfcc0704 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -676,10 +676,33 @@ public class LatinIME extends InputMethodService inputView.setPreviewEnabled(mPopupOn); inputView.setProximityCorrectionEnabled(true); mPredictionOn = mPredictionOn && (mCorrectionMode > 0 || mShowSuggestions); + // If we just entered a text field, maybe it has some old text that requires correction + checkReCorrectionOnStart(); checkTutorial(attribute.privateImeOptions); if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); } + private void checkReCorrectionOnStart() { + if (mReCorrectionEnabled && isPredictionOn()) { + // First get the cursor position. This is required by setOldSuggestions(), so that + // it can pass the correct range to setComposingRegion(). At this point, we don't + // have valid values for mLastSelectionStart/Stop because onUpdateSelection() has + // not been called yet. + InputConnection ic = getCurrentInputConnection(); + if (ic == null) return; + ExtractedTextRequest etr = new ExtractedTextRequest(); + etr.token = 0; // anything is fine here + ExtractedText et = ic.getExtractedText(etr, 0); + if (et == null) return; + + mLastSelectionStart = et.startOffset + et.selectionStart; + mLastSelectionEnd = et.startOffset + et.selectionEnd; + + // Then look for possible corrections in a delayed fashion + if (!TextUtils.isEmpty(et.text)) postUpdateOldSuggestions(); + } + } + @Override public void onFinishInput() { super.onFinishInput(); -- cgit v1.2.3-83-g751a From c9716b28ce438e06b5cacc07fc002944bcbe24a0 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 30 Sep 2010 12:10:03 +0900 Subject: Disable suggestion selection preview popup Bug: 3048642 Bug: 3004920 Change-Id: Ibfb495a246c9e2da6ebf3c03d10ed8acff00f54b --- .../android/inputmethod/latin/CandidateView.java | 105 +++++++++++---------- 1 file changed, 56 insertions(+), 49 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index 9bbd30e24..56f9ba207 100755 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -149,61 +149,69 @@ public class CandidateView extends View { mDescent = (int) mPaint.descent(); mMinTouchableWidth = (int)res.getDimension(R.dimen.candidate_min_touchable_width); - // Slightly reluctant to scroll to be able to easily choose the suggestion - final int touchSlopSquare = mMinTouchableWidth * mMinTouchableWidth; - mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() { - @Override - public void onLongPress(MotionEvent me) { - if (mSuggestions.size() > 0) { - if (me.getX() + getScrollX() < mWordWidth[0] && getScrollX() < 10) { - longPressFirstWord(); - } + mGestureDetector = new GestureDetector( + new CandidateStripGestureListener(mMinTouchableWidth)); + setWillNotDraw(false); + setHorizontalScrollBarEnabled(false); + setVerticalScrollBarEnabled(false); + scrollTo(0, getScrollY()); + } + + private class CandidateStripGestureListener extends GestureDetector.SimpleOnGestureListener { + private final int mTouchSlopSquare; + + public CandidateStripGestureListener(int touchSlop) { + // Slightly reluctant to scroll to be able to easily choose the suggestion + mTouchSlopSquare = touchSlop * touchSlop; + } + + @Override + public void onLongPress(MotionEvent me) { + if (mSuggestions.size() > 0) { + if (me.getX() + getScrollX() < mWordWidth[0] && getScrollX() < 10) { + longPressFirstWord(); } } + } - @Override - public boolean onDown(MotionEvent e) { - mScrolled = false; - return false; - } + @Override + public boolean onDown(MotionEvent e) { + mScrolled = false; + return false; + } - @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, - float distanceX, float distanceY) { - if (!mScrolled) { - // This is applied only when we recognize that scrolling is starting. - final int deltaX = (int) (e2.getX() - e1.getX()); - final int deltaY = (int) (e2.getY() - e1.getY()); - final int distance = (deltaX * deltaX) + (deltaY * deltaY); - if (distance < touchSlopSquare) { - return true; - } - mScrolled = true; + @Override + public boolean onScroll(MotionEvent e1, MotionEvent e2, + float distanceX, float distanceY) { + if (!mScrolled) { + // This is applied only when we recognize that scrolling is starting. + final int deltaX = (int) (e2.getX() - e1.getX()); + final int deltaY = (int) (e2.getY() - e1.getY()); + final int distance = (deltaX * deltaX) + (deltaY * deltaY); + if (distance < mTouchSlopSquare) { + return true; } - - final int width = getWidth(); mScrolled = true; - int scrollX = getScrollX(); - scrollX += (int) distanceX; - if (scrollX < 0) { - scrollX = 0; - } - if (distanceX > 0 && scrollX + width > mTotalWidth) { - scrollX -= (int) distanceX; - } - mTargetScrollX = scrollX; - scrollTo(scrollX, getScrollY()); - hidePreview(); - invalidate(); - return true; } - }); - setWillNotDraw(false); - setHorizontalScrollBarEnabled(false); - setVerticalScrollBarEnabled(false); - scrollTo(0, getScrollY()); + + final int width = getWidth(); + mScrolled = true; + int scrollX = getScrollX(); + scrollX += (int) distanceX; + if (scrollX < 0) { + scrollX = 0; + } + if (distanceX > 0 && scrollX + width > mTotalWidth) { + scrollX -= (int) distanceX; + } + mTargetScrollX = scrollX; + scrollTo(scrollX, getScrollY()); + hidePreview(); + invalidate(); + return true; + } } - + /** * A connection back to the service to communicate with the text field * @param listener @@ -282,7 +290,6 @@ public class CandidateView extends View { mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height); mSelectionHighlight.draw(canvas); canvas.translate(-x, 0); - showPreview(i, null); } mSelectedString = suggestion; mSelectedIndex = i; @@ -443,7 +450,6 @@ public class CandidateView extends View { mSelectedIndex = -1; removeHighlight(); requestLayout(); - mHandler.dismissPreview(mDelayAfterPreview); break; } return true; @@ -501,6 +507,7 @@ public class CandidateView extends View { if (word.length() < 2) return; if (mService.addWordToDictionary(word.toString())) { showPreview(0, getContext().getResources().getString(R.string.added_word, word)); + mHandler.dismissPreview(mDelayAfterPreview); } } -- cgit v1.2.3-83-g751a From e7cfc8ab8853e215b655f2184c47036e117aa8c7 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 30 Sep 2010 12:41:57 +0900 Subject: Eliminate compiler warning Change-Id: Ib3effaa6f4e8cfc3951ab5d5d099335fd3856a2f --- java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java b/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java index 8364c90fa..1d36c0b98 100644 --- a/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java +++ b/java/src/com/android/inputmethod/latin/SharedPreferencesCompat.java @@ -30,8 +30,7 @@ public class SharedPreferencesCompat { private static Method findApplyMethod() { try { - Class cls = SharedPreferences.Editor.class; - return cls.getMethod("apply"); + return SharedPreferences.Editor.class.getMethod("apply"); } catch (NoSuchMethodException unused) { // fall through } -- cgit v1.2.3-83-g751a From 11a578f4f130ebae66fb1bd9953874f421c3c09c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 30 Sep 2010 16:01:53 +0900 Subject: Disable suggestion bar before invoke Voice input Bug: 3002817 Change-Id: I099dd63e58d5159a609c1d934dbb6f5aab914305 --- java/src/com/android/inputmethod/latin/LatinIME.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 0bfcc0704..fb9c47db2 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1567,7 +1567,9 @@ public class LatinIME extends InputMethodService if (mKeyboardSwitcher.getInputView() != null) { setInputView(mKeyboardSwitcher.getInputView()); } + setCandidatesViewShown(true); updateInputViewShown(); + postUpdateSuggestions(); }}); } @@ -1575,6 +1577,7 @@ public class LatinIME extends InputMethodService final boolean configChanged = mConfigurationChanging; mHandler.post(new Runnable() { public void run() { + setCandidatesViewShown(false); mRecognizing = true; View v = mVoiceInput.getView(); ViewParent p = v.getParent(); -- cgit v1.2.3-83-g751a From fcba53ef7c874a4685c12c01404c91b779cae1e8 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 30 Sep 2010 14:26:12 +0900 Subject: Display feedback popup for saving word while the word is pressing. Bug: 3004696 Change-Id: Icc5bdd6945f3bf79f7234a0227d8036d6f6d4c1d --- .../android/inputmethod/latin/CandidateView.java | 40 ++-------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index 56f9ba207..89afd168e 100755 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -24,8 +24,6 @@ import android.graphics.Paint.Align; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import android.os.Handler; -import android.os.Message; import android.util.AttributeSet; import android.view.GestureDetector; import android.view.Gravity; @@ -59,7 +57,6 @@ public class CandidateView extends View { private final TextView mPreviewText; private final PopupWindow mPreviewPopup; - private final int mDelayAfterPreview; private int mCurrentWordIndex; private Drawable mDivider; @@ -90,29 +87,6 @@ public class CandidateView extends View { private final GestureDetector mGestureDetector; - private final UIHandler mHandler = new UIHandler(); - - private class UIHandler extends Handler { - private static final int MSG_DISMISS_PREVIEW = 1; - - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_DISMISS_PREVIEW: - mPreviewPopup.dismiss(); - break; - } - } - - public void dismissPreview(long delay) { - sendMessageDelayed(obtainMessage(MSG_DISMISS_PREVIEW), delay); - } - - public void cancelDismissPreview() { - removeMessages(MSG_DISMISS_PREVIEW); - } - } - /** * Construct a CandidateView for showing suggested words for completion. * @param context @@ -133,7 +107,6 @@ public class CandidateView extends View { mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation); - mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview); mColorNormal = res.getColor(R.color.candidate_normal); mColorRecommended = res.getColor(R.color.candidate_recommended); mColorOther = res.getColor(R.color.candidate_other); @@ -394,7 +367,6 @@ public class CandidateView extends View { invalidate(); Arrays.fill(mWordWidth, 0); Arrays.fill(mWordX, 0); - mPreviewPopup.dismiss(); } @Override @@ -448,8 +420,9 @@ public class CandidateView extends View { } mSelectedString = null; mSelectedIndex = -1; - removeHighlight(); requestLayout(); + hidePreview(); + invalidate(); break; } return true; @@ -468,7 +441,6 @@ public class CandidateView extends View { if (wordIndex == OUT_OF_BOUNDS) { hidePreview(); } else { - mHandler.cancelDismissPreview(); CharSequence word = altText != null? altText : mSuggestions.get(wordIndex); mPreviewText.setText(word); mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), @@ -496,18 +468,12 @@ public class CandidateView extends View { } } } - - private void removeHighlight() { - mTouchX = OUT_OF_BOUNDS; - invalidate(); - } - + private void longPressFirstWord() { CharSequence word = mSuggestions.get(0); if (word.length() < 2) return; if (mService.addWordToDictionary(word.toString())) { showPreview(0, getContext().getResources().getString(R.string.added_word, word)); - mHandler.dismissPreview(mDelayAfterPreview); } } -- cgit v1.2.3-83-g751a From a1cc4f0a8d9a70ff1515d1ddb1476f6ce630afe2 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 30 Sep 2010 17:57:23 +0900 Subject: Long pressing mic/comma key will show settings menue Bug: 3050703 Change-Id: I62773c10f435d13174f6ff6574912cb99303e83c --- java/res/values/bools.xml | 1 + .../inputmethod/latin/LatinKeyboardView.java | 30 ++++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'java/src') diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml index 1f8051bfd..5a24e4c60 100644 --- a/java/res/values/bools.xml +++ b/java/res/values/bools.xml @@ -29,4 +29,5 @@ true true + true diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 2872f6b46..c4afd9a27 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin; import android.content.Context; +import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Paint; import android.inputmethodservice.Keyboard; @@ -41,6 +42,8 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { private Keyboard mPhoneKeyboard; + private final boolean mLongPressCommaForSettingsEnabled; + /** Whether we've started dropping move events because we found a big jump */ private boolean mDroppingEvents; /** @@ -54,11 +57,15 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { private int mLastRowY; public LatinKeyboardView(Context context, AttributeSet attrs) { - super(context, attrs); + this(context, attrs, 0); } public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); + + Resources res = context.getResources(); + mLongPressCommaForSettingsEnabled = res.getBoolean( + R.bool.config_long_press_comma_for_settings_enabled); } public void setPhoneKeyboard(Keyboard phoneKeyboard) { @@ -90,22 +97,25 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { protected boolean onLongPress(Key key) { int primaryCode = key.codes[0]; if (primaryCode == KEYCODE_OPTIONS) { - getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS_LONGPRESS, null, - LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, - LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); - return true; + return invokeOnKey(KEYCODE_OPTIONS_LONGPRESS); } else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) { // Long pressing on 0 in phone number keypad gives you a '+'. - getOnKeyboardActionListener().onKey( - '+', null, - LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, - LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); - return true; + return invokeOnKey('+'); + } else if (primaryCode == KEYCODE_VOICE + || (primaryCode == ',' && mLongPressCommaForSettingsEnabled)) { + return invokeOnKey(KEYCODE_OPTIONS); } else { return super.onLongPress(key); } } + private boolean invokeOnKey(int primaryCode) { + getOnKeyboardActionListener().onKey(primaryCode, null, + LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, + LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); + return true; + } + @Override protected CharSequence adjustCase(CharSequence label) { Keyboard keyboard = getKeyboard(); -- cgit v1.2.3-83-g751a From 4fa67efc790600cce51cee844875b185c16438c1 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 1 Oct 2010 12:42:44 +0900 Subject: Dismiss orange highlight after suggestion has been selected Bug: 3051311 Change-Id: Ia32cd8748a0afade07a9896ad77400cf42aed0f5 --- .../src/com/android/inputmethod/latin/CandidateView.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index 89afd168e..68f288925 100755 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -40,14 +40,15 @@ import java.util.List; public class CandidateView extends View { - private static final int OUT_OF_BOUNDS = -1; + private static final int OUT_OF_BOUNDS_WORD_INDEX = -1; + private static final int OUT_OF_BOUNDS_X_COORD = -1; private LatinIME mService; private final ArrayList mSuggestions = new ArrayList(); private boolean mShowingCompletions; private CharSequence mSelectedString; private int mSelectedIndex; - private int mTouchX = OUT_OF_BOUNDS; + private int mTouchX = OUT_OF_BOUNDS_X_COORD; private final Drawable mSelectionHighlight; private boolean mTypedWordValid; @@ -256,8 +257,8 @@ public class CandidateView extends View { mWordX[i] = x; - if (touchX + scrollX >= x && touchX + scrollX < x + wordWidth && !scrolled && - touchX != OUT_OF_BOUNDS) { + if (touchX != OUT_OF_BOUNDS_X_COORD && !scrolled + && touchX + scrollX >= x && touchX + scrollX < x + wordWidth) { if (canvas != null && !mShowingAddToDictionary) { canvas.translate(x, 0); mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height); @@ -360,7 +361,7 @@ public class CandidateView extends View { // Don't call mSuggestions.clear() because it's being used for logging // in LatinIME.pickSuggestionManually(). mSuggestions.clear(); - mTouchX = OUT_OF_BOUNDS; + mTouchX = OUT_OF_BOUNDS_X_COORD; mSelectedString = null; mSelectedIndex = -1; mShowingAddToDictionary = false; @@ -429,7 +430,8 @@ public class CandidateView extends View { } private void hidePreview() { - mCurrentWordIndex = OUT_OF_BOUNDS; + mTouchX = OUT_OF_BOUNDS_X_COORD; + mCurrentWordIndex = OUT_OF_BOUNDS_WORD_INDEX; mPreviewPopup.dismiss(); } @@ -438,7 +440,7 @@ public class CandidateView extends View { mCurrentWordIndex = wordIndex; // If index changed or changing text if (oldWordIndex != mCurrentWordIndex || altText != null) { - if (wordIndex == OUT_OF_BOUNDS) { + if (wordIndex == OUT_OF_BOUNDS_WORD_INDEX) { hidePreview(); } else { CharSequence word = altText != null? altText : mSuggestions.get(wordIndex); -- cgit v1.2.3-83-g751a From 8e1f1be0f3cfce4ed0623d3d137f53f034f5b718 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 1 Oct 2010 16:42:13 +0900 Subject: Long press mic/comma key bring mini keyboard with settings Bug: 3050703 Change-Id: I090b2bfebfb48e5ec461615d4c911024ea6d130a --- java/res/values/keycodes.xml | 1 + java/res/xml-da/kbd_qwerty.xml | 12 ------- java/res/xml-da/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-de/kbd_qwerty.xml | 12 ------- java/res/xml-de/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-fr/kbd_qwerty.xml | 12 ------- java/res/xml-fr/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-iw/kbd_qwerty.xml | 12 ------- java/res/xml-iw/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-nb/kbd_qwerty.xml | 12 ------- java/res/xml-nb/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-ru/kbd_qwerty.xml | 12 ------- java/res/xml-ru/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-sr/kbd_qwerty.xml | 12 ------- java/res/xml-sr/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml-sv/kbd_qwerty.xml | 12 ------- java/res/xml-sv/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml/kbd_qwerty.xml | 12 ------- java/res/xml/kbd_qwerty_black.xml | 24 ++++--------- java/res/xml/popup_comma.xml | 39 +++++++++++++++++++++ java/res/xml/popup_mic.xml | 40 ++++++++++++++++++++++ .../android/inputmethod/latin/LatinKeyboard.java | 2 ++ .../inputmethod/latin/LatinKeyboardView.java | 10 ------ 23 files changed, 136 insertions(+), 280 deletions(-) create mode 100644 java/res/xml/popup_comma.xml create mode 100644 java/res/xml/popup_mic.xml (limited to 'java/src') diff --git a/java/res/values/keycodes.xml b/java/res/values/keycodes.xml index 9dded508a..c5d5b3cd1 100644 --- a/java/res/values/keycodes.xml +++ b/java/res/values/keycodes.xml @@ -27,5 +27,6 @@ -5 -100 + -102 -103 diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index a17d604bf..084795463 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -176,8 +176,6 @@ android:keyEdgeFlags="left" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + + + + + + + + diff --git a/java/res/xml/popup_mic.xml b/java/res/xml/popup_mic.xml new file mode 100644 index 000000000..f3cc63817 --- /dev/null +++ b/java/res/xml/popup_mic.xml @@ -0,0 +1,40 @@ + + + + + + + + + diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 14a503bc3..43d0a7beb 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -367,11 +367,13 @@ public class LatinKeyboard extends Keyboard { mF1Key.label = null; mF1Key.icon = mMicIcon; mF1Key.iconPreview = mMicPreviewIcon; + mF1Key.popupResId = R.xml.popup_mic; } else { mF1Key.label = ","; mF1Key.codes = new int[] { ',' }; mF1Key.icon = null; mF1Key.iconPreview = null; + mF1Key.popupResId = R.xml.popup_comma; } } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index c4afd9a27..22d39f7aa 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -17,7 +17,6 @@ package com.android.inputmethod.latin; import android.content.Context; -import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Paint; import android.inputmethodservice.Keyboard; @@ -42,8 +41,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { private Keyboard mPhoneKeyboard; - private final boolean mLongPressCommaForSettingsEnabled; - /** Whether we've started dropping move events because we found a big jump */ private boolean mDroppingEvents; /** @@ -62,10 +59,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { public LatinKeyboardView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - - Resources res = context.getResources(); - mLongPressCommaForSettingsEnabled = res.getBoolean( - R.bool.config_long_press_comma_for_settings_enabled); } public void setPhoneKeyboard(Keyboard phoneKeyboard) { @@ -101,9 +94,6 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) { // Long pressing on 0 in phone number keypad gives you a '+'. return invokeOnKey('+'); - } else if (primaryCode == KEYCODE_VOICE - || (primaryCode == ',' && mLongPressCommaForSettingsEnabled)) { - return invokeOnKey(KEYCODE_OPTIONS); } else { return super.onLongPress(key); } -- cgit v1.2.3-83-g751a From 4fc510a7890976d9968d73ceacf3983e77f489d2 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 1 Oct 2010 19:40:44 +0900 Subject: Unbundle Keyboard.java to BaseKeyboard.java Change-Id: I8b310c2c0cae1a151e53c22001c586697346982c --- java/res/values/attrs.xml | 56 ++ java/res/xml-da/kbd_qwerty.xml | 830 ++++++++++----------- java/res/xml-da/kbd_qwerty_black.xml | 620 +++++++-------- java/res/xml-de/kbd_qwerty.xml | 808 ++++++++++---------- java/res/xml-de/kbd_qwerty_black.xml | 598 +++++++-------- java/res/xml-fr/kbd_qwerty.xml | 808 ++++++++++---------- java/res/xml-fr/kbd_qwerty_black.xml | 598 +++++++-------- java/res/xml-iw/kbd_qwerty.xml | 726 +++++++++--------- java/res/xml-iw/kbd_qwerty_black.xml | 516 ++++++------- java/res/xml-nb/kbd_qwerty.xml | 830 ++++++++++----------- java/res/xml-nb/kbd_qwerty_black.xml | 620 +++++++-------- java/res/xml-ru/kbd_qwerty.xml | 794 ++++++++++---------- java/res/xml-ru/kbd_qwerty_black.xml | 584 +++++++-------- java/res/xml-sr/kbd_qwerty.xml | 780 +++++++++---------- java/res/xml-sr/kbd_qwerty_black.xml | 570 +++++++------- java/res/xml-sv/kbd_qwerty.xml | 828 ++++++++++---------- java/res/xml-sv/kbd_qwerty_black.xml | 620 +++++++-------- java/res/xml-xlarge/kbd_popup_template.xml | 10 +- java/res/xml-xlarge/kbd_qwerty.xml | 304 ++++---- java/res/xml-xlarge/kbd_symbols.xml | 164 ++-- java/res/xml-xlarge/kbd_symbols_shift.xml | 164 ++-- java/res/xml/kbd_phone.xml | 104 +-- java/res/xml/kbd_phone_black.xml | 104 +-- java/res/xml/kbd_phone_symbols.xml | 92 +-- java/res/xml/kbd_phone_symbols_black.xml | 92 +-- java/res/xml/kbd_popup_template.xml | 10 +- java/res/xml/kbd_qwerty.xml | 788 +++++++++---------- java/res/xml/kbd_qwerty_black.xml | 578 +++++++------- java/res/xml/kbd_symbols.xml | 290 +++---- java/res/xml/kbd_symbols_black.xml | 248 +++--- java/res/xml/kbd_symbols_shift.xml | 244 +++--- java/res/xml/kbd_symbols_shift_black.xml | 202 ++--- java/res/xml/popup_comma.xml | 22 +- java/res/xml/popup_domains.xml | 32 +- java/res/xml/popup_mic.xml | 24 +- java/res/xml/popup_punctuation.xml | 50 +- java/res/xml/popup_smileys.xml | 86 +-- .../android/inputmethod/latin/BaseKeyboard.java | 804 ++++++++++++++++++++ .../com/android/inputmethod/latin/KeyDetector.java | 7 +- .../com/android/inputmethod/latin/LatinIME.java | 21 +- .../android/inputmethod/latin/LatinImeLogger.java | 3 +- .../android/inputmethod/latin/LatinKeyboard.java | 7 +- .../inputmethod/latin/LatinKeyboardBaseView.java | 23 +- .../inputmethod/latin/LatinKeyboardView.java | 16 +- .../inputmethod/latin/MiniKeyboardKeyDetector.java | 2 +- .../android/inputmethod/latin/PointerTracker.java | 11 +- .../inputmethod/latin/ProximityKeyDetector.java | 2 +- .../android/inputmethod/latin/TextEntryState.java | 3 +- 48 files changed, 8275 insertions(+), 7418 deletions(-) create mode 100644 java/src/com/android/inputmethod/latin/BaseKeyboard.java (limited to 'java/src') diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 995373e84..943a43b70 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -69,4 +69,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 084795463..4aef4b448 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -25,498 +25,498 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" /> + latin:keyLabel="å" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="æ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_ae" /> + latin:keyLabel="ø" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_oe" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-da/kbd_qwerty_black.xml b/java/res/xml-da/kbd_qwerty_black.xml index 9a64e869d..e3b676802 100644 --- a/java/res/xml-da/kbd_qwerty_black.xml +++ b/java/res/xml-da/kbd_qwerty_black.xml @@ -25,440 +25,440 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" /> + latin:keyLabel="å" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="æ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_ae" /> + latin:keyLabel="ø" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_oe" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml index b60c50dd6..6318a9d53 100644 --- a/java/res/xml-de/kbd_qwerty.xml +++ b/java/res/xml-de/kbd_qwerty.xml @@ -19,483 +19,483 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-de/kbd_qwerty_black.xml b/java/res/xml-de/kbd_qwerty_black.xml index 5cca5a622..dfa7ef600 100644 --- a/java/res/xml-de/kbd_qwerty_black.xml +++ b/java/res/xml-de/kbd_qwerty_black.xml @@ -19,425 +19,425 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml index ab78b37bb..80d4d25de 100644 --- a/java/res/xml-fr/kbd_qwerty.xml +++ b/java/res/xml-fr/kbd_qwerty.xml @@ -19,484 +19,484 @@ --> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="m" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="\'" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-fr/kbd_qwerty_black.xml b/java/res/xml-fr/kbd_qwerty_black.xml index 97b55dccd..28bf3f9ef 100644 --- a/java/res/xml-fr/kbd_qwerty_black.xml +++ b/java/res/xml-fr/kbd_qwerty_black.xml @@ -19,426 +19,426 @@ --> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="m" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="\'" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml index a48c849d0..97d9ccbf4 100644 --- a/java/res/xml-iw/kbd_qwerty.xml +++ b/java/res/xml-iw/kbd_qwerty.xml @@ -19,442 +19,442 @@ --> + latin:keyLabel="ק" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ר" /> + latin:keyLabel="א" /> + latin:keyLabel="ט" /> + latin:keyLabel="ו" /> + latin:keyLabel="ן" /> + latin:keyLabel="ם" /> + latin:keyLabel="פ" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="13.75%p" + latin:isModifier="true" + latin:horizontalGap="1.25%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:keyLabel="ש" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ד" /> + latin:keyLabel="ג" /> + latin:keyLabel="כ" /> + latin:keyLabel="ע" /> + latin:keyLabel="י" /> + latin:keyLabel="ח" /> + latin:keyLabel="ל" /> + latin:keyLabel="ך" /> + latin:keyLabel="ף" + latin:keyEdgeFlags="right" /> + latin:keyLabel="ז" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ס" /> + latin:keyLabel="ב" /> + latin:keyLabel="ה" /> + latin:keyLabel="נ" /> + latin:keyLabel="מ" /> + latin:keyLabel="צ" /> + latin:keyLabel="ת" /> + latin:keyLabel="ץ" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-iw/kbd_qwerty_black.xml b/java/res/xml-iw/kbd_qwerty_black.xml index a72b036f4..a7c5a99ea 100644 --- a/java/res/xml-iw/kbd_qwerty_black.xml +++ b/java/res/xml-iw/kbd_qwerty_black.xml @@ -19,384 +19,384 @@ --> + latin:keyLabel="ק" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ר" /> + latin:keyLabel="א" /> + latin:keyLabel="ט" /> + latin:keyLabel="ו" /> + latin:keyLabel="ן" /> + latin:keyLabel="ם" /> + latin:keyLabel="פ" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="13.75%p" + latin:horizontalGap="1.25%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:keyLabel="ש" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ד" /> + latin:keyLabel="ג" /> + latin:keyLabel="כ" /> + latin:keyLabel="ע" /> + latin:keyLabel="י" /> + latin:keyLabel="ח" /> + latin:keyLabel="ל" /> + latin:keyLabel="ך" /> + latin:keyLabel="ף" + latin:keyEdgeFlags="right" /> + latin:keyLabel="ז" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ס" /> + latin:keyLabel="ב" /> + latin:keyLabel="ה" /> + latin:keyLabel="נ" /> + latin:keyLabel="מ" /> + latin:keyLabel="צ" /> + latin:keyLabel="ת" /> + latin:keyLabel="ץ" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml index 7e1610684..8921d5353 100644 --- a/java/res/xml-nb/kbd_qwerty.xml +++ b/java/res/xml-nb/kbd_qwerty.xml @@ -25,498 +25,498 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" /> + latin:keyLabel="å" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="ø" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_oe" /> + latin:keyLabel="æ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_ae" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-nb/kbd_qwerty_black.xml b/java/res/xml-nb/kbd_qwerty_black.xml index f6a034ee9..1497d6796 100644 --- a/java/res/xml-nb/kbd_qwerty_black.xml +++ b/java/res/xml-nb/kbd_qwerty_black.xml @@ -25,440 +25,440 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" /> + latin:keyLabel="å" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="ø" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_oe" /> + latin:keyLabel="æ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_ae" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml index 9f16b9b7d..80ce4d0c6 100644 --- a/java/res/xml-ru/kbd_qwerty.xml +++ b/java/res/xml-ru/kbd_qwerty.xml @@ -19,482 +19,482 @@ --> + latin:keyLabel="й" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="1" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ц" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="2" /> + latin:keyLabel="у" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="3" /> + latin:keyLabel="к" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="4" /> + latin:keyLabel="е" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_cyrillic_e" /> + latin:keyLabel="н" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="6" /> + latin:keyLabel="г" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="7" /> + latin:keyLabel="ш" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="8" /> + latin:keyLabel="щ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="9" /> + latin:keyLabel="з" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="0" /> + latin:keyLabel="х" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="ф" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ы" /> + latin:keyLabel="в" /> + latin:keyLabel="а" /> + latin:keyLabel="п" /> + latin:keyLabel="р" /> + latin:keyLabel="о" /> + latin:keyLabel="л" /> + latin:keyLabel="д" /> + latin:keyLabel="ж" /> + latin:keyLabel="э" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="11.75%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="я" /> + latin:keyLabel="ч" /> + latin:keyLabel="с" /> + latin:keyLabel="м" /> + latin:keyLabel="и" /> + latin:keyLabel="т" /> + latin:keyLabel="ь" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_cyrillic_soft_sign" /> + latin:keyLabel="б" /> + latin:keyLabel="ю" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="11.75%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-ru/kbd_qwerty_black.xml b/java/res/xml-ru/kbd_qwerty_black.xml index 73008befd..c3f120ad2 100644 --- a/java/res/xml-ru/kbd_qwerty_black.xml +++ b/java/res/xml-ru/kbd_qwerty_black.xml @@ -19,424 +19,424 @@ --> + latin:keyLabel="й" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="1" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ц" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="2" /> + latin:keyLabel="у" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="3" /> + latin:keyLabel="к" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="4" /> + latin:keyLabel="е" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_cyrillic_e" /> + latin:keyLabel="н" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="6" /> + latin:keyLabel="г" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="7" /> + latin:keyLabel="ш" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="8" /> + latin:keyLabel="щ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="9" /> + latin:keyLabel="з" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="0" /> + latin:keyLabel="х" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="ф" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ы" /> + latin:keyLabel="в" /> + latin:keyLabel="а" /> + latin:keyLabel="п" /> + latin:keyLabel="р" /> + latin:keyLabel="о" /> + latin:keyLabel="л" /> + latin:keyLabel="д" /> + latin:keyLabel="ж" /> + latin:keyLabel="э" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="11.75%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="я" /> + latin:keyLabel="ч" /> + latin:keyLabel="с" /> + latin:keyLabel="м" /> + latin:keyLabel="и" /> + latin:keyLabel="т" /> + latin:keyLabel="ь" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_cyrillic_soft_sign" /> + latin:keyLabel="б" /> + latin:keyLabel="ю" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="11.75%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-sr/kbd_qwerty.xml b/java/res/xml-sr/kbd_qwerty.xml index c671166d1..7cc477070 100644 --- a/java/res/xml-sr/kbd_qwerty.xml +++ b/java/res/xml-sr/kbd_qwerty.xml @@ -20,474 +20,474 @@ + latin:keyLabel="љ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="1" + latin:keyEdgeFlags="left" /> + latin:keyLabel="њ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="2" /> + latin:keyLabel="е" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="3" /> + latin:keyLabel="р" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="4" /> + latin:keyLabel="т" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="5" /> + latin:keyLabel="з" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="6" /> + latin:keyLabel="у" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="7" /> + latin:keyLabel="и" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="8" /> + latin:keyLabel="о" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="9" /> + latin:keyLabel="п" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="0" /> + latin:keyLabel="ш" + latin:keyEdgeFlags="right" /> + latin:keyLabel="а" + latin:keyEdgeFlags="left" /> + latin:keyLabel="с" /> + latin:keyLabel="д" /> + latin:keyLabel="ф" /> + latin:keyLabel="г" /> + latin:keyLabel="х" /> + latin:keyLabel="ј" /> + latin:keyLabel="к" /> + latin:keyLabel="л" /> + latin:keyLabel="ч" /> + latin:keyLabel="ћ" /> + latin:keyLabel="ђ" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="11.75%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ж" /> + latin:keyLabel="џ" /> + latin:keyLabel="ц" /> + latin:keyLabel="в" /> + latin:keyLabel="б" /> + latin:keyLabel="н" /> + latin:keyLabel="м" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="11.75%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-sr/kbd_qwerty_black.xml b/java/res/xml-sr/kbd_qwerty_black.xml index 5e5bceec0..d61ff3e8f 100644 --- a/java/res/xml-sr/kbd_qwerty_black.xml +++ b/java/res/xml-sr/kbd_qwerty_black.xml @@ -20,416 +20,416 @@ + latin:keyLabel="љ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="1" + latin:keyEdgeFlags="left" /> + latin:keyLabel="њ" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="2" /> + latin:keyLabel="е" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="3" /> + latin:keyLabel="р" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="4" /> + latin:keyLabel="т" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="5" /> + latin:keyLabel="з" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="6" /> + latin:keyLabel="у" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="7" /> + latin:keyLabel="и" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="8" /> + latin:keyLabel="о" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="9" /> + latin:keyLabel="п" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="0" /> + latin:keyLabel="ш" + latin:keyEdgeFlags="right" /> + latin:keyLabel="а" + latin:keyEdgeFlags="left" /> + latin:keyLabel="с" /> + latin:keyLabel="д" /> + latin:keyLabel="ф" /> + latin:keyLabel="г" /> + latin:keyLabel="х" /> + latin:keyLabel="ј" /> + latin:keyLabel="к" /> + latin:keyLabel="л" /> + latin:keyLabel="ч" /> + latin:keyLabel="ћ" /> + latin:keyLabel="ђ" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="11.75%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="ж" /> + latin:keyLabel="џ" /> + latin:keyLabel="ц" /> + latin:keyLabel="в" /> + latin:keyLabel="б" /> + latin:keyLabel="н" /> + latin:keyLabel="м" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="11.75%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-sv/kbd_qwerty.xml b/java/res/xml-sv/kbd_qwerty.xml index 44117fc1f..2c584e26f 100644 --- a/java/res/xml-sv/kbd_qwerty.xml +++ b/java/res/xml-sv/kbd_qwerty.xml @@ -27,497 +27,497 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" /> + latin:keyLabel="å" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="ö" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o_umlaut" /> + latin:keyLabel="ä" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a_umlaut" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml-sv/kbd_qwerty_black.xml b/java/res/xml-sv/kbd_qwerty_black.xml index 13ed3d1bf..90dca89bc 100644 --- a/java/res/xml-sv/kbd_qwerty_black.xml +++ b/java/res/xml-sv/kbd_qwerty_black.xml @@ -27,440 +27,440 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" /> + latin:keyLabel="å" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel="ö" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o_umlaut" /> + latin:keyLabel="ä" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a_umlaut" + latin:keyWidth="8.75%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml-xlarge/kbd_popup_template.xml b/java/res/xml-xlarge/kbd_popup_template.xml index 0e67a18d4..382d90afc 100644 --- a/java/res/xml-xlarge/kbd_popup_template.xml +++ b/java/res/xml-xlarge/kbd_popup_template.xml @@ -18,10 +18,10 @@ */ --> - diff --git a/java/res/xml-xlarge/kbd_qwerty.xml b/java/res/xml-xlarge/kbd_qwerty.xml index 80fb8884e..a76eff05a 100644 --- a/java/res/xml-xlarge/kbd_qwerty.xml +++ b/java/res/xml-xlarge/kbd_qwerty.xml @@ -19,198 +19,198 @@ --> - - - - - - - - - - - - + latin:codes="@integer/key_tab" + latin:keyLabel="Tab" + latin:keyEdgeFlags="left" /> + + + + + + + + + + + + + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="8.75%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" /> + latin:keyLabel=";" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters=":" /> + latin:keyLabel="\'" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters=""" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_keyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="8.75%p" + latin:isModifier="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="12.5%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:keyLabel="," + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="*" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="!" /> + latin:keyLabel="/" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="\?" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="12.5%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="right" /> + latin:keyLabel="(" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="<" + latin:horizontalGap="16.25%p" /> + latin:keyLabel=")" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters=">" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_keyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="37.5%p" + latin:isModifier="true" /> + latin:keyLabel="_" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="\@" /> + latin:keyLabel="-" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="#" /> diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml index 462672623..7d23dc540 100644 --- a/java/res/xml-xlarge/kbd_symbols.xml +++ b/java/res/xml-xlarge/kbd_symbols.xml @@ -19,140 +19,140 @@ --> + latin:codes="@integer/key_tab" + latin:keyLabel="Tab" + latin:keyEdgeFlags="left" /> + latin:keyLabel="1" /> + latin:keyLabel="2" /> + latin:keyLabel="3" /> + latin:keyLabel="4" /> + latin:keyLabel="5" /> + latin:keyLabel="6" /> + latin:keyLabel="7" /> + latin:keyLabel="8" /> + latin:keyLabel="9" /> + latin:keyLabel="0" /> + latin:keyLabel="~" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="10.5%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="8.75%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:keyLabel="#" /> + latin:keyLabel="$" /> + latin:keyLabel="%" /> + latin:keyLabel="^" /> + latin:keyLabel="&" /> + latin:keyLabel="*" /> + latin:keyLabel="-" /> + latin:keyLabel="+" /> + latin:keyLabel="(" /> + latin:keyLabel=")" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_keyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="8.75%p" + latin:isModifier="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="12.5%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="!" /> + latin:keyLabel=""" /> + latin:keyLabel="\'" /> + latin:keyLabel=":" /> + latin:keyLabel=";" /> + latin:keyLabel="/" /> + latin:keyLabel="\\" /> + latin:keyLabel="," /> + latin:keyLabel="." /> + latin:keyLabel="\?" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="12.5%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="right" /> + latin:keyLabel="<" + latin:horizontalGap="16.25%p" /> + latin:keyLabel=">" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_keyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="37.5%p" + latin:isModifier="true" /> + latin:keyLabel="[" /> + latin:keyLabel="]" /> diff --git a/java/res/xml-xlarge/kbd_symbols_shift.xml b/java/res/xml-xlarge/kbd_symbols_shift.xml index f02174a91..6680d9655 100644 --- a/java/res/xml-xlarge/kbd_symbols_shift.xml +++ b/java/res/xml-xlarge/kbd_symbols_shift.xml @@ -19,140 +19,140 @@ --> + latin:codes="@integer/key_tab" + latin:keyLabel="Tab" + latin:keyEdgeFlags="left" /> + latin:keyLabel="∞" /> + latin:keyLabel="±" /> + latin:keyLabel="|" /> + latin:keyLabel="•" /> + latin:keyLabel="√" /> + latin:keyLabel="π" /> + latin:keyLabel="÷" /> + latin:keyLabel="×" /> + latin:keyLabel="±" /> + latin:keyLabel="∆" /> + latin:keyLabel="≈" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="10.5%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="8.75%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="£" /> + latin:keyLabel="¢" /> + latin:keyLabel="¥" /> + latin:keyLabel="€" /> + latin:keyLabel="¼" /> + latin:keyLabel="½" /> + latin:keyLabel="¾" /> + latin:keyLabel="_" /> + latin:keyLabel="=" /> + latin:keyLabel="{" /> + latin:keyLabel="}" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_keyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="8.75%p" + latin:isModifier="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="12.5%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="¡" /> + latin:keyLabel="°" /> + latin:keyLabel="©" /> + latin:keyLabel="®" /> + latin:keyLabel="¶" /> + latin:keyLabel="§" /> + latin:keyLabel="¤" /> + latin:keyLabel="¬" /> + latin:keyLabel="…" /> + latin:keyLabel="¿" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="12.5%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="right" /> + latin:keyLabel="≤" + latin:horizontalGap="16.25%p" /> + latin:keyLabel="≥" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_keyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="37.5%p" + latin:isModifier="true" /> + latin:keyLabel="²" /> + latin:keyLabel="³" /> diff --git a/java/res/xml/kbd_phone.xml b/java/res/xml/kbd_phone.xml index 9f381b905..e036cd6d9 100644 --- a/java/res/xml/kbd_phone.xml +++ b/java/res/xml/kbd_phone.xml @@ -19,83 +19,83 @@ --> + latin:codes="49" + latin:keyIcon="@drawable/sym_keyboard_num1" + latin:keyEdgeFlags="left" /> + latin:codes="50" + latin:keyIcon="@drawable/sym_keyboard_num2" /> + latin:codes="51" + latin:keyIcon="@drawable/sym_keyboard_num3" /> + latin:keyLabel="-" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="52" + latin:keyIcon="@drawable/sym_keyboard_num4" + latin:keyEdgeFlags="left" /> + latin:codes="53" + latin:keyIcon="@drawable/sym_keyboard_num5" /> + latin:codes="54" + latin:keyIcon="@drawable/sym_keyboard_num6" /> + latin:keyLabel="." + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="55" + latin:keyIcon="@drawable/sym_keyboard_num7" + latin:keyEdgeFlags="left" /> + latin:codes="56" + latin:keyIcon="@drawable/sym_keyboard_num8" /> + latin:codes="57" + latin:keyIcon="@drawable/sym_keyboard_num9" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="20%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyIcon="@drawable/sym_keyboard_numalt" + latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" /> + latin:codes="48" + latin:keyIcon="@drawable/sym_keyboard_num0" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_keyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_keyboard_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/kbd_phone_black.xml b/java/res/xml/kbd_phone_black.xml index 7a956b796..52479459c 100644 --- a/java/res/xml/kbd_phone_black.xml +++ b/java/res/xml/kbd_phone_black.xml @@ -19,83 +19,83 @@ --> + latin:codes="49" + latin:keyIcon="@drawable/sym_bkeyboard_num1" + latin:keyEdgeFlags="left" /> + latin:codes="50" + latin:keyIcon="@drawable/sym_bkeyboard_num2" /> + latin:codes="51" + latin:keyIcon="@drawable/sym_bkeyboard_num3" /> + latin:keyLabel="-" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="52" + latin:keyIcon="@drawable/sym_bkeyboard_num4" + latin:keyEdgeFlags="left" /> + latin:codes="53" + latin:keyIcon="@drawable/sym_bkeyboard_num5" /> + latin:codes="54" + latin:keyIcon="@drawable/sym_bkeyboard_num6" /> + latin:keyLabel="." + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="55" + latin:keyIcon="@drawable/sym_bkeyboard_num7" + latin:keyEdgeFlags="left" /> + latin:codes="56" + latin:keyIcon="@drawable/sym_bkeyboard_num8" /> + latin:codes="57" + latin:keyIcon="@drawable/sym_bkeyboard_num9" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="20%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyIcon="@drawable/sym_bkeyboard_numalt" + latin:iconPreview="@drawable/sym_keyboard_feedback_numalt" /> + latin:codes="48" + latin:keyIcon="@drawable/sym_bkeyboard_num0" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/kbd_phone_symbols.xml b/java/res/xml/kbd_phone_symbols.xml index 598e211f5..09146e7af 100644 --- a/java/res/xml/kbd_phone_symbols.xml +++ b/java/res/xml/kbd_phone_symbols.xml @@ -19,80 +19,80 @@ --> + latin:keyLabel="(" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:keyLabel=")" /> + latin:keyLabel="-" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="N" + latin:keyEdgeFlags="left" /> + latin:codes="44" + latin:keyLabel="Pause" /> + latin:keyLabel="," /> + latin:keyLabel="." + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="42" + latin:keyIcon="@drawable/sym_keyboard_numstar" + latin:keyEdgeFlags="left" /> + latin:codes="59" + latin:keyLabel="Wait" /> + latin:codes="35" + latin:keyIcon="@drawable/sym_keyboard_numpound" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="20%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_phone_key" + latin:keyEdgeFlags="left" /> + latin:keyLabel="+" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_keyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_keyboard_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/kbd_phone_symbols_black.xml b/java/res/xml/kbd_phone_symbols_black.xml index 5bc628965..8b683cc6c 100644 --- a/java/res/xml/kbd_phone_symbols_black.xml +++ b/java/res/xml/kbd_phone_symbols_black.xml @@ -19,80 +19,80 @@ --> + latin:keyLabel="(" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:keyLabel=")" /> + latin:keyLabel="-" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="N" + latin:keyEdgeFlags="left" /> + latin:codes="44" + latin:keyLabel="Pause" /> + latin:keyLabel="," /> + latin:keyLabel="." + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="42" + latin:keyIcon="@drawable/sym_bkeyboard_numstar" + latin:keyEdgeFlags="left" /> + latin:codes="59" + latin:keyLabel="Wait" /> + latin:codes="35" + latin:keyIcon="@drawable/sym_bkeyboard_numpound" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="20%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_phone_key" + latin:keyEdgeFlags="left" /> + latin:keyLabel="+" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_popup_template.xml index aca46930f..cbb705835 100644 --- a/java/res/xml/kbd_popup_template.xml +++ b/java/res/xml/kbd_popup_template.xml @@ -18,10 +18,10 @@ */ --> - diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index 446467fa4..5e68fd688 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -19,473 +19,473 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_keyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + - - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + + diff --git a/java/res/xml/kbd_qwerty_black.xml b/java/res/xml/kbd_qwerty_black.xml index f44c24fad..fff409340 100644 --- a/java/res/xml/kbd_qwerty_black.xml +++ b/java/res/xml/kbd_qwerty_black.xml @@ -19,415 +19,415 @@ --> + latin:keyLabel="q" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_q" + latin:keyEdgeFlags="left" /> + latin:keyLabel="w" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_w" /> + latin:keyLabel="e" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_e" /> + latin:keyLabel="r" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_r" /> + latin:keyLabel="t" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_t" /> + latin:keyLabel="y" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_y" /> + latin:keyLabel="u" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_u" /> + latin:keyLabel="i" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_i" /> + latin:keyLabel="o" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_o" /> + latin:keyLabel="p" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_p" + latin:keyEdgeFlags="right" /> + latin:keyLabel="a" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_a" + latin:horizontalGap="5%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="s" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_s" /> + latin:keyLabel="d" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_d" /> + latin:keyLabel="f" /> + latin:keyLabel="g" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_g" /> + latin:keyLabel="h" /> + latin:keyLabel="j" /> + latin:keyLabel="k" /> + latin:keyLabel="l" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_l" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyIcon="@drawable/sym_bkeyboard_shift" + latin:iconPreview="@drawable/sym_keyboard_feedback_shift" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="z" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_z" /> + latin:keyLabel="x" /> + latin:keyLabel="c" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_c" /> + latin:keyLabel="v" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_v" /> + latin:keyLabel="b" /> + latin:keyLabel="n" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="@string/alternates_for_n" /> + latin:keyLabel="m" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="20%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" + latin:keyWidth="20%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="/" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="\@" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:popupKeyboard="@xml/popup_smileys" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_symbol_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:codes="@integer/key_tab" + latin:keyIcon="@drawable/sym_bkeyboard_tab" + latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="15%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml index cb8b3b38f..4cdc53947 100644 --- a/java/res/xml/kbd_symbols.xml +++ b/java/res/xml/kbd_symbols.xml @@ -19,194 +19,194 @@ --> + latin:keyLabel="1" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¹½⅓¼⅛" + latin:keyEdgeFlags="left" /> + latin:keyLabel="2" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="²⅔" /> + latin:keyLabel="3" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="³¾⅜" /> + latin:keyLabel="4" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="⁴" /> + latin:keyLabel="5" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="⅝" /> + latin:keyLabel="6" /> + latin:keyLabel="7" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="⅞" /> + latin:keyLabel="8" /> + latin:keyLabel="9" /> + latin:keyLabel="0" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="ⁿ∅" + latin:keyEdgeFlags="right" /> + latin:keyLabel="\@" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\#" /> + latin:keyLabel="$" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¢£€¥₣₤₱" /> + latin:keyLabel="%" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="‰" /> + latin:keyLabel="&" /> + latin:keyLabel="*" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="†‡★" /> + latin:keyLabel="-" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="_–—" /> + latin:keyLabel="+" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="±" /> + latin:keyLabel="(" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="[{<" /> + latin:keyLabel=")" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="]}>" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyLabel="@string/label_alt_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="!" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¡" /> + latin:keyLabel=""" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="“”«»˝" /> + latin:keyLabel="\'" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="‘’" /> + latin:keyLabel=":" /> + latin:keyLabel=";" /> + latin:keyLabel="/" /> + latin:keyLabel="\?" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¿" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml index bfb1646f4..cb695f534 100644 --- a/java/res/xml/kbd_symbols_black.xml +++ b/java/res/xml/kbd_symbols_black.xml @@ -19,182 +19,182 @@ --> + latin:keyLabel="1" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¹½⅓¼⅛" + latin:keyEdgeFlags="left" /> + latin:keyLabel="2" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="²⅔" /> + latin:keyLabel="3" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="³¾⅜" /> + latin:keyLabel="4" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="⁴" /> + latin:keyLabel="5" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="⅝" /> + latin:keyLabel="6" /> + latin:keyLabel="7" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="⅞" /> + latin:keyLabel="8" /> + latin:keyLabel="9" /> + latin:keyLabel="0" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="ⁿ∅" + latin:keyEdgeFlags="right" /> + latin:keyLabel="\@" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\#" /> + latin:keyLabel="$" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¢£€¥₣₤₱" /> + latin:keyLabel="%" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="‰" /> + latin:keyLabel="&" /> + latin:keyLabel="*" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="†‡★" /> + latin:keyLabel="-" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="_–—" /> + latin:keyLabel="+" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="±" /> + latin:keyLabel="(" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="[{<" /> + latin:keyLabel=")" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="]}>" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyLabel="@string/label_alt_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="!" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¡" /> + latin:keyLabel=""" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="“”«»˝" /> + latin:keyLabel="\'" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="‘’" /> + latin:keyLabel=":" /> + latin:keyLabel=";" /> + latin:keyLabel="/" /> + latin:keyLabel="\?" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="¿" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="." + latin:popupKeyboard="@xml/popup_punctuation" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml index 21cbb7132..e346384aa 100644 --- a/java/res/xml/kbd_symbols_shift.xml +++ b/java/res/xml/kbd_symbols_shift.xml @@ -19,171 +19,171 @@ --> + latin:keyLabel="~" + latin:keyEdgeFlags="left" /> + latin:keyLabel="`" /> + latin:keyLabel="|" /> + latin:keyLabel="•" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="♪♥♠♦♣" /> + latin:keyLabel="√" /> + latin:keyLabel="π" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="Π" /> + latin:keyLabel="÷" /> + latin:keyLabel="×" /> + latin:keyLabel="{" /> + latin:keyLabel="}" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_tab" + latin:keyLabel="\u21E5" + latin:keyEdgeFlags="left" /> + latin:keyLabel="£" /> + latin:keyLabel="¢" /> + latin:keyLabel="€" /> + latin:keyLabel="°" /> + latin:keyLabel="^" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="↑↓←→" /> + latin:keyLabel="_" /> + latin:keyLabel="=" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="≠≈∞" /> + latin:keyLabel="[" /> + latin:keyLabel="]" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyLabel="@string/label_alt_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="™" /> + latin:keyLabel="®" /> + latin:keyLabel="©" /> + latin:keyLabel="¶" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="§" /> + latin:keyLabel="\\" /> + latin:keyLabel="<" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="≤«‹" /> + latin:keyLabel=">" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="≥»›" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_keyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="20%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + - - - - - + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:keyEdgeFlags="left" /> + + + + + diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml index d5d49ce0d..a15749212 100644 --- a/java/res/xml/kbd_symbols_shift_black.xml +++ b/java/res/xml/kbd_symbols_shift_black.xml @@ -19,159 +19,159 @@ --> + latin:keyLabel="~" + latin:keyEdgeFlags="left" /> + latin:keyLabel="`" /> + latin:keyLabel="|" /> + latin:keyLabel="•" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="♪♥♠♦♣" /> + latin:keyLabel="√" /> + latin:keyLabel="π" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="Π" /> + latin:keyLabel="÷" /> + latin:keyLabel="×" /> + latin:keyLabel="{" /> + latin:keyLabel="}" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_tab" + latin:keyLabel="\u21E5" + latin:keyEdgeFlags="left" /> + latin:keyLabel="£" /> + latin:keyLabel="¢" /> + latin:keyLabel="€" /> + latin:keyLabel="°" /> + latin:keyLabel="^" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="↑↓←→" /> + latin:keyLabel="_" /> + latin:keyLabel="=" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="≠≈∞" /> + latin:keyLabel="[" /> + latin:keyLabel="]" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_shift" + latin:keyLabel="@string/label_alt_key" + latin:keyWidth="15%p" + latin:isModifier="true" + latin:isSticky="true" + latin:keyEdgeFlags="left" /> + latin:keyLabel="™" /> + latin:keyLabel="®" /> + latin:keyLabel="©" /> + latin:keyLabel="¶" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="§" /> + latin:keyLabel="\\" /> + latin:keyLabel="<" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="≤«‹" /> + latin:keyLabel=">" + latin:popupKeyboard="@xml/kbd_popup_template" + latin:popupCharacters="≥»›" /> + latin:codes="@integer/key_delete" + latin:keyIcon="@drawable/sym_bkeyboard_delete" + latin:iconPreview="@drawable/sym_keyboard_feedback_delete" + latin:keyWidth="15%p" + latin:isRepeatable="true" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="20%p" + latin:keyEdgeFlags="left" /> + latin:keyLabel="„" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="40%p" /> + latin:keyLabel="…" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="20%p" + latin:keyEdgeFlags="right" /> + latin:codes="@integer/key_symbol" + latin:keyLabel="@string/label_alpha_key" + latin:keyWidth="15%p" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_bkeyboard_settings" + latin:iconPreview="@drawable/sym_keyboard_feedback_settings" /> + latin:keyLabel="„" /> + latin:codes="@integer/key_space" + latin:keyIcon="@drawable/sym_bkeyboard_space" + latin:iconPreview="@drawable/sym_keyboard_feedback_space" + latin:keyWidth="30%p" /> + latin:keyLabel="…" /> + latin:codes="@integer/key_return" + latin:keyIcon="@drawable/sym_bkeyboard_return" + latin:iconPreview="@drawable/sym_keyboard_feedback_return" + latin:keyWidth="25%p" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/popup_comma.xml b/java/res/xml/popup_comma.xml index 540dc9615..4e88f26c4 100644 --- a/java/res/xml/popup_comma.xml +++ b/java/res/xml/popup_comma.xml @@ -19,21 +19,21 @@ --> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_keyboard_settings" + latin:keyEdgeFlags="left" /> + latin:keyLabel="," + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/popup_domains.xml b/java/res/xml/popup_domains.xml index 0f7d97691..c110ef6c2 100644 --- a/java/res/xml/popup_domains.xml +++ b/java/res/xml/popup_domains.xml @@ -19,28 +19,28 @@ --> + latin:keyLabel="@string/popular_domain_1" + latin:keyOutputText="@string/popular_domain_1" + latin:keyEdgeFlags="left" /> + latin:keyLabel="@string/popular_domain_2" + latin:keyOutputText="@string/popular_domain_2" /> + latin:keyLabel="@string/popular_domain_3" + latin:keyOutputText="@string/popular_domain_3" /> + latin:keyLabel="@string/popular_domain_4" + latin:keyOutputText="@string/popular_domain_4" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/popup_mic.xml b/java/res/xml/popup_mic.xml index f3cc63817..f5ef6eeb0 100644 --- a/java/res/xml/popup_mic.xml +++ b/java/res/xml/popup_mic.xml @@ -19,22 +19,22 @@ --> + latin:codes="@integer/key_settings" + latin:keyIcon="@drawable/sym_keyboard_settings" + latin:keyEdgeFlags="left" /> + latin:codes="@integer/key_voice" + latin:keyIcon="@drawable/sym_keyboard_mic" + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/popup_punctuation.xml b/java/res/xml/popup_punctuation.xml index ee1feabec..ecbf09f72 100644 --- a/java/res/xml/popup_punctuation.xml +++ b/java/res/xml/popup_punctuation.xml @@ -19,50 +19,50 @@ --> + latin:keyLabel=":" + latin:keyEdgeFlags="left" /> + latin:keyLabel="/" /> + latin:keyLabel="&" /> + latin:keyLabel="(" /> + latin:keyLabel=")" /> + latin:keyLabel="-" /> + latin:keyLabel="+" + latin:keyEdgeFlags="right" /> + latin:keyLabel=";" + latin:keyEdgeFlags="left" /> + latin:keyLabel="\@" /> + latin:keyLabel="\'" /> + latin:keyLabel=""" /> + latin:keyLabel="\?" /> + latin:keyLabel="!" /> + latin:keyLabel="," + latin:keyEdgeFlags="right" /> diff --git a/java/res/xml/popup_smileys.xml b/java/res/xml/popup_smileys.xml index 3b556da77..33006f6ec 100644 --- a/java/res/xml/popup_smileys.xml +++ b/java/res/xml/popup_smileys.xml @@ -19,71 +19,71 @@ --> + latin:keyLabel=":-)" + latin:keyOutputText=":-) " + latin:keyEdgeFlags="left" /> + latin:keyLabel=":-(" + latin:keyOutputText=":-( " /> + latin:keyLabel=";-)" + latin:keyOutputText=";-) " /> + latin:keyLabel=":-P" + latin:keyOutputText=":-P " /> + latin:keyLabel="=-O" + latin:keyOutputText="=-O " + latin:keyEdgeFlags="right" /> + latin:keyLabel=":-*" + latin:keyOutputText=":-* " + latin:keyEdgeFlags="left" /> + latin:keyLabel=":O" + latin:keyOutputText=":O " /> + latin:keyLabel="B-)" + latin:keyOutputText="B-) " /> + latin:keyLabel=":-$" + latin:keyOutputText=":-$ " /> + latin:keyLabel=":-!" + latin:keyOutputText=":-! " + latin:keyEdgeFlags="right" /> + latin:keyLabel=":-[" + latin:keyOutputText=":-[ " + latin:keyEdgeFlags="left" /> + latin:keyLabel="O:-)" + latin:keyOutputText="O:-) " /> + latin:keyLabel=":-\\" + latin:keyOutputText=":-\\ " /> + latin:keyLabel=":'(" + latin:keyOutputText=":'( " /> + latin:keyLabel=":-D" + latin:keyOutputText=":-D " + latin:keyEdgeFlags="right" /> diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java new file mode 100644 index 000000000..f1a08cb4a --- /dev/null +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -0,0 +1,804 @@ +/* + * Copyright (C) 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.android.inputmethod.latin; + +import org.xmlpull.v1.XmlPullParserException; + +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.content.res.XmlResourceParser; +import android.graphics.drawable.Drawable; +import android.text.TextUtils; +import android.util.Log; +import android.util.TypedValue; +import android.util.Xml; +import android.util.DisplayMetrics; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + + +/** + * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard + * consists of rows of keys. + *

The layout file for a keyboard contains XML that looks like the following snippet:

+ *
+ * <Keyboard
+ *         latin:keyWidth="%10p"
+ *         latin:keyHeight="50px"
+ *         latin:horizontalGap="2px"
+ *         latin:verticalGap="2px" >
+ *     <Row latin:keyWidth="32px" >
+ *         <Key latin:keyLabel="A" />
+ *         ...
+ *     </Row>
+ *     ...
+ * </Keyboard>
+ * 
+ */ +public class BaseKeyboard { + + static final String TAG = "BaseKeyboard"; + + // Keyboard XML Tags + private static final String TAG_KEYBOARD = "Keyboard"; + private static final String TAG_ROW = "Row"; + private static final String TAG_KEY = "Key"; + + public static final int EDGE_LEFT = 0x01; + public static final int EDGE_RIGHT = 0x02; + public static final int EDGE_TOP = 0x04; + public static final int EDGE_BOTTOM = 0x08; + + public static final int KEYCODE_SHIFT = -1; + public static final int KEYCODE_MODE_CHANGE = -2; + public static final int KEYCODE_CANCEL = -3; + public static final int KEYCODE_DONE = -4; + public static final int KEYCODE_DELETE = -5; + public static final int KEYCODE_ALT = -6; + + /** Horizontal gap default for all rows */ + private int mDefaultHorizontalGap; + + /** Default key width */ + private int mDefaultWidth; + + /** Default key height */ + private int mDefaultHeight; + + /** Default gap between rows */ + private int mDefaultVerticalGap; + + /** Is the keyboard in the shifted state */ + private boolean mShifted; + + /** Key instance for the shift key, if present */ + private Key mShiftKey; + + /** Key index for the shift key, if present */ + private int mShiftKeyIndex = -1; + + /** Total height of the keyboard, including the padding and keys */ + private int mTotalHeight; + + /** + * Total width of the keyboard, including left side gaps and keys, but not any gaps on the + * right side. + */ + private int mTotalWidth; + + /** List of keys in this keyboard */ + private List mKeys; + + /** List of modifier keys such as Shift & Alt, if any */ + private List mModifierKeys; + + /** Width of the screen available to fit the keyboard */ + private int mDisplayWidth; + + /** Height of the screen */ + private int mDisplayHeight; + + /** Keyboard mode, or zero, if none. */ + private int mKeyboardMode; + + // Variables for pre-computing nearest keys. + + private static final int GRID_WIDTH = 10; + private static final int GRID_HEIGHT = 5; + private static final int GRID_SIZE = GRID_WIDTH * GRID_HEIGHT; + private int mCellWidth; + private int mCellHeight; + private int[][] mGridNeighbors; + private int mProximityThreshold; + /** Number of key widths from current touch point to search for nearest keys. */ + private static float SEARCH_DISTANCE = 1.8f; + + /** + * Container for keys in the keyboard. All keys in a row are at the same Y-coordinate. + * Some of the key size defaults can be overridden per row from what the {@link Keyboard} + * defines. + */ + public static class Row { + /** Default width of a key in this row. */ + public int defaultWidth; + /** Default height of a key in this row. */ + public int defaultHeight; + /** Default horizontal gap between keys in this row. */ + public int defaultHorizontalGap; + /** Vertical gap following this row. */ + public int verticalGap; + /** + * Edge flags for this row of keys. Possible values that can be assigned are + * {@link Keyboard#EDGE_TOP EDGE_TOP} and {@link Keyboard#EDGE_BOTTOM EDGE_BOTTOM} + */ + public int rowEdgeFlags; + + /** The keyboard mode for this row */ + public int mode; + + private BaseKeyboard parent; + + public Row(BaseKeyboard parent) { + this.parent = parent; + } + + public Row(Resources res, BaseKeyboard parent, XmlResourceParser parser) { + this.parent = parent; + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + defaultWidth = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, + parent.mDisplayWidth, parent.mDefaultWidth); + defaultHeight = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, + parent.mDisplayHeight, parent.mDefaultHeight); + defaultHorizontalGap = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, + parent.mDisplayWidth, parent.mDefaultHorizontalGap); + verticalGap = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_verticalGap, + parent.mDisplayHeight, parent.mDefaultVerticalGap); + a.recycle(); + a = res.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard_Row); + rowEdgeFlags = a.getInt(R.styleable.BaseKeyboard_Row_rowEdgeFlags, 0); + mode = a.getResourceId(R.styleable.BaseKeyboard_Row_keyboardMode, + 0); + } + } + + /** + * Class for describing the position and characteristics of a single key in the keyboard. + */ + public static class Key { + /** + * All the key codes (unicode or custom code) that this key could generate, zero'th + * being the most important. + */ + public int[] codes; + + /** Label to display */ + public CharSequence label; + + /** Icon to display instead of a label. Icon takes precedence over a label */ + public Drawable icon; + /** Preview version of the icon, for the preview popup */ + public Drawable iconPreview; + /** Width of the key, not including the gap */ + public int width; + /** Height of the key, not including the gap */ + public int height; + /** The horizontal gap before this key */ + public int gap; + /** Whether this key is sticky, i.e., a toggle key */ + public boolean sticky; + /** X coordinate of the key in the keyboard layout */ + public int x; + /** Y coordinate of the key in the keyboard layout */ + public int y; + /** The current pressed state of this key */ + public boolean pressed; + /** If this is a sticky key, is it on? */ + public boolean on; + /** Text to output when pressed. This can be multiple characters, like ".com" */ + public CharSequence text; + /** Popup characters */ + public CharSequence popupCharacters; + + /** + * Flags that specify the anchoring to edges of the keyboard for detecting touch events + * that are just out of the boundary of the key. This is a bit mask of + * {@link Keyboard#EDGE_LEFT}, {@link Keyboard#EDGE_RIGHT}, {@link Keyboard#EDGE_TOP} and + * {@link Keyboard#EDGE_BOTTOM}. + */ + public int edgeFlags; + /** Whether this is a modifier key, such as Shift or Alt */ + public boolean modifier; + /** The BaseKeyboard that this key belongs to */ + private BaseKeyboard keyboard; + /** + * If this key pops up a mini keyboard, this is the resource id for the XML layout for that + * keyboard. + */ + public int popupResId; + /** Whether this key repeats itself when held down */ + public boolean repeatable; + + + private final static int[] KEY_STATE_NORMAL_ON = { + android.R.attr.state_checkable, + android.R.attr.state_checked + }; + + private final static int[] KEY_STATE_PRESSED_ON = { + android.R.attr.state_pressed, + android.R.attr.state_checkable, + android.R.attr.state_checked + }; + + private final static int[] KEY_STATE_NORMAL_OFF = { + android.R.attr.state_checkable + }; + + private final static int[] KEY_STATE_PRESSED_OFF = { + android.R.attr.state_pressed, + android.R.attr.state_checkable + }; + + private final static int[] KEY_STATE_NORMAL = { + }; + + private final static int[] KEY_STATE_PRESSED = { + android.R.attr.state_pressed + }; + + /** Create an empty key with no attributes. */ + public Key(Row parent) { + keyboard = parent.parent; + height = parent.defaultHeight; + width = parent.defaultWidth; + gap = parent.defaultHorizontalGap; + edgeFlags = parent.rowEdgeFlags; + } + + /** Create a key with the given top-left coordinate and extract its attributes from + * the XML parser. + * @param res resources associated with the caller's context + * @param parent the row that this key belongs to. The row must already be attached to + * a {@link Keyboard}. + * @param x the x coordinate of the top-left + * @param y the y coordinate of the top-left + * @param parser the XML parser containing the attributes for this key + */ + public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) { + this(parent); + + this.x = x; + this.y = y; + + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + + width = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, + keyboard.mDisplayWidth, parent.defaultWidth); + height = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, + keyboard.mDisplayHeight, parent.defaultHeight); + gap = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, + keyboard.mDisplayWidth, parent.defaultHorizontalGap); + a.recycle(); + a = res.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard_Key); + this.x += gap; + TypedValue codesValue = new TypedValue(); + a.getValue(R.styleable.BaseKeyboard_Key_codes, + codesValue); + if (codesValue.type == TypedValue.TYPE_INT_DEC + || codesValue.type == TypedValue.TYPE_INT_HEX) { + codes = new int[] { codesValue.data }; + } else if (codesValue.type == TypedValue.TYPE_STRING) { + codes = parseCSV(codesValue.string.toString()); + } + + iconPreview = a.getDrawable(R.styleable.BaseKeyboard_Key_iconPreview); + if (iconPreview != null) { + iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(), + iconPreview.getIntrinsicHeight()); + } + popupCharacters = a.getText( + R.styleable.BaseKeyboard_Key_popupCharacters); + popupResId = a.getResourceId( + R.styleable.BaseKeyboard_Key_popupKeyboard, 0); + repeatable = a.getBoolean( + R.styleable.BaseKeyboard_Key_isRepeatable, false); + modifier = a.getBoolean( + R.styleable.BaseKeyboard_Key_isModifier, false); + sticky = a.getBoolean( + R.styleable.BaseKeyboard_Key_isSticky, false); + edgeFlags = a.getInt(R.styleable.BaseKeyboard_Key_keyEdgeFlags, 0); + edgeFlags |= parent.rowEdgeFlags; + + icon = a.getDrawable( + R.styleable.BaseKeyboard_Key_keyIcon); + if (icon != null) { + icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); + } + label = a.getText(R.styleable.BaseKeyboard_Key_keyLabel); + text = a.getText(R.styleable.BaseKeyboard_Key_keyOutputText); + + if (codes == null && !TextUtils.isEmpty(label)) { + codes = new int[] { label.charAt(0) }; + } + a.recycle(); + } + + /** + * Informs the key that it has been pressed, in case it needs to change its appearance or + * state. + * @see #onReleased(boolean) + */ + public void onPressed() { + pressed = !pressed; + } + + /** + * Changes the pressed state of the key. If it is a sticky key, it will also change the + * toggled state of the key if the finger was release inside. + * @param inside whether the finger was released inside the key + * @see #onPressed() + */ + public void onReleased(boolean inside) { + pressed = !pressed; + if (sticky) { + on = !on; + } + } + + int[] parseCSV(String value) { + int count = 0; + int lastIndex = 0; + if (value.length() > 0) { + count++; + while ((lastIndex = value.indexOf(",", lastIndex + 1)) > 0) { + count++; + } + } + int[] values = new int[count]; + count = 0; + StringTokenizer st = new StringTokenizer(value, ","); + while (st.hasMoreTokens()) { + try { + values[count++] = Integer.parseInt(st.nextToken()); + } catch (NumberFormatException nfe) { + Log.e(TAG, "Error parsing keycodes " + value); + } + } + return values; + } + + /** + * Detects if a point falls inside this key. + * @param x the x-coordinate of the point + * @param y the y-coordinate of the point + * @return whether or not the point falls inside the key. If the key is attached to an edge, + * it will assume that all points between the key and the edge are considered to be inside + * the key. + */ + public boolean isInside(int x, int y) { + boolean leftEdge = (edgeFlags & EDGE_LEFT) > 0; + boolean rightEdge = (edgeFlags & EDGE_RIGHT) > 0; + boolean topEdge = (edgeFlags & EDGE_TOP) > 0; + boolean bottomEdge = (edgeFlags & EDGE_BOTTOM) > 0; + if ((x >= this.x || (leftEdge && x <= this.x + this.width)) + && (x < this.x + this.width || (rightEdge && x >= this.x)) + && (y >= this.y || (topEdge && y <= this.y + this.height)) + && (y < this.y + this.height || (bottomEdge && y >= this.y))) { + return true; + } else { + return false; + } + } + + /** + * Returns the square of the distance between the center of the key and the given point. + * @param x the x-coordinate of the point + * @param y the y-coordinate of the point + * @return the square of the distance of the point from the center of the key + */ + public int squaredDistanceFrom(int x, int y) { + int xDist = this.x + width / 2 - x; + int yDist = this.y + height / 2 - y; + return xDist * xDist + yDist * yDist; + } + + /** + * Returns the drawable state for the key, based on the current state and type of the key. + * @return the drawable state of the key. + * @see android.graphics.drawable.StateListDrawable#setState(int[]) + */ + public int[] getCurrentDrawableState() { + int[] states = KEY_STATE_NORMAL; + + if (on) { + if (pressed) { + states = KEY_STATE_PRESSED_ON; + } else { + states = KEY_STATE_NORMAL_ON; + } + } else { + if (sticky) { + if (pressed) { + states = KEY_STATE_PRESSED_OFF; + } else { + states = KEY_STATE_NORMAL_OFF; + } + } else { + if (pressed) { + states = KEY_STATE_PRESSED; + } + } + } + return states; + } + } + + /** + * Creates a keyboard from the given xml key layout file. + * @param context the application or service context + * @param xmlLayoutResId the resource file that contains the keyboard layout and keys. + */ + public BaseKeyboard(Context context, int xmlLayoutResId) { + this(context, xmlLayoutResId, 0); + } + + /** + * Creates a keyboard from the given xml key layout file. Weeds out rows + * that have a keyboard mode defined but don't match the specified mode. + * @param context the application or service context + * @param xmlLayoutResId the resource file that contains the keyboard layout and keys. + * @param modeId keyboard mode identifier + * @param width sets width of keyboard + * @param height sets height of keyboard + */ + public BaseKeyboard(Context context, int xmlLayoutResId, int modeId, int width, int height) { + mDisplayWidth = width; + mDisplayHeight = height; + + mDefaultHorizontalGap = 0; + mDefaultWidth = mDisplayWidth / 10; + mDefaultVerticalGap = 0; + mDefaultHeight = mDefaultWidth; + mKeys = new ArrayList(); + mModifierKeys = new ArrayList(); + mKeyboardMode = modeId; + loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); + } + + /** + * Creates a keyboard from the given xml key layout file. Weeds out rows + * that have a keyboard mode defined but don't match the specified mode. + * @param context the application or service context + * @param xmlLayoutResId the resource file that contains the keyboard layout and keys. + * @param modeId keyboard mode identifier + */ + public BaseKeyboard(Context context, int xmlLayoutResId, int modeId) { + DisplayMetrics dm = context.getResources().getDisplayMetrics(); + mDisplayWidth = dm.widthPixels; + mDisplayHeight = dm.heightPixels; + //Log.v(TAG, "keyboard's display metrics:" + dm); + + mDefaultHorizontalGap = 0; + mDefaultWidth = mDisplayWidth / 10; + mDefaultVerticalGap = 0; + mDefaultHeight = mDefaultWidth; + mKeys = new ArrayList(); + mModifierKeys = new ArrayList(); + mKeyboardMode = modeId; + loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); + } + + /** + *

Creates a blank keyboard from the given resource file and populates it with the specified + * characters in left-to-right, top-to-bottom fashion, using the specified number of columns. + *

+ *

If the specified number of columns is -1, then the keyboard will fit as many keys as + * possible in each row.

+ * @param context the application or service context + * @param layoutTemplateResId the layout template file, containing no keys. + * @param characters the list of characters to display on the keyboard. One key will be created + * for each character. + * @param columns the number of columns of keys to display. If this number is greater than the + * number of keys that can fit in a row, it will be ignored. If this number is -1, the + * keyboard will fit as many keys as possible in each row. + */ + public BaseKeyboard(Context context, int layoutTemplateResId, + CharSequence characters, int columns, int horizontalPadding) { + this(context, layoutTemplateResId); + int x = 0; + int y = 0; + int column = 0; + mTotalWidth = 0; + + Row row = new Row(this); + row.defaultHeight = mDefaultHeight; + row.defaultWidth = mDefaultWidth; + row.defaultHorizontalGap = mDefaultHorizontalGap; + row.verticalGap = mDefaultVerticalGap; + row.rowEdgeFlags = EDGE_TOP | EDGE_BOTTOM; + final int maxColumns = columns == -1 ? Integer.MAX_VALUE : columns; + for (int i = 0; i < characters.length(); i++) { + char c = characters.charAt(i); + if (column >= maxColumns + || x + mDefaultWidth + horizontalPadding > mDisplayWidth) { + x = 0; + y += mDefaultVerticalGap + mDefaultHeight; + column = 0; + } + final Key key = new Key(row); + key.x = x; + key.y = y; + key.label = String.valueOf(c); + key.codes = new int[] { c }; + column++; + x += key.width + key.gap; + mKeys.add(key); + if (x > mTotalWidth) { + mTotalWidth = x; + } + } + mTotalHeight = y + mDefaultHeight; + } + + public List getKeys() { + return mKeys; + } + + public List getModifierKeys() { + return mModifierKeys; + } + + protected int getHorizontalGap() { + return mDefaultHorizontalGap; + } + + protected void setHorizontalGap(int gap) { + mDefaultHorizontalGap = gap; + } + + protected int getVerticalGap() { + return mDefaultVerticalGap; + } + + protected void setVerticalGap(int gap) { + mDefaultVerticalGap = gap; + } + + protected int getKeyHeight() { + return mDefaultHeight; + } + + protected void setKeyHeight(int height) { + mDefaultHeight = height; + } + + protected int getKeyWidth() { + return mDefaultWidth; + } + + protected void setKeyWidth(int width) { + mDefaultWidth = width; + } + + /** + * Returns the total height of the keyboard + * @return the total height of the keyboard + */ + public int getHeight() { + return mTotalHeight; + } + + public int getMinWidth() { + return mTotalWidth; + } + + public boolean setShifted(boolean shiftState) { + if (mShiftKey != null) { + mShiftKey.on = shiftState; + } + if (mShifted != shiftState) { + mShifted = shiftState; + return true; + } + return false; + } + + public boolean isShifted() { + return mShifted; + } + + public int getShiftKeyIndex() { + return mShiftKeyIndex; + } + + private void computeNearestNeighbors() { + // Round-up so we don't have any pixels outside the grid + mCellWidth = (getMinWidth() + GRID_WIDTH - 1) / GRID_WIDTH; + mCellHeight = (getHeight() + GRID_HEIGHT - 1) / GRID_HEIGHT; + mGridNeighbors = new int[GRID_SIZE][]; + int[] indices = new int[mKeys.size()]; + final int gridWidth = GRID_WIDTH * mCellWidth; + final int gridHeight = GRID_HEIGHT * mCellHeight; + for (int x = 0; x < gridWidth; x += mCellWidth) { + for (int y = 0; y < gridHeight; y += mCellHeight) { + int count = 0; + for (int i = 0; i < mKeys.size(); i++) { + final Key key = mKeys.get(i); + if (key.squaredDistanceFrom(x, y) < mProximityThreshold || + key.squaredDistanceFrom(x + mCellWidth - 1, y) < mProximityThreshold || + key.squaredDistanceFrom(x + mCellWidth - 1, y + mCellHeight - 1) + < mProximityThreshold || + key.squaredDistanceFrom(x, y + mCellHeight - 1) < mProximityThreshold) { + indices[count++] = i; + } + } + int [] cell = new int[count]; + System.arraycopy(indices, 0, cell, 0, count); + mGridNeighbors[(y / mCellHeight) * GRID_WIDTH + (x / mCellWidth)] = cell; + } + } + } + + /** + * Returns the indices of the keys that are closest to the given point. + * @param x the x-coordinate of the point + * @param y the y-coordinate of the point + * @return the array of integer indices for the nearest keys to the given point. If the given + * point is out of range, then an array of size zero is returned. + */ + public int[] getNearestKeys(int x, int y) { + if (mGridNeighbors == null) computeNearestNeighbors(); + if (x >= 0 && x < getMinWidth() && y >= 0 && y < getHeight()) { + int index = (y / mCellHeight) * GRID_WIDTH + (x / mCellWidth); + if (index < GRID_SIZE) { + return mGridNeighbors[index]; + } + } + return new int[0]; + } + + protected Row createRowFromXml(Resources res, XmlResourceParser parser) { + return new Row(res, this, parser); + } + + protected Key createKeyFromXml(Resources res, Row parent, int x, int y, + XmlResourceParser parser) { + return new Key(res, parent, x, y, parser); + } + + private void loadKeyboard(Context context, XmlResourceParser parser) { + boolean inKey = false; + boolean inRow = false; + int row = 0; + int x = 0; + int y = 0; + Key key = null; + Row currentRow = null; + Resources res = context.getResources(); + boolean skipRow = false; + + try { + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + inRow = true; + x = 0; + currentRow = createRowFromXml(res, parser); + skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode; + if (skipRow) { + skipToEndOfRow(parser); + inRow = false; + } + } else if (TAG_KEY.equals(tag)) { + inKey = true; + key = createKeyFromXml(res, currentRow, x, y, parser); + mKeys.add(key); + if (key.codes[0] == KEYCODE_SHIFT) { + mShiftKey = key; + mShiftKeyIndex = mKeys.size()-1; + mModifierKeys.add(key); + } else if (key.codes[0] == KEYCODE_ALT) { + mModifierKeys.add(key); + } + } else if (TAG_KEYBOARD.equals(tag)) { + parseKeyboardAttributes(res, parser); + } + } else if (event == XmlResourceParser.END_TAG) { + if (inKey) { + inKey = false; + x += key.gap + key.width; + if (x > mTotalWidth) { + mTotalWidth = x; + } + } else if (inRow) { + inRow = false; + y += currentRow.verticalGap; + y += currentRow.defaultHeight; + row++; + } else { + // TODO: error or extend? + } + } + } + } catch (Exception e) { + Log.e(TAG, "Parse error:" + e); + e.printStackTrace(); + } + mTotalHeight = y - mDefaultVerticalGap; + } + + private void skipToEndOfRow(XmlResourceParser parser) + throws XmlPullParserException, IOException { + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.END_TAG + && parser.getName().equals(TAG_ROW)) { + break; + } + } + } + + private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) { + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + + mDefaultWidth = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, + mDisplayWidth, mDisplayWidth / 10); + mDefaultHeight = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, + mDisplayHeight, 50); + mDefaultHorizontalGap = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, + mDisplayWidth, 0); + mDefaultVerticalGap = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_verticalGap, + mDisplayHeight, 0); + mProximityThreshold = (int) (mDefaultWidth * SEARCH_DISTANCE); + mProximityThreshold = mProximityThreshold * mProximityThreshold; + a.recycle(); + } + + static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { + TypedValue value = a.peekValue(index); + if (value == null) return defValue; + if (value.type == TypedValue.TYPE_DIMENSION) { + return a.getDimensionPixelOffset(index, defValue); + } else if (value.type == TypedValue.TYPE_FRACTION) { + // Round it to avoid values like 47.9999 from getting truncated + return Math.round(a.getFraction(index, base, base, defValue)); + } + return defValue; + } +} diff --git a/java/src/com/android/inputmethod/latin/KeyDetector.java b/java/src/com/android/inputmethod/latin/KeyDetector.java index 76fe1200e..3902b60a3 100644 --- a/java/src/com/android/inputmethod/latin/KeyDetector.java +++ b/java/src/com/android/inputmethod/latin/KeyDetector.java @@ -16,14 +16,13 @@ package com.android.inputmethod.latin; -import android.inputmethodservice.Keyboard; -import android.inputmethodservice.Keyboard.Key; +import com.android.inputmethod.latin.BaseKeyboard.Key; import java.util.Arrays; import java.util.List; abstract class KeyDetector { - protected Keyboard mKeyboard; + protected BaseKeyboard mKeyboard; private Key[] mKeys; @@ -35,7 +34,7 @@ abstract class KeyDetector { protected int mProximityThresholdSquare; - public Key[] setKeyboard(Keyboard keyboard, float correctionX, float correctionY) { + public Key[] setKeyboard(BaseKeyboard keyboard, float correctionX, float correctionY) { if (keyboard == null) throw new NullPointerException(); mCorrectionX = (int)correctionX; diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 692183dbf..b41c2aa23 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -34,7 +34,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.inputmethodservice.InputMethodService; -import android.inputmethodservice.Keyboard; import android.media.AudioManager; import android.os.Debug; import android.os.Handler; @@ -1170,29 +1169,29 @@ public class LatinIME extends InputMethodService public void onKey(int primaryCode, int[] keyCodes, int x, int y) { long when = SystemClock.uptimeMillis(); - if (primaryCode != Keyboard.KEYCODE_DELETE || + if (primaryCode != BaseKeyboard.KEYCODE_DELETE || when > mLastKeyTime + QUICK_PRESS) { mDeleteCount = 0; } mLastKeyTime = when; final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); switch (primaryCode) { - case Keyboard.KEYCODE_DELETE: + case BaseKeyboard.KEYCODE_DELETE: handleBackspace(); mDeleteCount++; LatinImeLogger.logOnDelete(); break; - case Keyboard.KEYCODE_SHIFT: + case BaseKeyboard.KEYCODE_SHIFT: // Shift key is handled in onPress() when device has distinct multi-touch panel. if (!distinctMultiTouch) handleShift(); break; - case Keyboard.KEYCODE_MODE_CHANGE: + case BaseKeyboard.KEYCODE_MODE_CHANGE: // Symbol key is handled in onPress() when device has distinct multi-touch panel. if (!distinctMultiTouch) changeKeyboardMode(); break; - case Keyboard.KEYCODE_CANCEL: + case BaseKeyboard.KEYCODE_CANCEL: if (!isShowingOptionDialog()) { handleClose(); } @@ -2266,10 +2265,10 @@ public class LatinIME extends InputMethodService vibrate(); playKeyClick(primaryCode); final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); - if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) { + if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { mShiftKeyState.onPress(); handleShift(); - } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) { + } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { mSymbolKeyState.onPress(); changeKeyboardMode(); } else { @@ -2283,11 +2282,11 @@ public class LatinIME extends InputMethodService ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased(); //vibrate(); final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); - if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) { + if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { if (mShiftKeyState.isMomentary()) resetShift(); mShiftKeyState.onRelease(); - } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) { + } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { if (mSymbolKeyState.isMomentary()) changeKeyboardMode(); mSymbolKeyState.onRelease(); @@ -2346,7 +2345,7 @@ public class LatinIME extends InputMethodService // FIXME: These should be triggered after auto-repeat logic int sound = AudioManager.FX_KEYPRESS_STANDARD; switch (primaryCode) { - case Keyboard.KEYCODE_DELETE: + case BaseKeyboard.KEYCODE_DELETE: sound = AudioManager.FX_KEYPRESS_DELETE; break; case KEYCODE_ENTER: diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index a8ab9cc98..dd7bc8ac1 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -20,7 +20,6 @@ import com.android.inputmethod.latin.Dictionary.DataType; import android.content.Context; import android.content.SharedPreferences; -import android.inputmethodservice.Keyboard; import java.util.List; public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChangeListener { @@ -65,7 +64,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void onAddSuggestedWord(String word, int typeId, DataType dataType) { } - public static void onSetKeyboard(Keyboard kb) { + public static void onSetKeyboard(BaseKeyboard kb) { } } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 31394d1cc..9c252e6c6 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -30,7 +30,6 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.inputmethodservice.Keyboard; import android.text.TextPaint; import android.util.Log; import android.view.ViewConfiguration; @@ -41,7 +40,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; -public class LatinKeyboard extends Keyboard { +public class LatinKeyboard extends BaseKeyboard { private static final boolean DEBUG_PREFERRED_LETTER = false; private static final String TAG = "LatinKeyboard"; @@ -744,7 +743,7 @@ public class LatinKeyboard extends Keyboard { return textSize; } - class LatinKey extends Keyboard.Key { + class LatinKey extends BaseKeyboard.Key { // functional normal state (with properties) private final int[] KEY_STATE_FUNCTIONAL_NORMAL = { @@ -759,7 +758,7 @@ public class LatinKeyboard extends Keyboard { private boolean mShiftLockEnabled; - public LatinKey(Resources res, Keyboard.Row parent, int x, int y, + public LatinKey(Resources res, BaseKeyboard.Row parent, int x, int y, XmlResourceParser parser) { super(res, parent, x, y, parser); if (popupCharacters != null && popupCharacters.length() == 0) { diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 75ef691c8..264e2f18f 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -16,6 +16,8 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.BaseKeyboard.Key; + import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; @@ -29,8 +31,6 @@ import android.graphics.Rect; import android.graphics.Region.Op; import android.graphics.Typeface; import android.graphics.drawable.Drawable; -import android.inputmethodservice.Keyboard; -import android.inputmethodservice.Keyboard.Key; import android.os.Handler; import android.os.Message; import android.os.SystemClock; @@ -177,7 +177,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private int mPopupLayout; // Main keyboard - private Keyboard mKeyboard; + private BaseKeyboard mKeyboard; private Key[] mKeys; // Key preview popup @@ -566,7 +566,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx * @see #getKeyboard() * @param keyboard the keyboard to display in this view */ - public void setKeyboard(Keyboard keyboard) { + public void setKeyboard(BaseKeyboard keyboard) { if (mKeyboard != null) { dismissKeyPreview(); } @@ -593,7 +593,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx * @return the currently attached keyboard * @see #setKeyboard(Keyboard) */ - public Keyboard getKeyboard() { + public BaseKeyboard getKeyboard() { return mKeyboard; } @@ -713,7 +713,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx * the touch distance from a key's center to avoid taking a square root. * @param keyboard */ - private void computeProximityThreshold(Keyboard keyboard) { + private void computeProximityThreshold(BaseKeyboard keyboard) { if (keyboard == null) return; final Key[] keys = mKeys; if (keys == null) return; @@ -1072,12 +1072,12 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Override default ProximityKeyDetector. miniKeyboard.mKeyDetector = new MiniKeyboardKeyDetector(mMiniKeyboardSlideAllowance); - Keyboard keyboard; + BaseKeyboard keyboard; if (popupKey.popupCharacters != null) { - keyboard = new Keyboard(getContext(), popupKeyboardId, popupKey.popupCharacters, + keyboard = new BaseKeyboard(getContext(), popupKeyboardId, popupKey.popupCharacters, -1, getPaddingLeft() + getPaddingRight()); } else { - keyboard = new Keyboard(getContext(), popupKeyboardId); + keyboard = new BaseKeyboard(getContext(), popupKeyboardId); } miniKeyboard.setKeyboard(keyboard); miniKeyboard.setPopupParent(this); @@ -1088,7 +1088,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return container; } - private static boolean isOneRowKeyboard(Keyboard keyboard) { + private static boolean isOneRowKeyboard(BaseKeyboard keyboard) { final List keys = keyboard.getKeys(); if (keys.size() == 0) return false; final int edgeFlags = keys.get(0).edgeFlags; @@ -1098,7 +1098,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // and bottom edge flags on. // When you want to use one row mini-keyboard from xml file, make sure that the row has // both top and bottom edge flags set. - return (edgeFlags & Keyboard.EDGE_TOP) != 0 && (edgeFlags & Keyboard.EDGE_BOTTOM) != 0; + return (edgeFlags & BaseKeyboard.EDGE_TOP) != 0 + && (edgeFlags & BaseKeyboard.EDGE_BOTTOM) != 0; } /** diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 22d39f7aa..912af7e2a 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -16,11 +16,11 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.BaseKeyboard.Key; + import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; -import android.inputmethodservice.Keyboard; -import android.inputmethodservice.Keyboard.Key; import android.os.Handler; import android.os.Message; import android.os.SystemClock; @@ -39,7 +39,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { static final int KEYCODE_NEXT_LANGUAGE = -104; static final int KEYCODE_PREV_LANGUAGE = -105; - private Keyboard mPhoneKeyboard; + private BaseKeyboard mPhoneKeyboard; /** Whether we've started dropping move events because we found a big jump */ private boolean mDroppingEvents; @@ -61,7 +61,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { super(context, attrs, defStyle); } - public void setPhoneKeyboard(Keyboard phoneKeyboard) { + public void setPhoneKeyboard(BaseKeyboard phoneKeyboard) { mPhoneKeyboard = phoneKeyboard; } @@ -76,7 +76,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } @Override - public void setKeyboard(Keyboard k) { + public void setKeyboard(BaseKeyboard k) { super.setKeyboard(k); // One-seventh of the keyboard width seems like a reasonable threshold mJumpThresholdSquare = k.getMinWidth() / 7; @@ -108,7 +108,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { @Override protected CharSequence adjustCase(CharSequence label) { - Keyboard keyboard = getKeyboard(); + BaseKeyboard keyboard = getKeyboard(); if (keyboard.isShifted() && keyboard instanceof LatinKeyboard && ((LatinKeyboard) keyboard).isAlphaKeyboard() @@ -120,7 +120,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } public boolean setShiftLocked(boolean shiftLocked) { - Keyboard keyboard = getKeyboard(); + BaseKeyboard keyboard = getKeyboard(); if (keyboard instanceof LatinKeyboard) { ((LatinKeyboard)keyboard).setShiftLocked(shiftLocked); invalidateAllKeys(); @@ -257,7 +257,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { private int mLastY; private Paint mPaint; - private void setKeyboardLocal(Keyboard k) { + private void setKeyboardLocal(BaseKeyboard k) { if (DEBUG_AUTO_PLAY) { findKeys(); if (mHandler2 == null) { diff --git a/java/src/com/android/inputmethod/latin/MiniKeyboardKeyDetector.java b/java/src/com/android/inputmethod/latin/MiniKeyboardKeyDetector.java index 356e62d48..5f4c93734 100644 --- a/java/src/com/android/inputmethod/latin/MiniKeyboardKeyDetector.java +++ b/java/src/com/android/inputmethod/latin/MiniKeyboardKeyDetector.java @@ -16,7 +16,7 @@ package com.android.inputmethod.latin; -import android.inputmethodservice.Keyboard.Key; +import com.android.inputmethod.latin.BaseKeyboard.Key; class MiniKeyboardKeyDetector extends KeyDetector { private static final int MAX_NEARBY_KEYS = 1; diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index b416a984c..cf4f7d5c2 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -16,11 +16,10 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.BaseKeyboard.Key; import com.android.inputmethod.latin.LatinKeyboardBaseView.OnKeyboardActionListener; import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler; -import android.inputmethodservice.Keyboard; -import android.inputmethodservice.Keyboard.Key; import android.util.Log; import android.view.MotionEvent; import android.view.ViewConfiguration; @@ -45,7 +44,7 @@ public class PointerTracker { // Miscellaneous constants private static final int NOT_A_KEY = LatinKeyboardBaseView.NOT_A_KEY; - private static final int[] KEY_DELETE = { Keyboard.KEYCODE_DELETE }; + private static final int[] KEY_DELETE = { BaseKeyboard.KEYCODE_DELETE }; private final UIProxy mProxy; private final UIHandler mHandler; @@ -202,8 +201,8 @@ public class PointerTracker { if (key == null) return false; int primaryCode = key.codes[0]; - return primaryCode == Keyboard.KEYCODE_SHIFT - || primaryCode == Keyboard.KEYCODE_MODE_CHANGE; + return primaryCode == BaseKeyboard.KEYCODE_SHIFT + || primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE; } public boolean isModifier() { @@ -437,7 +436,7 @@ public class PointerTracker { // Multi-tap if (mInMultiTap) { if (mTapCount != -1) { - mListener.onKey(Keyboard.KEYCODE_DELETE, KEY_DELETE, x, y); + mListener.onKey(BaseKeyboard.KEYCODE_DELETE, KEY_DELETE, x, y); } else { mTapCount = 0; } diff --git a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java index d17bedb56..a6ff8cf8c 100644 --- a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java +++ b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java @@ -16,7 +16,7 @@ package com.android.inputmethod.latin; -import android.inputmethodservice.Keyboard.Key; +import com.android.inputmethod.latin.BaseKeyboard.Key; import java.util.Arrays; diff --git a/java/src/com/android/inputmethod/latin/TextEntryState.java b/java/src/com/android/inputmethod/latin/TextEntryState.java index 9011191f1..1d7659ca3 100644 --- a/java/src/com/android/inputmethod/latin/TextEntryState.java +++ b/java/src/com/android/inputmethod/latin/TextEntryState.java @@ -16,8 +16,9 @@ package com.android.inputmethod.latin; +import com.android.inputmethod.latin.BaseKeyboard.Key; + import android.content.Context; -import android.inputmethodservice.Keyboard.Key; import android.text.format.DateFormat; import android.util.Log; -- cgit v1.2.3-83-g751a From 6614ac9f7b506c688abd2d6f09a0f2ae8b22fa68 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Sat, 2 Oct 2010 15:50:06 +0900 Subject: Modify BaseKeyboard to be able to handle multiple shift keys Change-Id: Ie840ae113ee6bd5b629a90959d7f955a5ceba95a --- .../android/inputmethod/latin/BaseKeyboard.java | 32 ++++++++-------------- .../android/inputmethod/latin/LatinKeyboard.java | 17 ++++-------- 2 files changed, 17 insertions(+), 32 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index f1a08cb4a..6f32f9c1a 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -89,11 +89,8 @@ public class BaseKeyboard { /** Is the keyboard in the shifted state */ private boolean mShifted; - /** Key instance for the shift key, if present */ - private Key mShiftKey; - - /** Key index for the shift key, if present */ - private int mShiftKeyIndex = -1; + /** List of shift keys in this keyboard */ + private final List mShiftKeys = new ArrayList(); /** Total height of the keyboard, including the padding and keys */ private int mTotalHeight; @@ -105,19 +102,19 @@ public class BaseKeyboard { private int mTotalWidth; /** List of keys in this keyboard */ - private List mKeys; + private final List mKeys = new ArrayList(); /** List of modifier keys such as Shift & Alt, if any */ - private List mModifierKeys; + private final List mModifierKeys = new ArrayList(); /** Width of the screen available to fit the keyboard */ - private int mDisplayWidth; + private final int mDisplayWidth; /** Height of the screen */ - private int mDisplayHeight; + private final int mDisplayHeight; /** Keyboard mode, or zero, if none. */ - private int mKeyboardMode; + private final int mKeyboardMode; // Variables for pre-computing nearest keys. @@ -488,8 +485,6 @@ public class BaseKeyboard { mDefaultWidth = mDisplayWidth / 10; mDefaultVerticalGap = 0; mDefaultHeight = mDefaultWidth; - mKeys = new ArrayList(); - mModifierKeys = new ArrayList(); mKeyboardMode = modeId; loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); } @@ -511,8 +506,6 @@ public class BaseKeyboard { mDefaultWidth = mDisplayWidth / 10; mDefaultVerticalGap = 0; mDefaultHeight = mDefaultWidth; - mKeys = new ArrayList(); - mModifierKeys = new ArrayList(); mKeyboardMode = modeId; loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); } @@ -622,8 +615,8 @@ public class BaseKeyboard { } public boolean setShifted(boolean shiftState) { - if (mShiftKey != null) { - mShiftKey.on = shiftState; + for (final Key key : mShiftKeys) { + key.on = shiftState; } if (mShifted != shiftState) { mShifted = shiftState; @@ -636,8 +629,8 @@ public class BaseKeyboard { return mShifted; } - public int getShiftKeyIndex() { - return mShiftKeyIndex; + public List getShiftKeys() { + return mShiftKeys; } private void computeNearestNeighbors() { @@ -725,8 +718,7 @@ public class BaseKeyboard { key = createKeyFromXml(res, currentRow, x, y, parser); mKeys.add(key); if (key.codes[0] == KEYCODE_SHIFT) { - mShiftKey = key; - mShiftKeyIndex = mKeys.size()-1; + mShiftKeys.add(key); mModifierKeys.add(key); } else if (key.codes[0] == KEYCODE_ALT) { mModifierKeys.add(key); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 9c252e6c6..53ccf3629 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -35,7 +35,6 @@ import android.util.Log; import android.view.ViewConfiguration; import android.view.inputmethod.EditorInfo; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -59,7 +58,6 @@ public class LatinKeyboard extends BaseKeyboard { private Drawable m123MicPreviewIcon; private final Drawable mButtonArrowLeftIcon; private final Drawable mButtonArrowRightIcon; - private ArrayList mShiftKeys; private Key mEnterKey; private Key mF1Key; private Key mSpaceKey; @@ -161,8 +159,6 @@ public class LatinKeyboard extends BaseKeyboard { private void initializeMemberVariablesAsNeeded() { if (mNumberHintKeys == null) mNumberHintKeys = new Key[NUMBER_HINT_COUNT]; - if (mShiftKeys == null) - mShiftKeys = new ArrayList(); } @Override @@ -184,9 +180,6 @@ public class LatinKeyboard extends BaseKeyboard { case LatinIME.KEYCODE_SPACE: mSpaceKey = key; break; - case KEYCODE_SHIFT: - mShiftKeys.add(key); - break; case KEYCODE_MODE_CHANGE: m123Key = key; m123Label = key.label; @@ -267,7 +260,7 @@ public class LatinKeyboard extends BaseKeyboard { } public void enableShiftLock() { - for (final Key key : mShiftKeys) { + for (final Key key : getShiftKeys()) { if (key instanceof LatinKey) { ((LatinKey)key).enableShiftLock(); } @@ -276,7 +269,7 @@ public class LatinKeyboard extends BaseKeyboard { } public void setShiftLocked(boolean shiftLocked) { - for (final Key key : mShiftKeys) { + for (final Key key : getShiftKeys()) { key.on = shiftLocked; key.icon = mShiftLockIcon; } @@ -290,8 +283,8 @@ public class LatinKeyboard extends BaseKeyboard { @Override public boolean setShifted(boolean shiftState) { boolean shiftChanged = false; - if (mShiftKeys.size() > 0) { - for (final Key key : mShiftKeys) { + if (getShiftKeys().size() > 0) { + for (final Key key : getShiftKeys()) { if (shiftState == false) { key.on = false; key.icon = mOldShiftIcons.get(key); @@ -314,7 +307,7 @@ public class LatinKeyboard extends BaseKeyboard { @Override public boolean isShifted() { - if (mShiftKeys.size() > 0) { + if (getShiftKeys().size() > 0) { return mShiftState != SHIFT_OFF; } else { return super.isShifted(); -- cgit v1.2.3-83-g751a From b1abda8d62d654e876c4f781a07d724922c736e4 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Shimoda Date: Tue, 28 Sep 2010 12:23:26 +0900 Subject: Add an auto complete's threshold option. Change-Id: I3a6821ced8642ab8f954e79a25e31766e4a18eb8 --- java/res/values/config.xml | 10 ++ java/res/values/strings.xml | 30 +++++- java/res/xml/prefs.xml | 12 +-- .../com/android/inputmethod/latin/LatinIME.java | 60 +++++++++++- .../inputmethod/latin/LatinIMESettings.java | 24 +++++ .../android/inputmethod/latin/LatinIMEUtil.java | 54 +++++++++++ .../src/com/android/inputmethod/latin/Suggest.java | 15 ++- .../inputmethod/latin/EditDistanceTests.java | 107 +++++++++++++++++++++ 8 files changed, 295 insertions(+), 17 deletions(-) create mode 100644 tests/src/com/android/inputmethod/latin/EditDistanceTests.java (limited to 'java/src') diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 6e941baaf..5b5656d84 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -25,4 +25,14 @@ 90 0 100 + + + + + 0.22 + + 0 + diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index a4ebe4650..94fe76d54 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -86,11 +86,6 @@ Display suggested words while typing - - Auto-complete - - Spacebar and punctuation automatically insert highlighted word - Show settings key @@ -112,6 +107,31 @@ @string/settings_key_mode_always_hide_name + + + Auto-complete + + Spacebar and punctuation automatically insert highlighted word + 0 + 1 + 2 + + @string/auto_completion_threshold_mode_value_off + @string/auto_completion_threshold_mode_value_modest + @string/auto_completion_threshold_mode_value_aggeressive + + + Off + + Modest + + Aggressive + + @string/auto_completion_threshold_mode_off + @string/auto_completion_threshold_mode_modest + @string/auto_completion_threshold_mode_aggeressive + + Bigram Suggestions diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 8a971092f..e7a394529 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -97,13 +97,14 @@ android:defaultValue="true" /> - diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b41c2aa23..d0c8af5c4 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -68,6 +68,7 @@ import java.io.FileDescriptor; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -94,7 +95,7 @@ public class LatinIME extends InputMethodService private static final String PREF_AUTO_CAP = "auto_cap"; private static final String PREF_QUICK_FIXES = "quick_fixes"; private static final String PREF_SHOW_SUGGESTIONS = "show_suggestions"; - private static final String PREF_AUTO_COMPLETE = "auto_complete"; + private static final String PREF_AUTO_COMPLETION_THRESHOLD = "auto_completion_threshold"; private static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion"; private static final String PREF_VOICE_MODE = "voice_mode"; @@ -445,6 +446,7 @@ public class LatinIME extends InputMethodService int[] dictionaries = getDictionary(orig); mSuggest = new Suggest(this, dictionaries); + loadAndSetAutoCompletionThreshold(sp); updateAutoTextEnabled(saveLocale); if (mUserDictionary != null) mUserDictionary.close(); mUserDictionary = new UserDictionary(this, mInputLocale); @@ -2469,6 +2471,9 @@ public class LatinIME extends InputMethodService mLocaleSupportedForVoiceInput = voiceInputSupportedLocales.contains(mInputLocale); mShowSuggestions = sp.getBoolean(PREF_SHOW_SUGGESTIONS, true); + mAutoCorrectEnabled = mShowSuggestions && isAutoCorrectEnabled(sp); + mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(sp); + loadAndSetAutoCompletionThreshold(sp); if (VOICE_INSTALLED) { final String voiceMode = sp.getString(PREF_VOICE_MODE, @@ -2483,14 +2488,61 @@ public class LatinIME extends InputMethodService mEnableVoice = enableVoice; mVoiceOnPrimary = voiceOnPrimary; } - mAutoCorrectEnabled = sp.getBoolean(PREF_AUTO_COMPLETE, - mResources.getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions; - mBigramSuggestionEnabled = sp.getBoolean(PREF_BIGRAM_SUGGESTIONS, true) & mShowSuggestions; updateCorrectionMode(); updateAutoTextEnabled(mResources.getConfiguration().locale); mLanguageSwitcher.loadLocales(sp); } + /** + * load Auto completion threshold from SharedPreferences, + * and modify mSuggest's threshold. + */ + private void loadAndSetAutoCompletionThreshold(SharedPreferences sp) { + // When mSuggest is not initialized, cannnot modify mSuggest's threshold. + if (mSuggest == null) return; + // When auto completion setting is turned off, the threshold is ignored. + if (!isAutoCorrectEnabled(sp)) return; + + final String currentAutoCompletionSetting = sp.getString(PREF_AUTO_COMPLETION_THRESHOLD, + mResources.getString(R.string.auto_completion_threshold_mode_value_modest)); + final String[] autoCompletionThresholdValues = mResources.getStringArray( + R.array.auto_complete_threshold_values); + // When autoCompletionThreshold is greater than 1.0, + // auto completion is virtually turned off. + double autoCompletionThreshold = Double.MAX_VALUE; + try { + final int arrayIndex = Integer.valueOf(currentAutoCompletionSetting); + if (arrayIndex >= 0 && arrayIndex < autoCompletionThresholdValues.length) { + autoCompletionThreshold = Double.parseDouble( + autoCompletionThresholdValues[arrayIndex]); + } + } catch (NumberFormatException e) { + // Whenever the threshold settings are correct, + // never come here. + autoCompletionThreshold = Double.MAX_VALUE; + Log.w(TAG, "Cannot load auto completion threshold setting." + + " currentAutoCompletionSetting: " + currentAutoCompletionSetting + + ", autoCompletionThresholdValues: " + + Arrays.toString(autoCompletionThresholdValues)); + } + // TODO: This should be refactored : + // setAutoCompleteThreshold should be called outside of this method. + mSuggest.setAutoCompleteThreshold(autoCompletionThreshold); + } + + private boolean isAutoCorrectEnabled(SharedPreferences sp) { + final String currentAutoCompletionSetting = sp.getString(PREF_AUTO_COMPLETION_THRESHOLD, + mResources.getString(R.string.auto_completion_threshold_mode_value_modest)); + final String autoCompletionOff = mResources.getString( + R.string.auto_completion_threshold_mode_value_off); + return !currentAutoCompletionSetting.equals(autoCompletionOff); + } + + private boolean isBigramSuggestionEnabled(SharedPreferences sp) { + // TODO: Define default value instead of 'true'. + return sp.getBoolean(PREF_BIGRAM_SUGGESTIONS, true); + } + private void initSuggestPuncList() { mSuggestPuncList = new ArrayList(); mSuggestPuncs = mResources.getString(R.string.suggested_punctuations); diff --git a/java/src/com/android/inputmethod/latin/LatinIMESettings.java b/java/src/com/android/inputmethod/latin/LatinIMESettings.java index ffff33da2..99d8a622e 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMESettings.java +++ b/java/src/com/android/inputmethod/latin/LatinIMESettings.java @@ -43,6 +43,9 @@ public class LatinIMESettings extends PreferenceActivity private static final String QUICK_FIXES_KEY = "quick_fixes"; private static final String PREDICTION_SETTINGS_KEY = "prediction_settings"; private static final String VOICE_SETTINGS_KEY = "voice_mode"; + private static final String PREF_SHOW_SUGGESTIONS = "show_suggestions"; + private static final String PREF_AUTO_COMPLETION_THRESHOLD = "auto_completion_threshold"; + private static final String PREF_BIGRAM_SUGGESTIONS = "bigram_suggestion"; /* package */ static final String PREF_SETTINGS_KEY = "settings_key"; private static final String TAG = "LatinIMESettings"; @@ -53,6 +56,9 @@ public class LatinIMESettings extends PreferenceActivity private CheckBoxPreference mQuickFixes; private ListPreference mVoicePreference; private ListPreference mSettingsKeyPreference; + private CheckBoxPreference mShowSuggestions; + private ListPreference mAutoCompletionThreshold; + private CheckBoxPreference mBigramSuggestion; private boolean mVoiceOn; private VoiceInputLogger mLogger; @@ -60,6 +66,18 @@ public class LatinIMESettings extends PreferenceActivity private boolean mOkClicked = false; private String mVoiceModeOff; + private void ensureConsistencyOfAutoCompletionSettings() { + if (mShowSuggestions.isChecked()) { + mAutoCompletionThreshold.setEnabled(true); + final String autoCompletionOff = getResources().getString( + R.string.auto_completion_threshold_mode_value_off); + final String currentSetting = mAutoCompletionThreshold.getValue(); + mBigramSuggestion.setEnabled(!currentSetting.equals(autoCompletionOff)); + } else { + mAutoCompletionThreshold.setEnabled(false); + mBigramSuggestion.setEnabled(false); + } + } @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -73,6 +91,11 @@ public class LatinIMESettings extends PreferenceActivity mVoiceModeOff = getString(R.string.voice_mode_off); mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff)); mLogger = VoiceInputLogger.getLogger(this); + + mShowSuggestions = (CheckBoxPreference) findPreference(PREF_SHOW_SUGGESTIONS); + mAutoCompletionThreshold = (ListPreference) findPreference(PREF_AUTO_COMPLETION_THRESHOLD); + mBigramSuggestion = (CheckBoxPreference) findPreference(PREF_BIGRAM_SUGGESTIONS); + ensureConsistencyOfAutoCompletionSettings(); } @Override @@ -108,6 +131,7 @@ public class LatinIMESettings extends PreferenceActivity showVoiceConfirmation(); } } + ensureConsistencyOfAutoCompletionSettings(); mVoiceOn = !(prefs.getString(VOICE_SETTINGS_KEY, mVoiceModeOff).equals(mVoiceModeOff)); updateVoiceModeSummary(); updateSettingsKeySummary(); diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java index 85ecaee50..d93639063 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java +++ b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java @@ -168,4 +168,58 @@ public class LatinIMEUtil { mLength = 0; } } + + public static int editDistance(CharSequence s, CharSequence t) { + if (s == null || t == null) { + throw new IllegalArgumentException("editDistance: Arguments should not be null."); + } + final int sl = s.length(); + final int tl = t.length(); + int[][] dp = new int [sl + 1][tl + 1]; + for (int i = 0; i <= sl; i++) { + dp[i][0] = i; + } + for (int j = 0; j <= tl; j++) { + dp[0][j] = j; + } + for (int i = 0; i < sl; ++i) { + for (int j = 0; j < tl; ++j) { + if (s.charAt(i) == t.charAt(j)) { + dp[i + 1][j + 1] = dp[i][j]; + } else { + dp[i + 1][j + 1] = 1 + Math.min(dp[i][j], + Math.min(dp[i + 1][j], dp[i][j + 1])); + } + } + } + return dp[sl][tl]; + } + + // In dictionary.cpp, getSuggestion() method, + // suggestion scores are computed using the below formula. + // original score (called 'frequency') + // := pow(mTypedLetterMultiplier (this is defined 2), + // (the number of matched characters between typed word and suggested word)) + // * (individual word's score which defined in the unigram dictionary, + // and this score is defined in range [0, 255].) + // * (when before.length() == after.length(), + // mFullWordMultiplier (this is defined 2)) + // So, maximum original score is pow(2, before.length()) * 255 * 2 + // So, we can normalize original score by dividing this value. + private static final int MAX_INITIAL_SCORE = 255; + private static final int TYPED_LETTER_MULTIPLIER = 2; + private static final int FULL_WORD_MULTIPLYER = 2; + public static double calcNormalizedScore(CharSequence before, CharSequence after, int score) { + final int beforeLength = before.length(); + final int afterLength = after.length(); + final int distance = editDistance(before, after); + final double maximumScore = MAX_INITIAL_SCORE + * Math.pow(TYPED_LETTER_MULTIPLIER, beforeLength) + * FULL_WORD_MULTIPLYER; + // add a weight based on edit distance. + // distance <= max(afterLength, beforeLength) == afterLength, + // so, 0 <= distance / afterLength <= 1 + final double weight = 1.0 - (double) distance / afterLength; + return (score / maximumScore) * weight; + } } diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 3b898941f..01782339f 100755 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -81,6 +81,7 @@ public class Suggest implements Dictionary.WordCallback { private boolean mAutoTextEnabled; + private double mAutoCompleteThreshold; private int[] mPriorities = new int[mPrefMaxSuggestions]; private int[] mBigramPriorities = new int[PREF_MAX_BIGRAMS]; @@ -163,6 +164,10 @@ public class Suggest implements Dictionary.WordCallback { mUserBigramDictionary = userBigramDictionary; } + public void setAutoCompleteThreshold(double threshold) { + mAutoCompleteThreshold = threshold; + } + /** * Number of suggestions to generate from the input key sequence. This has * to be a number between 1 and 100 (inclusive). @@ -301,8 +306,14 @@ public class Suggest implements Dictionary.WordCallback { } mMainDict.getWords(wordComposer, this, mNextLettersFrequencies); if ((mCorrectionMode == CORRECTION_FULL || mCorrectionMode == CORRECTION_FULL_BIGRAM) - && mSuggestions.size() > 0) { - mHaveCorrection = true; + && mSuggestions.size() > 0 && mPriorities.length > 0) { + // TODO: when the normalized score of the first suggestion is nearly equals to + // the normalized score of the second suggestion, behave less aggressive. + final double normalizedScore = LatinIMEUtil.calcNormalizedScore( + mOriginalWord, mSuggestions.get(0), mPriorities[0]); + if (normalizedScore >= mAutoCompleteThreshold) { + mHaveCorrection = true; + } } } if (mOriginalWord != null) { diff --git a/tests/src/com/android/inputmethod/latin/EditDistanceTests.java b/tests/src/com/android/inputmethod/latin/EditDistanceTests.java new file mode 100644 index 000000000..a9ed89df7 --- /dev/null +++ b/tests/src/com/android/inputmethod/latin/EditDistanceTests.java @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.inputmethod.latin; + +import android.test.AndroidTestCase; + +public class EditDistanceTests extends AndroidTestCase { + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + /* + * dist(kitten, sitting) == 3 + * + * kitten- + * .|||.| + * sitting + */ + public void testExample1() { + final int dist = LatinIMEUtil.editDistance("kitten", "sitting"); + assertEquals("edit distance between 'kitten' and 'sitting' is 3", + 3, dist); + } + + /* + * dist(Sunday, Saturday) == 3 + * + * Saturday + * | |.||| + * S--unday + */ + public void testExample2() { + final int dist = LatinIMEUtil.editDistance("Saturday", "Sunday"); + assertEquals("edit distance between 'Saturday' and 'Sunday' is 3", + 3, dist); + } + + public void testBothEmpty() { + final int dist = LatinIMEUtil.editDistance("", ""); + assertEquals("when both string are empty, no edits are needed", + 0, dist); + } + + public void testFirstArgIsEmpty() { + final int dist = LatinIMEUtil.editDistance("", "aaaa"); + assertEquals("when only one string of the arguments is empty," + + " the edit distance is the length of the other.", + 4, dist); + } + + public void testSecoondArgIsEmpty() { + final int dist = LatinIMEUtil.editDistance("aaaa", ""); + assertEquals("when only one string of the arguments is empty," + + " the edit distance is the length of the other.", + 4, dist); + } + + public void testSameStrings() { + final String arg1 = "The quick brown fox jumps over the lazy dog."; + final String arg2 = "The quick brown fox jumps over the lazy dog."; + final int dist = LatinIMEUtil.editDistance(arg1, arg2); + assertEquals("when same strings are passed, distance equals 0.", + 0, dist); + } + + public void testSameReference() { + final String arg = "The quick brown fox jumps over the lazy dog."; + final int dist = LatinIMEUtil.editDistance(arg, arg); + assertEquals("when same string references are passed, the distance equals 0.", + 0, dist); + } + + public void testNullArg() { + try { + LatinIMEUtil.editDistance(null, "aaa"); + fail("IllegalArgumentException should be thrown."); + } catch (Exception e) { + assertTrue(e instanceof IllegalArgumentException); + } + try { + LatinIMEUtil.editDistance("aaa", null); + fail("IllegalArgumentException should be thrown."); + } catch (Exception e) { + assertTrue(e instanceof IllegalArgumentException); + } + } +} -- cgit v1.2.3-83-g751a From 66e306d01c6820d4f4d8b2209438ec086b48ac51 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Sat, 2 Oct 2010 15:17:27 +0900 Subject: Add keyHintIcon attribute to BaseKeyboard.Key class This keyHintIcon attribute is used to specify hint icon drawable at top right corner of Key. Change-Id: Icaa91e63c4473b2513396bd3fbeb8ed6fd73586c --- java/res/drawable-mdpi/keyboard_hint_at.9.png | Bin 0 -> 1180 bytes java/res/drawable-mdpi/keyboard_hint_colon.9.png | Bin 0 -> 1082 bytes .../drawable-mdpi/keyboard_hint_doublecross.9.png | Bin 0 -> 1157 bytes .../drawable-mdpi/keyboard_hint_exclamation.9.png | Bin 0 -> 1095 bytes java/res/drawable-mdpi/keyboard_hint_greater.9.png | Bin 0 -> 1133 bytes java/res/drawable-mdpi/keyboard_hint_plus.9.png | Bin 0 -> 1116 bytes .../res/drawable-mdpi/keyboard_hint_question.9.png | Bin 0 -> 1140 bytes java/res/drawable-mdpi/keyboard_hint_quote.9.png | Bin 0 -> 1077 bytes java/res/drawable-mdpi/keyboard_hint_smaller.9.png | Bin 0 -> 1130 bytes java/res/drawable-mdpi/keyboard_hint_star.9.png | Bin 0 -> 1136 bytes java/res/values/attrs.xml | 4 ++ java/res/values/strings.xml | 2 + java/res/xml-da/kbd_qwerty.xml | 10 +++ java/res/xml-da/kbd_qwerty_black.xml | 10 +++ java/res/xml-de/kbd_qwerty.xml | 10 +++ java/res/xml-de/kbd_qwerty_black.xml | 10 +++ java/res/xml-fr/kbd_qwerty.xml | 10 +++ java/res/xml-fr/kbd_qwerty_black.xml | 10 +++ java/res/xml-nb/kbd_qwerty.xml | 10 +++ java/res/xml-nb/kbd_qwerty_black.xml | 10 +++ java/res/xml-ru/kbd_qwerty.xml | 10 +++ java/res/xml-ru/kbd_qwerty_black.xml | 10 +++ java/res/xml-sr/kbd_qwerty.xml | 10 +++ java/res/xml-sr/kbd_qwerty_black.xml | 10 +++ java/res/xml-sv/kbd_qwerty.xml | 10 +++ java/res/xml-sv/kbd_qwerty_black.xml | 10 +++ java/res/xml-xlarge/kbd_qwerty.xml | 31 +++++++++ java/res/xml-xlarge/kbd_symbols.xml | 5 +- java/res/xml-xlarge/kbd_symbols_shift.xml | 5 +- java/res/xml/kbd_qwerty.xml | 10 +++ java/res/xml/kbd_qwerty_black.xml | 10 +++ .../android/inputmethod/latin/BaseKeyboard.java | 60 +++++++++-------- .../android/inputmethod/latin/LatinKeyboard.java | 74 +++------------------ .../inputmethod/latin/LatinKeyboardBaseView.java | 62 ++++++++--------- .../inputmethod/latin/LatinKeyboardView.java | 4 +- .../android/inputmethod/latin/PointerTracker.java | 37 +++++++++-- 36 files changed, 308 insertions(+), 136 deletions(-) create mode 100644 java/res/drawable-mdpi/keyboard_hint_at.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_colon.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_doublecross.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_exclamation.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_greater.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_plus.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_question.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_quote.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_smaller.9.png create mode 100644 java/res/drawable-mdpi/keyboard_hint_star.9.png (limited to 'java/src') diff --git a/java/res/drawable-mdpi/keyboard_hint_at.9.png b/java/res/drawable-mdpi/keyboard_hint_at.9.png new file mode 100644 index 000000000..69baedef4 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_at.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_colon.9.png b/java/res/drawable-mdpi/keyboard_hint_colon.9.png new file mode 100644 index 000000000..9d0d7cbab Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_colon.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_doublecross.9.png b/java/res/drawable-mdpi/keyboard_hint_doublecross.9.png new file mode 100644 index 000000000..d24aa0f07 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_doublecross.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_exclamation.9.png b/java/res/drawable-mdpi/keyboard_hint_exclamation.9.png new file mode 100644 index 000000000..f6cc7fe84 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_exclamation.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_greater.9.png b/java/res/drawable-mdpi/keyboard_hint_greater.9.png new file mode 100644 index 000000000..5210392bf Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_greater.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_plus.9.png b/java/res/drawable-mdpi/keyboard_hint_plus.9.png new file mode 100644 index 000000000..d1d85ac87 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_plus.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_question.9.png b/java/res/drawable-mdpi/keyboard_hint_question.9.png new file mode 100644 index 000000000..37f6e5f36 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_question.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_quote.9.png b/java/res/drawable-mdpi/keyboard_hint_quote.9.png new file mode 100644 index 000000000..e7d2cb5e3 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_quote.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_smaller.9.png b/java/res/drawable-mdpi/keyboard_hint_smaller.9.png new file mode 100644 index 000000000..76553cf96 Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_smaller.9.png differ diff --git a/java/res/drawable-mdpi/keyboard_hint_star.9.png b/java/res/drawable-mdpi/keyboard_hint_star.9.png new file mode 100644 index 000000000..47978c46c Binary files /dev/null and b/java/res/drawable-mdpi/keyboard_hint_star.9.png differ diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 943a43b70..19002140c 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -106,8 +106,12 @@ + + + + diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 94fe76d54..a05d29192 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -212,6 +212,8 @@ ABC ALT + + More diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 4aef4b448..431c5d7a6 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -34,44 +34,54 @@ diff --git a/java/res/xml-de/kbd_qwerty_black.xml b/java/res/xml-de/kbd_qwerty_black.xml index dfa7ef600..fc0ede3c5 100644 --- a/java/res/xml-de/kbd_qwerty_black.xml +++ b/java/res/xml-de/kbd_qwerty_black.xml @@ -28,43 +28,53 @@ diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml index 80d4d25de..c18339cb3 100644 --- a/java/res/xml-fr/kbd_qwerty.xml +++ b/java/res/xml-fr/kbd_qwerty.xml @@ -28,43 +28,53 @@ diff --git a/java/res/xml-fr/kbd_qwerty_black.xml b/java/res/xml-fr/kbd_qwerty_black.xml index 28bf3f9ef..c0f263f25 100644 --- a/java/res/xml-fr/kbd_qwerty_black.xml +++ b/java/res/xml-fr/kbd_qwerty_black.xml @@ -28,43 +28,53 @@ diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml index 8921d5353..ea7fb3042 100644 --- a/java/res/xml-nb/kbd_qwerty.xml +++ b/java/res/xml-nb/kbd_qwerty.xml @@ -34,44 +34,54 @@ diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml index 7d23dc540..8391ef761 100644 --- a/java/res/xml-xlarge/kbd_symbols.xml +++ b/java/res/xml-xlarge/kbd_symbols.xml @@ -30,6 +30,7 @@ @@ -102,7 +103,7 @@ @@ -102,7 +103,7 @@ diff --git a/java/res/xml/kbd_qwerty_black.xml b/java/res/xml/kbd_qwerty_black.xml index fff409340..a35731815 100644 --- a/java/res/xml/kbd_qwerty_black.xml +++ b/java/res/xml/kbd_qwerty_black.xml @@ -28,43 +28,53 @@ diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index 6f32f9c1a..0bf4f4eaa 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -194,9 +194,13 @@ public class BaseKeyboard { /** Label to display */ public CharSequence label; + /** Label to display when keyboard is in temporary shift mode */ + public CharSequence temporaryShiftLabel; /** Icon to display instead of a label. Icon takes precedence over a label */ public Drawable icon; + /** Hint icon to display on the key in conjunction with the label */ + public Drawable hintIcon; /** Preview version of the icon, for the preview popup */ public Drawable iconPreview; /** Width of the key, not including the gap */ @@ -294,22 +298,17 @@ public class BaseKeyboard { TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); - width = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyWidth, + width = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyWidth, keyboard.mDisplayWidth, parent.defaultWidth); - height = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyHeight, + height = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyHeight, keyboard.mDisplayHeight, parent.defaultHeight); - gap = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_horizontalGap, + gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, keyboard.mDisplayWidth, parent.defaultHorizontalGap); a.recycle(); - a = res.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.BaseKeyboard_Key); + a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard_Key); this.x += gap; TypedValue codesValue = new TypedValue(); - a.getValue(R.styleable.BaseKeyboard_Key_codes, - codesValue); + a.getValue(R.styleable.BaseKeyboard_Key_codes, codesValue); if (codesValue.type == TypedValue.TYPE_INT_DEC || codesValue.type == TypedValue.TYPE_INT_HEX) { codes = new int[] { codesValue.data }; @@ -318,29 +317,22 @@ public class BaseKeyboard { } iconPreview = a.getDrawable(R.styleable.BaseKeyboard_Key_iconPreview); - if (iconPreview != null) { - iconPreview.setBounds(0, 0, iconPreview.getIntrinsicWidth(), - iconPreview.getIntrinsicHeight()); - } - popupCharacters = a.getText( - R.styleable.BaseKeyboard_Key_popupCharacters); - popupResId = a.getResourceId( - R.styleable.BaseKeyboard_Key_popupKeyboard, 0); - repeatable = a.getBoolean( - R.styleable.BaseKeyboard_Key_isRepeatable, false); - modifier = a.getBoolean( - R.styleable.BaseKeyboard_Key_isModifier, false); - sticky = a.getBoolean( - R.styleable.BaseKeyboard_Key_isSticky, false); + setDefaultBounds(iconPreview); + popupCharacters = a.getText(R.styleable.BaseKeyboard_Key_popupCharacters); + popupResId = a.getResourceId(R.styleable.BaseKeyboard_Key_popupKeyboard, 0); + repeatable = a.getBoolean(R.styleable.BaseKeyboard_Key_isRepeatable, false); + modifier = a.getBoolean(R.styleable.BaseKeyboard_Key_isModifier, false); + sticky = a.getBoolean(R.styleable.BaseKeyboard_Key_isSticky, false); edgeFlags = a.getInt(R.styleable.BaseKeyboard_Key_keyEdgeFlags, 0); edgeFlags |= parent.rowEdgeFlags; - icon = a.getDrawable( - R.styleable.BaseKeyboard_Key_keyIcon); - if (icon != null) { - icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); - } + icon = a.getDrawable(R.styleable.BaseKeyboard_Key_keyIcon); + setDefaultBounds(icon); + hintIcon = a.getDrawable(R.styleable.BaseKeyboard_Key_keyHintIcon); + setDefaultBounds(hintIcon); + label = a.getText(R.styleable.BaseKeyboard_Key_keyLabel); + temporaryShiftLabel = a.getText(R.styleable.BaseKeyboard_Key_temporaryShiftKeyLabel); text = a.getText(R.styleable.BaseKeyboard_Key_keyOutputText); if (codes == null && !TextUtils.isEmpty(label)) { @@ -679,10 +671,12 @@ public class BaseKeyboard { return new int[0]; } + // TODO should be private protected Row createRowFromXml(Resources res, XmlResourceParser parser) { return new Row(res, this, parser); } + // TODO should be private protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { return new Key(res, parent, x, y, parser); @@ -707,6 +701,7 @@ public class BaseKeyboard { if (TAG_ROW.equals(tag)) { inRow = true; x = 0; + // TODO createRowFromXml should not be called from BaseKeyboard constructor. currentRow = createRowFromXml(res, parser); skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode; if (skipRow) { @@ -715,6 +710,7 @@ public class BaseKeyboard { } } else if (TAG_KEY.equals(tag)) { inKey = true; + // TODO createKeyFromXml should not be called from BaseKeyboard constructor. key = createKeyFromXml(res, currentRow, x, y, parser); mKeys.add(key); if (key.codes[0] == KEYCODE_SHIFT) { @@ -793,4 +789,10 @@ public class BaseKeyboard { } return defValue; } + + protected static void setDefaultBounds(Drawable drawable) { + if (drawable != null) + drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), + drawable.getIntrinsicHeight()); + } } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 53ccf3629..3fc484d09 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -62,9 +62,6 @@ public class LatinKeyboard extends BaseKeyboard { private Key mF1Key; private Key mSpaceKey; private Key m123Key; - private final int NUMBER_HINT_COUNT = 10; - private Key[] mNumberHintKeys; - private Drawable[] mNumberHintIcons = new Drawable[NUMBER_HINT_COUNT]; private int mSpaceKeyIndex = -1; private int mSpaceDragStartX; private int mSpaceDragLastDiff; @@ -119,9 +116,7 @@ public class LatinKeyboard extends BaseKeyboard { mRes = res; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); - mShiftLockPreviewIcon.setBounds(0, 0, - mShiftLockPreviewIcon.getIntrinsicWidth(), - mShiftLockPreviewIcon.getIntrinsicHeight()); + setDefaultBounds(mShiftLockPreviewIcon); mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space); mSpaceAutoCompletionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led); mSpacePreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_space); @@ -138,37 +133,11 @@ public class LatinKeyboard extends BaseKeyboard { mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty || xmlLayoutResId == R.xml.kbd_qwerty_black; mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); - initializeNumberHintResources(context); - } - - private void initializeNumberHintResources(Context context) { - final Resources res = context.getResources(); - mNumberHintIcons[0] = res.getDrawable(R.drawable.keyboard_hint_0); - mNumberHintIcons[1] = res.getDrawable(R.drawable.keyboard_hint_1); - mNumberHintIcons[2] = res.getDrawable(R.drawable.keyboard_hint_2); - mNumberHintIcons[3] = res.getDrawable(R.drawable.keyboard_hint_3); - mNumberHintIcons[4] = res.getDrawable(R.drawable.keyboard_hint_4); - mNumberHintIcons[5] = res.getDrawable(R.drawable.keyboard_hint_5); - mNumberHintIcons[6] = res.getDrawable(R.drawable.keyboard_hint_6); - mNumberHintIcons[7] = res.getDrawable(R.drawable.keyboard_hint_7); - mNumberHintIcons[8] = res.getDrawable(R.drawable.keyboard_hint_8); - mNumberHintIcons[9] = res.getDrawable(R.drawable.keyboard_hint_9); - } - - // TODO: delete this method and do initialization in constructor. - private void initializeMemberVariablesAsNeeded() { - if (mNumberHintKeys == null) - mNumberHintKeys = new Key[NUMBER_HINT_COUNT]; } @Override protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { - // TODO: This initialization is needed because this protected method is being called from - // the base class constructor before this class constructor gets called. We need to fix - // this. - initializeMemberVariablesAsNeeded(); - Key key = new LatinKey(res, parent, x, y, parser); switch (key.codes[0]) { case LatinIME.KEYCODE_ENTER: @@ -186,17 +155,6 @@ public class LatinKeyboard extends BaseKeyboard { break; } - // For number hints on the upper-right corner of key - int hintNumber = -1; - if (LatinKeyboardBaseView.isNumberAtLeftmostPopupChar(key)) { - hintNumber = key.popupCharacters.charAt(0) - '0'; - } else if (LatinKeyboardBaseView.isNumberAtRightmostPopupChar(key)) { - hintNumber = key.popupCharacters.charAt(key.popupCharacters.length() - 1) - '0'; - } - if (hintNumber >= 0 && hintNumber <= 9) { - mNumberHintKeys[hintNumber] = key; - } - return key; } @@ -251,11 +209,7 @@ public class LatinKeyboard extends BaseKeyboard { break; } // Set the initial size of the preview icon - if (mEnterKey.iconPreview != null) { - mEnterKey.iconPreview.setBounds(0, 0, - mEnterKey.iconPreview.getIntrinsicWidth(), - mEnterKey.iconPreview.getIntrinsicHeight()); - } + setDefaultBounds(mEnterKey.iconPreview); } } @@ -279,7 +233,7 @@ public class LatinKeyboard extends BaseKeyboard { public boolean isShiftLocked() { return mShiftState == SHIFT_LOCKED; } - + @Override public boolean setShifted(boolean shiftState) { boolean shiftChanged = false; @@ -314,6 +268,10 @@ public class LatinKeyboard extends BaseKeyboard { } } + public boolean isTemporaryUpperCase() { + return mIsAlphaKeyboard && isShifted() && !isShiftLocked(); + } + /* package */ boolean isAlphaKeyboard() { return mIsAlphaKeyboard; } @@ -335,11 +293,6 @@ public class LatinKeyboard extends BaseKeyboard { if (mSpaceKey != null) { updateSpaceBarForLocale(isAutoCompletion, isBlack); } - updateNumberHintKeys(); - } - - private void setDefaultBounds(Drawable drawable) { - drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); } public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) { @@ -385,14 +338,6 @@ public class LatinKeyboard extends BaseKeyboard { return mSpaceKey; } - private void updateNumberHintKeys() { - for (int i = 0; i < mNumberHintKeys.length; ++i) { - if (mNumberHintKeys[i] != null) { - mNumberHintKeys[i].icon = mNumberHintIcons[i]; - } - } - } - public boolean isLanguageSwitchEnabled() { return mLocale != null; } @@ -828,8 +773,7 @@ public class LatinKeyboard extends BaseKeyboard { public SlidingLocaleDrawable(Drawable background, int width, int height) { mBackground = background; - mBackground.setBounds(0, 0, - mBackground.getIntrinsicWidth(), mBackground.getIntrinsicHeight()); + setDefaultBounds(mBackground); mWidth = width; mHeight = height; mTextPaint = new TextPaint(); @@ -887,7 +831,7 @@ public class LatinKeyboard extends BaseKeyboard { canvas.drawText(mNextLanguage, diff - width / 2, baseline, paint); canvas.drawText(mPrevLanguage, diff + width + width / 2, baseline, paint); - lArrow.setBounds(0, 0, lArrow.getIntrinsicWidth(), lArrow.getIntrinsicHeight()); + setDefaultBounds(lArrow); rArrow.setBounds(width - rArrow.getIntrinsicWidth(), 0, width, rArrow.getIntrinsicHeight()); lArrow.draw(canvas); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 264e2f18f..05b29b9b5 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -578,7 +578,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mKeys = mKeyDetector.setKeyboard(keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection); for (PointerTracker tracker : mPointerTrackers) { - tracker.setKeyboard(mKeys, mKeyHysteresisDistance); + tracker.setKeyboard(keyboard, mKeys, mKeyHysteresisDistance); } requestLayout(); // Hint to reallocate the buffer if the size changed @@ -802,8 +802,19 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop); keyBackground.draw(canvas); - boolean shouldDrawIcon = true; + boolean drawHintIcon = true; if (label != null) { + // If keyboard is multi-touch capable and in temporary upper case state and key has + // tempoarary shift label, label should be hint character and hint icon should not + // be drawn. + if (mHasDistinctMultitouch + && mKeyboard instanceof LatinKeyboard + && ((LatinKeyboard)mKeyboard).isTemporaryUpperCase() + && key.temporaryShiftLabel != null) { + label = key.temporaryShiftLabel.toString(); + drawHintIcon = false; + } + // For characters, use large font. For labels like "Done", use small font. if (label.length() > 1 && key.codes.length < 2) { paint.setTextSize(mLabelTextSize); @@ -823,25 +834,26 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx paint); // Turn off drop shadow paint.setShadowLayer(0, 0, 0, 0); - - // Usually don't draw icon if label is not null, but we draw icon for the number - // hint. - shouldDrawIcon = isNumberAtEdgeOfPopupChars(key); } - if (key.icon != null && shouldDrawIcon) { - // Special handing for the upper-right number hint icons - final int drawableWidth = isNumberAtEdgeOfPopupChars(key) ? - key.width : key.icon.getIntrinsicWidth(); - final int drawableHeight = isNumberAtEdgeOfPopupChars(key) ? - key.height : key.icon.getIntrinsicHeight(); + Drawable icon = null; + if (key.label == null && key.icon != null) + icon = key.icon; + if (icon == null && key.hintIcon != null && drawHintIcon) + icon = key.hintIcon; + if (icon != null) { + // Hack for key hint icon displaying at the top right corner of the key. + final int drawableWidth = icon == key.hintIcon + ? key.width : icon.getIntrinsicWidth(); + final int drawableHeight = icon == key.hintIcon + ? key.height : icon.getIntrinsicHeight(); final int drawableX = (key.width - padding.left - padding.right - drawableWidth) / 2 + padding.left; final int drawableY = (key.height - padding.top - padding.bottom - drawableHeight) / 2 + padding.top; canvas.translate(drawableX, drawableY); - key.icon.setBounds(0, 0, drawableWidth, drawableHeight); - key.icon.draw(canvas); + icon.setBounds(0, 0, drawableWidth, drawableHeight); + icon.draw(canvas); canvas.translate(-drawableX, -drawableY); } canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop); @@ -906,16 +918,18 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } } + // TODO Must fix popup preview on xlarge layout private void showKey(final int keyIndex, PointerTracker tracker) { Key key = tracker.getKey(keyIndex); if (key == null) return; // Should not draw number hint icons - if (key.icon != null && !isNumberAtEdgeOfPopupChars(key)) { + if (key.icon != null && key.label == null) { mPreviewText.setCompoundDrawables(null, null, null, key.iconPreview != null ? key.iconPreview : key.icon); mPreviewText.setText(null); } else { + // TODO Should take care of temporaryShiftLabel here. mPreviewText.setCompoundDrawables(null, null, null, null); mPreviewText.setText(adjustCase(tracker.getPreviewText(key))); if (key.label.length() > 1 && key.codes.length < 2) { @@ -997,7 +1011,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx * Invalidates a key so that it will be redrawn on the next repaint. Use this method if only * one key is changing it's content. Any changes that affect the position or size of the key * may not be honored. - * @param key key in the attached {@link Keyboard}. + * @param key key in the attached {@link BaseKeyboard}. * @see #invalidateAllKeys */ public void invalidateKey(Key key) { @@ -1182,11 +1196,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; } - private static boolean isNumberAtEdgeOfPopupChars(Key key) { - return isNumberAtLeftmostPopupChar(key) || isNumberAtRightmostPopupChar(key); - } - - /* package */ static boolean isNumberAtLeftmostPopupChar(Key key) { + private static boolean isNumberAtLeftmostPopupChar(Key key) { if (key.popupCharacters != null && key.popupCharacters.length() > 0 && isAsciiDigit(key.popupCharacters.charAt(0))) { return true; @@ -1194,14 +1204,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; } - /* package */ static boolean isNumberAtRightmostPopupChar(Key key) { - if (key.popupCharacters != null && key.popupCharacters.length() > 0 - && isAsciiDigit(key.popupCharacters.charAt(key.popupCharacters.length() - 1))) { - return true; - } - return false; - } - private static boolean isAsciiDigit(char c) { return (c < 0x80) && Character.isDigit(c); } @@ -1221,7 +1223,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx final PointerTracker tracker = new PointerTracker(i, mHandler, mKeyDetector, this, mHasDistinctMultitouch); if (keys != null) - tracker.setKeyboard(keys, mKeyHysteresisDistance); + tracker.setKeyboard(mKeyboard, keys, mKeyHysteresisDistance); if (listener != null) tracker.setOnKeyboardActionListener(listener); pointers.add(tracker); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 912af7e2a..f3d045bec 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -109,9 +109,9 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { @Override protected CharSequence adjustCase(CharSequence label) { BaseKeyboard keyboard = getKeyboard(); - if (keyboard.isShifted() - && keyboard instanceof LatinKeyboard + if (keyboard instanceof LatinKeyboard && ((LatinKeyboard) keyboard).isAlphaKeyboard() + && keyboard.isShifted() && !TextUtils.isEmpty(label) && label.length() < 3 && Character.isLowerCase(label.charAt(0))) { label = label.toString().toUpperCase(); diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index cf4f7d5c2..6517a206e 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -52,6 +52,7 @@ public class PointerTracker { private OnKeyboardActionListener mListener; private final boolean mHasDistinctMultitouch; + private BaseKeyboard mKeyboard; private Key[] mKeys; private int mKeyHysteresisDistanceSquared = -1; @@ -179,9 +180,10 @@ public class PointerTracker { mListener = listener; } - public void setKeyboard(Key[] keys, float keyHysteresisDistance) { - if (keys == null || keyHysteresisDistance < 0) + public void setKeyboard(BaseKeyboard keyboard, Key[] keys, float keyHysteresisDistance) { + if (keyboard == null || keys == null || keyHysteresisDistance < 0) throw new IllegalArgumentException(); + mKeyboard = keyboard; mKeys = keys; mKeyHysteresisDistanceSquared = (int)(keyHysteresisDistance * keyHysteresisDistance); // Update current key index because keyboard layout has been changed. @@ -280,7 +282,7 @@ public class PointerTracker { mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex, this); mIsRepeatableKey = true; } - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + startLongPressTimer(keyIndex); } showKeyPreviewAndUpdateKey(keyIndex); } @@ -292,14 +294,15 @@ public class PointerTracker { return; KeyState keyState = mKeyState; int keyIndex = keyState.onMoveKey(x, y); - if (isValidKeyIndex(keyIndex)) { + Key key = getKey(keyIndex); + if (key != null) { if (keyState.getKeyIndex() == NOT_A_KEY) { keyState.onMoveToNewKey(keyIndex, x, y); - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + startLongPressTimer(keyIndex); } else if (!isMinorMoveBounce(x, y, keyIndex)) { resetMultiTap(); keyState.onMoveToNewKey(keyIndex, x, y); - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + startLongPressTimer(keyIndex); } } else { if (keyState.getKeyIndex() != NOT_A_KEY) { @@ -415,6 +418,20 @@ public class PointerTracker { } } + private void startLongPressTimer(int keyIndex) { + Key key = getKey(keyIndex); + // If keyboard is in temporary upper case state and the key has temporary shift label, + // long press should not be started. + if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) + return; + mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + } + + private boolean isTemporaryUpperCase() { + return mKeyboard instanceof LatinKeyboard + && ((LatinKeyboard)mKeyboard).isTemporaryUpperCase(); + } + private void detectAndSendKey(int index, int x, int y, long eventTime) { final OnKeyboardActionListener listener = mListener; final Key key = getKey(index); @@ -442,6 +459,14 @@ public class PointerTracker { } code = key.codes[mTapCount]; } + + // If keyboard is in temporary upper case state and key has temporary shift label, + // alternate character code should be sent. + if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) { + code = key.temporaryShiftLabel.charAt(0); + codes[0] = code; + } + /* * Swap the first and second values in the codes array if the primary code is not * the first value but the second value in the array. This happens when key -- cgit v1.2.3-83-g751a From 55b10796522b871c1e04d6f2254fdff5dc7aced4 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Tue, 5 Oct 2010 22:51:59 +0900 Subject: Addressed bug: 3058217 "-" key not working at beginning of line Also fixed related issues below: * Punc suggestions list was sometimes not displayed after cursor move which follows re-correction * Punc suggestions list was disappearing with words which contains certain punc chars (but not word separator) such as ' and - Change-Id: I36faf679321782fa8eaf318411308a4a6b89cc25 --- .../com/android/inputmethod/latin/LatinIME.java | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index fb9c47db2..4328b823d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -699,7 +699,9 @@ public class LatinIME extends InputMethodService mLastSelectionEnd = et.startOffset + et.selectionEnd; // Then look for possible corrections in a delayed fashion - if (!TextUtils.isEmpty(et.text)) postUpdateOldSuggestions(); + if (!TextUtils.isEmpty(et.text) && isCursorTouchingWord()) { + postUpdateOldSuggestions(); + } } } @@ -805,6 +807,10 @@ public class LatinIME extends InputMethodService postUpdateOldSuggestions(); } else { abortCorrection(false); + // Show the punctuation suggestions list if the current one is not + if (!mSuggestPuncList.equals(mCandidateView.getSuggestions())) { + setNextSuggestions(); + } } } } @@ -1315,7 +1321,7 @@ public class LatinIME extends InputMethodService } else if (deleteChar) { if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) { // Go back to the suggestion mode if the user canceled the - // "Tap again to save". + // "Touch again to save". // NOTE: In gerenal, we don't revert the word when backspacing // from a manual suggestion pick. We deliberately chose a // different behavior only in the case of picking the first @@ -1444,7 +1450,7 @@ public class LatinIME extends InputMethodService mVoiceInput.incrementTextModificationInsertPunctuationCount(1); } - // Should dismiss the "Tap again to save" message when handling separator + // Should dismiss the "Touch again to save" message when handling separator if (mCandidateView != null && mCandidateView.dismissAddToDictionaryHint()) { postUpdateSuggestions(); } @@ -1887,7 +1893,8 @@ public class LatinIME extends InputMethodService // So, LatinImeLogger logs "" as a user's input. LatinImeLogger.logOnManualSuggestion( "", suggestion.toString(), index, suggestions); - onKey(suggestion.charAt(0), null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, + final char primaryCode = suggestion.charAt(0); + onKey(primaryCode, new int[]{primaryCode}, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); if (ic != null) { ic.endBatchEdit(); @@ -1922,7 +1929,7 @@ public class LatinIME extends InputMethodService TextEntryState.typedCharacter((char) KEYCODE_SPACE, true); setNextSuggestions(); } else if (!showingAddToDictionaryHint) { - // If we're not showing the "Tap again to save hint", then show corrections again. + // If we're not showing the "Touch again to save hint", then show corrections again. // In case the cursor position doesn't change, make sure we show the suggestions again. clearSuggestions(); postUpdateOldSuggestions(); @@ -2094,7 +2101,7 @@ public class LatinIME extends InputMethodService ic.endBatchEdit(); } else { abortCorrection(true); - setNextSuggestions(); + setNextSuggestions(); // Show the punctuation suggestions list } } else { abortCorrection(true); @@ -2150,11 +2157,13 @@ public class LatinIME extends InputMethodService CharSequence toLeft = ic.getTextBeforeCursor(1, 0); CharSequence toRight = ic.getTextAfterCursor(1, 0); if (!TextUtils.isEmpty(toLeft) - && !isWordSeparator(toLeft.charAt(0))) { + && !isWordSeparator(toLeft.charAt(0)) + && !isSuggestedPunctuation(toLeft.charAt(0))) { return true; } if (!TextUtils.isEmpty(toRight) - && !isWordSeparator(toRight.charAt(0))) { + && !isWordSeparator(toRight.charAt(0)) + && !isSuggestedPunctuation(toRight.charAt(0))) { return true; } return false; -- cgit v1.2.3-83-g751a From 6495bfc7a6f6bfa6ab82e7f062ee80f4b6b33368 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Wed, 6 Oct 2010 18:39:47 +0900 Subject: Follow-up to I36faf679 Cancel pending messages related to suggestion updates. bug: 3058217 Change-Id: I54e29bf051b76ad27e6d653adbf14892083ad7eb --- java/src/com/android/inputmethod/latin/LatinIME.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 4328b823d..8eeae8600 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -727,6 +727,14 @@ public class LatinIME extends InputMethodService if (mUserBigramDictionary != null) mUserBigramDictionary.flushPendingWrites(); } + @Override + public void onFinishInputView(boolean finishingInput) { + super.onFinishInputView(finishingInput); + // Remove penging messages related to update suggestions + mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS); + mHandler.removeMessages(MSG_UPDATE_OLD_SUGGESTIONS); + } + @Override public void onUpdateExtractedText(int token, ExtractedText text) { super.onUpdateExtractedText(token, text); -- cgit v1.2.3-83-g751a From d663555c9fe5b95caedbc25a74458b951128da80 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 7 Oct 2010 17:13:30 +0900 Subject: Keyboard XML file supports include and merge tag Keyboard XML file can include other keyboard XML file using directive . The keyboard XML file which is included must have tag as root element. Change-Id: I06c35fe7b3db5232acdb33f73a79f38d31261b32 --- java/res/values/attrs.xml | 4 + .../android/inputmethod/latin/BaseKeyboard.java | 227 ++++++++++++++------- 2 files changed, 160 insertions(+), 71 deletions(-) (limited to 'java/src') diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 19002140c..318286ea8 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -129,4 +129,8 @@ requested keyboard mode, the row will be skipped. --> + + + + diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index 0bf4f4eaa..0327006c9 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -24,17 +24,17 @@ import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.util.Xml; -import android.util.DisplayMetrics; +import android.view.InflateException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; - /** * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard * consists of rows of keys. @@ -61,6 +61,8 @@ public class BaseKeyboard { private static final String TAG_KEYBOARD = "Keyboard"; private static final String TAG_ROW = "Row"; private static final String TAG_KEY = "Key"; + private static final String TAG_INCLUDE = "include"; + private static final String TAG_MERGE = "merge"; public static final int EDGE_LEFT = 0x01; public static final int EDGE_RIGHT = 0x02; @@ -104,9 +106,6 @@ public class BaseKeyboard { /** List of keys in this keyboard */ private final List mKeys = new ArrayList(); - /** List of modifier keys such as Shift & Alt, if any */ - private final List mModifierKeys = new ArrayList(); - /** Width of the screen available to fit the keyboard */ private final int mDisplayWidth; @@ -177,8 +176,7 @@ public class BaseKeyboard { a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard_Row); rowEdgeFlags = a.getInt(R.styleable.BaseKeyboard_Row_rowEdgeFlags, 0); - mode = a.getResourceId(R.styleable.BaseKeyboard_Row_keyboardMode, - 0); + mode = a.getResourceId(R.styleable.BaseKeyboard_Row_keyboardMode, 0); } } @@ -558,10 +556,6 @@ public class BaseKeyboard { return mKeys; } - public List getModifierKeys() { - return mModifierKeys; - } - protected int getHorizontalGap() { return mDefaultHorizontalGap; } @@ -682,79 +676,170 @@ public class BaseKeyboard { return new Key(res, parent, x, y, parser); } + private static class KeyboardParseState { + private final int mKeyboardMode; + private int mCurrentX = 0; + private int mCurrentY = 0; + private int mMaxRowWidth = 0; + private int mTotalHeight = 0; + private Row mCurrentRow = null; + + public KeyboardParseState(int keyboardMode) { + mKeyboardMode = keyboardMode; + } + + public int getX() { + return mCurrentX; + } + + public int getY() { + return mCurrentY; + } + + public Row getRow() { + return mCurrentRow; + } + + // return true if the row is valid for this keyboard mode + public boolean startRow(Row row) { + mCurrentX = 0; + mCurrentRow = row; + return row.mode == 0 || row.mode == mKeyboardMode; + } + + public void skipRow() { + mCurrentRow = null; + } + + public void endRow() { + if (mCurrentRow == null) + throw new InflateException("orphant end row tag"); + mCurrentY += mCurrentRow.verticalGap + mCurrentRow.defaultHeight; + mCurrentRow = null; + } + + public void endKey(Key key) { + mCurrentX += key.gap + key.width; + if (mCurrentX > mMaxRowWidth) + mMaxRowWidth = mCurrentX; + } + + public void endKeyboard(int defaultVerticalGap) { + mTotalHeight = mCurrentY - defaultVerticalGap; + } + + public int getMaxRowWidth() { + return mMaxRowWidth; + } + + public int getTotalHeight() { + return mTotalHeight; + } + } + private void loadKeyboard(Context context, XmlResourceParser parser) { - boolean inKey = false; - boolean inRow = false; - int row = 0; - int x = 0; - int y = 0; + try { + KeyboardParseState state = new KeyboardParseState(mKeyboardMode); + parseKeyboard(context.getResources(), parser, state); + // mTotalWidth is the width of this keyboard which is maximum width of row. + mTotalWidth = state.getMaxRowWidth(); + mTotalHeight = state.getTotalHeight(); + } catch (XmlPullParserException e) { + throw new IllegalArgumentException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void parseKeyboard(Resources res, XmlResourceParser parser, KeyboardParseState state) + throws XmlPullParserException, IOException { Key key = null; - Row currentRow = null; - Resources res = context.getResources(); - boolean skipRow = false; - try { - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.START_TAG) { - String tag = parser.getName(); - if (TAG_ROW.equals(tag)) { - inRow = true; - x = 0; - // TODO createRowFromXml should not be called from BaseKeyboard constructor. - currentRow = createRowFromXml(res, parser); - skipRow = currentRow.mode != 0 && currentRow.mode != mKeyboardMode; - if (skipRow) { - skipToEndOfRow(parser); - inRow = false; - } - } else if (TAG_KEY.equals(tag)) { - inKey = true; - // TODO createKeyFromXml should not be called from BaseKeyboard constructor. - key = createKeyFromXml(res, currentRow, x, y, parser); - mKeys.add(key); - if (key.codes[0] == KEYCODE_SHIFT) { - mShiftKeys.add(key); - mModifierKeys.add(key); - } else if (key.codes[0] == KEYCODE_ALT) { - mModifierKeys.add(key); - } - } else if (TAG_KEYBOARD.equals(tag)) { - parseKeyboardAttributes(res, parser); - } - } else if (event == XmlResourceParser.END_TAG) { - if (inKey) { - inKey = false; - x += key.gap + key.width; - if (x > mTotalWidth) { - mTotalWidth = x; - } - } else if (inRow) { - inRow = false; - y += currentRow.verticalGap; - y += currentRow.defaultHeight; - row++; - } else { - // TODO: error or extend? - } + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + // TODO createRowFromXml should not be called from BaseKeyboard constructor. + Row row = createRowFromXml(res, parser); + if (!state.startRow(row)) + skipToEndOfRow(parser, state); + } else if (TAG_KEY.equals(tag)) { + // TODO createKeyFromXml should not be called from BaseKeyboard constructor. + key = createKeyFromXml(res, state.getRow(), state.getX(), state.getY(), + parser); + mKeys.add(key); + if (key.codes[0] == KEYCODE_SHIFT) + mShiftKeys.add(key); + } else if (TAG_KEYBOARD.equals(tag)) { + parseKeyboardAttributes(res, parser); + } else if (TAG_INCLUDE.equals(tag)) { + if (parser.getDepth() == 0) + throw new InflateException(" cannot be the root element"); + parseInclude(res, parser, state); + } else if (TAG_MERGE.equals(tag)) { + throw new InflateException(" must not be appeared in keyboard XML file"); + } else { + throw new InflateException("unknown start tag: " + tag); + } + } else if (event == XmlResourceParser.END_TAG) { + String tag = parser.getName(); + if (TAG_KEY.equals(tag)) { + state.endKey(key); + } else if (TAG_ROW.equals(tag)) { + state.endRow(); + } else if (TAG_KEYBOARD.equals(tag)) { + state.endKeyboard(mDefaultVerticalGap); + } else if (TAG_INCLUDE.equals(tag)) { + ; + } else if (TAG_MERGE.equals(tag)) { + return; + } else { + throw new InflateException("unknown end tag: " + tag); + } + } + } + } + + private void parseInclude(Resources res, XmlResourceParser parent, KeyboardParseState state) + throws XmlPullParserException, IOException { + final TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parent), + R.styleable.BaseKeyboard_Include); + final int keyboardLayout = a.getResourceId( + R.styleable.BaseKeyboard_Include_keyboardLayout, 0); + a.recycle(); + if (keyboardLayout == 0) + throw new InflateException(" must have keyboardLayout attribute"); + final XmlResourceParser parser = res.getLayout(keyboardLayout); + + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String name = parser.getName(); + if (TAG_MERGE.equals(name)) { + parseKeyboard(res, parser, state); + return; + } else { + throw new InflateException( + "include keyboard layout must have root element"); } } - } catch (Exception e) { - Log.e(TAG, "Parse error:" + e); - e.printStackTrace(); } - mTotalHeight = y - mDefaultVerticalGap; } - private void skipToEndOfRow(XmlResourceParser parser) + private void skipToEndOfRow(XmlResourceParser parser, KeyboardParseState state) throws XmlPullParserException, IOException { int event; while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.END_TAG - && parser.getName().equals(TAG_ROW)) { - break; + if (event == XmlResourceParser.END_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + state.skipRow(); + return; + } } } + throw new InflateException("can not find "); } private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) { -- cgit v1.2.3-83-g751a From 7af745e6f66d6efdc5b0ad22ae25c28a411fbdc8 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 8 Oct 2010 15:56:25 +0900 Subject: Call InputMethodSubtypePicker instead of InputMethodPicker Change-Id: I7c29285f4fd304d08bfd8f5f72df3fc421090681 --- java/src/com/android/inputmethod/latin/LatinIME.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d0c8af5c4..bcf09c17d 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1138,9 +1138,9 @@ public class LatinIME extends InputMethodService } } - private void showInputMethodPicker() { + private void showInputMethodSubtypePicker() { ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) - .showInputMethodPicker(); + .showInputMethodSubtypePicker(); } private void onOptionKeyPressed() { @@ -1156,7 +1156,7 @@ public class LatinIME extends InputMethodService private void onOptionKeyLongPressed() { if (!isShowingOptionDialog()) { if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) { - showInputMethodPicker(); + showInputMethodSubtypePicker(); } else { launchSettings(); } @@ -2575,8 +2575,7 @@ public class LatinIME extends InputMethodService launchSettings(); break; case POS_METHOD: - ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) - .showInputMethodPicker(); + showInputMethodSubtypePicker(); break; } } -- cgit v1.2.3-83-g751a From 5e02930a7f40b704f357f127d3d38fbdc193ffa1 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 8 Oct 2010 12:51:15 +0900 Subject: Reduce delay before mini popup keyboard is shown Before this change, the delay was 500 ms that came from ViewConfiguration.getLongPressTimeout(). This change reduces the delay to 400 ms. Bug: 3074984 Change-Id: Ia5af5e877a3c4bb29211ef4040c728ac09a9fe85 --- java/res/layout/input_trans.xml | 32 ---------------------- java/res/values/config.xml | 4 +++ .../inputmethod/latin/LatinKeyboardBaseView.java | 7 +++-- .../android/inputmethod/latin/PointerTracker.java | 27 ++++++++++-------- 4 files changed, 23 insertions(+), 47 deletions(-) delete mode 100644 java/res/layout/input_trans.xml (limited to 'java/src') diff --git a/java/res/layout/input_trans.xml b/java/res/layout/input_trans.xml deleted file mode 100644 index 4c0979c04..000000000 --- a/java/res/layout/input_trans.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 6e941baaf..b11236a23 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -25,4 +25,8 @@ 90 0 100 + 400 + 50 + 400 + 800 diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 75ef691c8..bcd1bb056 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -154,7 +154,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } // Timing constants - private static final int REPEAT_INTERVAL = PointerTracker.REPEAT_INTERVAL; + private final int mKeyRepeatInterval; // Miscellaneous constants /* package */ static final int NOT_A_KEY = -1; @@ -261,7 +261,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx case MSG_REPEAT_KEY: { final PointerTracker tracker = (PointerTracker)msg.obj; tracker.repeatKey(msg.arg1); - startKeyRepeatTimer(REPEAT_INTERVAL, msg.arg1, tracker); + startKeyRepeatTimer(mKeyRepeatInterval, msg.arg1, tracker); break; } case MSG_LONGPRESS_KEY: { @@ -542,6 +542,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mHasDistinctMultitouch = context.getPackageManager() .hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT); + mKeyRepeatInterval = res.getInteger(R.integer.config_key_repeat_interval); } public void setOnKeyboardActionListener(OnKeyboardActionListener listener) { @@ -1218,7 +1219,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Create pointer trackers until we can get 'id+1'-th tracker, if needed. for (int i = pointers.size(); i <= id; i++) { final PointerTracker tracker = - new PointerTracker(i, mHandler, mKeyDetector, this, mHasDistinctMultitouch); + new PointerTracker(i, mHandler, mKeyDetector, this, getResources()); if (keys != null) tracker.setKeyboard(keys, mKeyHysteresisDistance); if (listener != null) diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index b416a984c..448e27910 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -19,11 +19,11 @@ package com.android.inputmethod.latin; import com.android.inputmethod.latin.LatinKeyboardBaseView.OnKeyboardActionListener; import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler; +import android.content.res.Resources; import android.inputmethodservice.Keyboard; import android.inputmethodservice.Keyboard.Key; import android.util.Log; import android.view.MotionEvent; -import android.view.ViewConfiguration; public class PointerTracker { private static final String TAG = "PointerTracker"; @@ -33,15 +33,15 @@ public class PointerTracker { public interface UIProxy { public void invalidateKey(Key key); public void showPreview(int keyIndex, PointerTracker tracker); + public boolean hasDistinctMultitouch(); } public final int mPointerId; // Timing constants - private static final int REPEAT_START_DELAY = 400; - /* package */ static final int REPEAT_INTERVAL = 50; // ~20 keys per second - private static final int LONGPRESS_TIMEOUT = ViewConfiguration.getLongPressTimeout(); - private static final int MULTITAP_INTERVAL = 800; // milliseconds + private final int mDelayBeforeKeyRepeatStart; + private final int mLongPressKeyTimeout; + private final int mMultiTapKeyTimeout; // Miscellaneous constants private static final int NOT_A_KEY = LatinKeyboardBaseView.NOT_A_KEY; @@ -164,7 +164,7 @@ public class PointerTracker { } public PointerTracker(int id, UIHandler handler, KeyDetector keyDetector, UIProxy proxy, - boolean hasDistinctMultitouch) { + Resources res) { if (proxy == null || handler == null || keyDetector == null) throw new NullPointerException(); mPointerId = id; @@ -172,7 +172,10 @@ public class PointerTracker { mHandler = handler; mKeyDetector = keyDetector; mKeyState = new KeyState(keyDetector); - mHasDistinctMultitouch = hasDistinctMultitouch; + mHasDistinctMultitouch = proxy.hasDistinctMultitouch(); + mDelayBeforeKeyRepeatStart = res.getInteger(R.integer.config_delay_before_key_repeat_start); + mLongPressKeyTimeout = res.getInteger(R.integer.config_long_press_key_timeout); + mMultiTapKeyTimeout = res.getInteger(R.integer.config_multi_tap_key_timeout); resetMultiTap(); } @@ -278,10 +281,10 @@ public class PointerTracker { if (isValidKeyIndex(keyIndex)) { if (mKeys[keyIndex].repeatable) { repeatKey(keyIndex); - mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex, this); + mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart, keyIndex, this); mIsRepeatableKey = true; } - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); } showKeyPreviewAndUpdateKey(keyIndex); } @@ -296,11 +299,11 @@ public class PointerTracker { if (isValidKeyIndex(keyIndex)) { if (keyState.getKeyIndex() == NOT_A_KEY) { keyState.onMoveToNewKey(keyIndex, x, y); - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); } else if (!isMinorMoveBounce(x, y, keyIndex)) { resetMultiTap(); keyState.onMoveToNewKey(keyIndex, x, y); - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); } } else { if (keyState.getKeyIndex() != NOT_A_KEY) { @@ -489,7 +492,7 @@ public class PointerTracker { return; final boolean isMultiTap = - (eventTime < mLastTapTime + MULTITAP_INTERVAL && keyIndex == mLastSentIndex); + (eventTime < mLastTapTime + mMultiTapKeyTimeout && keyIndex == mLastSentIndex); if (key.codes.length > 1) { mInMultiTap = true; if (isMultiTap) { -- cgit v1.2.3-83-g751a From 7e1f5a2d5a96c74691b3b09fa986efb7161e5a12 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 8 Oct 2010 22:17:16 +0900 Subject: Make sure to set symbol keyboard shifted To avoid a corner case of bug#3070963, in toggleShift() method of KeyboardSwitcher, the shifted symbol keyboard will be set if current keyboard is symbol keyboard or is not shifted symbol keyboard. This change also implements mini keyboard cache with WeakHashMap. Bug: 3070963 Change-Id: I868fc072e2f21bddded1622b800a53b9a6a43e91 --- .../inputmethod/latin/KeyboardSwitcher.java | 19 ++++++++++------ .../com/android/inputmethod/latin/LatinIME.java | 25 +++++++++++----------- .../inputmethod/latin/LatinKeyboardBaseView.java | 6 ++---- 3 files changed, 27 insertions(+), 23 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index ebf2f4e60..86dbf1f60 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -23,9 +23,9 @@ import android.preference.PreferenceManager; import android.view.InflateException; import java.lang.ref.SoftReference; +import java.util.Arrays; import java.util.HashMap; import java.util.Locale; -import java.util.Map; public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener { @@ -105,7 +105,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private KeyboardId mSymbolsShiftedId; private KeyboardId mCurrentId; - private final Map> mKeyboards; + private final HashMap> mKeyboards; private int mMode = MODE_NONE; /** One of the MODE_XXX values */ private int mImeOptions; @@ -194,11 +194,17 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public final boolean mEnableShiftLock; public final boolean mHasVoice; + private final int mHashCode; + public KeyboardId(int xml, int mode, boolean enableShiftLock, boolean hasVoice) { this.mXml = xml; this.mKeyboardMode = mode; this.mEnableShiftLock = enableShiftLock; this.mHasVoice = hasVoice; + + this.mHashCode = Arrays.hashCode(new Object[] { + xml, mode, enableShiftLock, hasVoice + }); } public KeyboardId(int xml, boolean hasVoice) { @@ -219,8 +225,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha @Override public int hashCode() { - return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1) - * (mHasVoice ? 4 : 8); + return mHashCode; } } @@ -378,7 +383,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } public void toggleShift() { - if (mCurrentId.equals(mSymbolsId)) { + if (isAlphabetMode()) + return; + if (mCurrentId.equals(mSymbolsId) || !mCurrentId.equals(mSymbolsShiftedId)) { LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId); mCurrentId = mSymbolsShiftedId; mInputView.setKeyboard(symbolsShiftedKeyboard); @@ -390,7 +397,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha symbolsShiftedKeyboard.setShiftLocked(true); symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(), mMode, mImeOptions); - } else if (mCurrentId.equals(mSymbolsShiftedId)) { + } else { LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId); mCurrentId = mSymbolsId; mInputView.setKeyboard(symbolsKeyboard); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 8eeae8600..7f84ed775 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -159,7 +159,7 @@ public class LatinIME extends InputMethodService private AlertDialog mOptionsDialog; private AlertDialog mVoiceWarningDialog; - KeyboardSwitcher mKeyboardSwitcher; + /* package */ KeyboardSwitcher mKeyboardSwitcher; private UserDictionary mUserDictionary; private UserBigramDictionary mUserBigramDictionary; @@ -168,7 +168,7 @@ public class LatinIME extends InputMethodService private Hints mHints; - Resources mResources; + private Resources mResources; private String mInputLocale; private String mSystemLocale; @@ -307,7 +307,7 @@ public class LatinIME extends InputMethodService } } - Handler mHandler = new Handler() { + /* package */ Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { @@ -339,7 +339,8 @@ public class LatinIME extends InputMethodService } }; - @Override public void onCreate() { + @Override + public void onCreate() { LatinImeLogger.init(this); super.onCreate(); //setStatusIcon(R.drawable.ime_qwerty); @@ -396,7 +397,7 @@ public class LatinIME extends InputMethodService * Loads a dictionary or multiple separated dictionary * @return returns array of dictionary resource ids */ - static int[] getDictionary(Resources res) { + /* package */ static int[] getDictionary(Resources res) { String packageName = LatinIME.class.getPackage().getName(); XmlResourceParser xrp = res.getXml(R.xml.dictionary); ArrayList dictionaries = new ArrayList(); @@ -1013,9 +1014,6 @@ public class LatinIME extends InputMethodService } private void reloadKeyboards() { - if (mKeyboardSwitcher == null) { - mKeyboardSwitcher = new KeyboardSwitcher(this); - } mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher); if (mKeyboardSwitcher.getInputView() != null && mKeyboardSwitcher.getKeyboardMode() != KeyboardSwitcher.MODE_NONE) { @@ -2406,20 +2404,20 @@ public class LatinIME extends InputMethodService mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_START_TUTORIAL), 500); } - void tutorialDone() { + /* package */ void tutorialDone() { mTutorial = null; } - void promoteToUserDictionary(String word, int frequency) { + /* package */ void promoteToUserDictionary(String word, int frequency) { if (mUserDictionary.isValidWord(word)) return; mUserDictionary.addWord(word, frequency); } - WordComposer getCurrentWord() { + /* package */ WordComposer getCurrentWord() { return mWord; } - boolean getPopupOn() { + /* package */ boolean getPopupOn() { return mPopupOn; } @@ -2576,7 +2574,8 @@ public class LatinIME extends InputMethodService return list; } - @Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { + @Override + protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) { super.dump(fd, fout, args); final Printer p = new PrintWriterPrinter(fout); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index bcd1bb056..f96a3599d 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -47,10 +47,9 @@ import android.widget.PopupWindow; import android.widget.TextView; import java.util.ArrayList; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map; +import java.util.WeakHashMap; /** * A view that renders a virtual {@link LatinKeyboard}. It handles rendering of keys and @@ -199,7 +198,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private PopupWindow mMiniKeyboardPopup; private LatinKeyboardBaseView mMiniKeyboard; private View mMiniKeyboardParent; - private Map mMiniKeyboardCache; + private final WeakHashMap mMiniKeyboardCache = new WeakHashMap(); private int mMiniKeyboardOriginX; private int mMiniKeyboardOriginY; private long mMiniKeyboardPopupTime; @@ -489,7 +488,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mPaint.setAlpha(255); mPadding = new Rect(0, 0, 0, 0); - mMiniKeyboardCache = new HashMap(); mKeyBackground.getPadding(mPadding); mSwipeThreshold = (int) (500 * res.getDisplayMetrics().density); -- cgit v1.2.3-83-g751a From 364da8c618303a7764595d2c15ee034a7671365d Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Mon, 11 Oct 2010 02:52:08 +0900 Subject: Fix - "Touch again to save" not working for manually picked suggestion when re-correction is enabled. bug: 3082806 Change-Id: I64e652b0ad1d496e102a7cc2cf9a5615df423192 --- java/src/com/android/inputmethod/latin/LatinIME.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 7f84ed775..4e0f7c56b 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -817,7 +817,10 @@ public class LatinIME extends InputMethodService } else { abortCorrection(false); // Show the punctuation suggestions list if the current one is not - if (!mSuggestPuncList.equals(mCandidateView.getSuggestions())) { + // and if not showing "Touch again to save". + if (mCandidateView != null + && !mSuggestPuncList.equals(mCandidateView.getSuggestions()) + && !mCandidateView.isShowingAddToDictionaryHint()) { setNextSuggestions(); } } @@ -1935,7 +1938,7 @@ public class LatinIME extends InputMethodService TextEntryState.typedCharacter((char) KEYCODE_SPACE, true); setNextSuggestions(); } else if (!showingAddToDictionaryHint) { - // If we're not showing the "Touch again to save hint", then show corrections again. + // If we're not showing the "Touch again to save", then show corrections again. // In case the cursor position doesn't change, make sure we show the suggestions again. clearSuggestions(); postUpdateOldSuggestions(); -- cgit v1.2.3-83-g751a From c2d7ac79bdadb4335ed69a4e9631e0ec2e3058f6 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sun, 10 Oct 2010 15:40:54 +0900 Subject: Tweak key width for 'o'-popup chars. We'll merge this to master for now, but we should have new attr (such as popupCharWidth) to handle this reasonably in the newly created BaseKeyboard class. bug: 3082178 Change-Id: I024b946aafbbeb07b865a09f489dacb56f0478d0 --- java/res/xml/kbd_popup_narrow_template.xml | 27 ++++++++++++++++++++++ java/res/xml/kbd_qwerty.xml | 2 +- java/res/xml/kbd_qwerty_black.xml | 2 +- .../inputmethod/latin/LatinKeyboardBaseView.java | 22 +++++++++++++----- 4 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 java/res/xml/kbd_popup_narrow_template.xml (limited to 'java/src') diff --git a/java/res/xml/kbd_popup_narrow_template.xml b/java/res/xml/kbd_popup_narrow_template.xml new file mode 100644 index 000000000..ed3b13003 --- /dev/null +++ b/java/res/xml/kbd_popup_narrow_template.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index 446467fa4..c6113abf7 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -61,7 +61,7 @@ android:popupCharacters="@string/alternates_for_i" /> keys = keyboard.getKeys(); + private static boolean isOneRowKeys(List keys) { if (keys.size() == 0) return false; final int edgeFlags = keys.get(0).edgeFlags; // HACK: The first key of mini keyboard which was inflated from xml and has multiple rows, @@ -1125,24 +1124,35 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx getLocationInWindow(mWindowOffset); } + // Get width of a key in the mini popup keyboard = "miniKeyWidth". + // On the other hand, "popupKey.width" is width of the pressed key on the main keyboard. + // We adjust the position of mini popup keyboard with the edge key in it: + // a) When we have the leftmost key in popup keyboard directly above the pressed key + // Right edges of both keys should be aligned for consistent default selection + // b) When we have the rightmost key in popup keyboard directly above the pressed key + // Left edges of both keys should be aligned for consistent default selection + final List miniKeys = mMiniKeyboard.getKeyboard().getKeys(); + final int miniKeyWidth = miniKeys.size() > 0 ? miniKeys.get(0).width : 0; + // HACK: Have the leftmost number in the popup characters right above the key boolean isNumberAtLeftmost = hasMultiplePopupChars(popupKey) && isNumberAtLeftmostPopupChar(popupKey); int popupX = popupKey.x + mWindowOffset[0]; - int popupY = popupKey.y + mWindowOffset[1]; + popupX += getPaddingLeft(); if (isNumberAtLeftmost) { + popupX += popupKey.width - miniKeyWidth; // adjustment for a) described above popupX -= container.getPaddingLeft(); } else { - popupX += popupKey.width + getPaddingLeft(); + popupX += miniKeyWidth; // adjustment for b) described above popupX -= container.getMeasuredWidth(); popupX += container.getPaddingRight(); } + int popupY = popupKey.y + mWindowOffset[1]; popupY += getPaddingTop(); popupY -= container.getMeasuredHeight(); popupY += container.getPaddingBottom(); final int x = popupX; - final int y = mShowPreview && isOneRowKeyboard(mMiniKeyboard.getKeyboard()) - ? mPopupPreviewDisplayedY : popupY; + final int y = mShowPreview && isOneRowKeys(miniKeys) ? mPopupPreviewDisplayedY : popupY; int adjustedX = x; if (x < 0) { -- cgit v1.2.3-83-g751a From c4b93e8d90c566cf8604c59b0c07aa5eba544c2c Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sun, 10 Oct 2010 17:15:21 -0700 Subject: Fix merge that should have been manually merged master was still using the deleted constants in different places and Java 6 didn't like the imports. Change-Id: If9472a2acb029e56790dc4d19ab62e608c970175 --- java/src/com/android/inputmethod/latin/PointerTracker.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index a1cc8090e..3b886200e 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -22,7 +22,6 @@ import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler; import android.content.res.Resources; import android.inputmethodservice.Keyboard; -import android.inputmethodservice.Keyboard.Key; import android.util.Log; import android.view.MotionEvent; @@ -429,7 +428,7 @@ public class PointerTracker { // long press should not be started. if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) return; - mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); + mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); } private boolean isTemporaryUpperCase() { -- cgit v1.2.3-83-g751a From a5a5ffc0dca3f3342a00d6b377c55e044f7c7ccf Mon Sep 17 00:00:00 2001 From: Maryam Garrett Date: Thu, 30 Sep 2010 22:37:22 -0400 Subject: Fix the over-calling of VoiceSearch Logging bug: 3035228 This change will reduce the number of times VoiceSearch app is called to log IME events. This is because it 1) only flushes the logs when there is relevant logging information available and 2) sets a flag in UserHappinessSignals so that other apps (eg: gmail/sms) can know if there is relevant logging information before sending the logging intent to voice search. Change-Id: I708fea5a38f854091f1101e4f6a3db46296f3e92 --- .../inputmethod/voice/VoiceInputLogger.java | 70 ++++++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/voice/VoiceInputLogger.java b/java/src/com/android/inputmethod/voice/VoiceInputLogger.java index 9d3a92037..188d1376e 100644 --- a/java/src/com/android/inputmethod/voice/VoiceInputLogger.java +++ b/java/src/com/android/inputmethod/voice/VoiceInputLogger.java @@ -17,6 +17,7 @@ package com.android.inputmethod.voice; import com.android.common.speech.LoggingEvents; +import com.android.common.userhappiness.UserHappinessSignals; import android.content.Context; import android.content.Intent; @@ -33,13 +34,17 @@ public class VoiceInputLogger { private static final String TAG = VoiceInputLogger.class.getSimpleName(); private static VoiceInputLogger sVoiceInputLogger; - + private final Context mContext; - + // The base intent used to form all broadcast intents to the logger // in VoiceSearch. private final Intent mBaseIntent; - + + // This flag is used to indicate when there are voice events that + // need to be flushed. + private boolean mHasLoggingInfo = false; + /** * Returns the singleton of the logger. * @@ -67,79 +72,97 @@ public class VoiceInputLogger { } public void flush() { - Intent i = new Intent(mBaseIntent); - i.putExtra(LoggingEvents.EXTRA_FLUSH, true); - mContext.sendBroadcast(i); + if (hasLoggingInfo()) { + Intent i = new Intent(mBaseIntent); + i.putExtra(LoggingEvents.EXTRA_FLUSH, true); + mContext.sendBroadcast(i); + setHasLoggingInfo(false); + } } public void keyboardWarningDialogShown() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.KEYBOARD_WARNING_DIALOG_SHOWN)); } public void keyboardWarningDialogDismissed() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.KEYBOARD_WARNING_DIALOG_DISMISSED)); } public void keyboardWarningDialogOk() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.KEYBOARD_WARNING_DIALOG_OK)); } public void keyboardWarningDialogCancel() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.KEYBOARD_WARNING_DIALOG_CANCEL)); } public void settingsWarningDialogShown() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_SHOWN)); } public void settingsWarningDialogDismissed() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_DISMISSED)); } public void settingsWarningDialogOk() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_OK)); } public void settingsWarningDialogCancel() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.SETTINGS_WARNING_DIALOG_CANCEL)); } public void swipeHintDisplayed() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.SWIPE_HINT_DISPLAYED)); } public void cancelDuringListening() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.CANCEL_DURING_LISTENING)); } public void cancelDuringWorking() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.CANCEL_DURING_WORKING)); } public void cancelDuringError() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.CANCEL_DURING_ERROR)); } public void punctuationHintDisplayed() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.PUNCTUATION_HINT_DISPLAYED)); } public void error(int code) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.ERROR); i.putExtra(LoggingEvents.VoiceIme.EXTRA_ERROR_CODE, code); mContext.sendBroadcast(i); } public void start(String locale, boolean swipe) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.START); i.putExtra(LoggingEvents.VoiceIme.EXTRA_START_LOCALE, locale); i.putExtra(LoggingEvents.VoiceIme.EXTRA_START_SWIPE, swipe); @@ -148,12 +171,14 @@ public class VoiceInputLogger { } public void voiceInputDelivered(int length) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.VOICE_INPUT_DELIVERED); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length); mContext.sendBroadcast(i); } public void textModifiedByTypingInsertion(int length) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE, @@ -162,6 +187,7 @@ public class VoiceInputLogger { } public void textModifiedByTypingInsertionPunctuation(int length) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE, @@ -170,6 +196,7 @@ public class VoiceInputLogger { } public void textModifiedByTypingDeletion(int length) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE, @@ -179,6 +206,7 @@ public class VoiceInputLogger { } public void textModifiedByChooseSuggestion(int length) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.TEXT_MODIFIED); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_LENGTH, length); i.putExtra(LoggingEvents.VoiceIme.EXTRA_TEXT_MODIFIED_TYPE, @@ -187,22 +215,52 @@ public class VoiceInputLogger { } public void nBestChoose(int index) { + setHasLoggingInfo(true); Intent i = newLoggingBroadcast(LoggingEvents.VoiceIme.N_BEST_CHOOSE); i.putExtra(LoggingEvents.VoiceIme.EXTRA_N_BEST_CHOOSE_INDEX, index); mContext.sendBroadcast(i); } public void inputEnded() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast(LoggingEvents.VoiceIme.INPUT_ENDED)); } public void voiceInputSettingEnabled() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.VOICE_INPUT_SETTING_ENABLED)); } public void voiceInputSettingDisabled() { + setHasLoggingInfo(true); mContext.sendBroadcast(newLoggingBroadcast( LoggingEvents.VoiceIme.VOICE_INPUT_SETTING_DISABLED)); } + + private void setHasLoggingInfo(boolean hasLoggingInfo) { + mHasLoggingInfo = hasLoggingInfo; + // If applications that call UserHappinessSignals.userAcceptedImeText + // make that call after VoiceInputLogger.flush() calls this method with false, we + // will lose those happiness signals. For example, consider the gmail sequence: + // 1. compose message + // 2. speak message into message field + // 3. type subject into subject field + // 4. press send + // We will NOT get the signal that the user accepted the voice inputted message text + // because when the user tapped on the subject field, the ime's flush will be triggered + // and the hasLoggingInfo will be then set to false. So by the time the user hits send + // we have essentially forgotten about any voice input. + // However the following (more common) use case is properly logged + // 1. compose message + // 2. type subject in subject field + // 3. speak message in message field + // 4. press send + UserHappinessSignals.setHasVoiceLoggingInfo(hasLoggingInfo); + } + + private boolean hasLoggingInfo(){ + return mHasLoggingInfo; + } + } -- cgit v1.2.3-83-g751a From 50a61083d3231e2f56b640c06686381de73aedc6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 11 Oct 2010 22:39:04 +0900 Subject: Add text variation keyboard layout Change-Id: I4c6df8197b734feb998da78478a4d9a41f6d92b2 --- java/res/xml-xlarge/kbd_qwerty.xml | 574 ++++++++++++++++++++- java/res/xml-xlarge/popup_smileys.xml | 89 ++++ .../android/inputmethod/latin/LatinKeyboard.java | 20 +- 3 files changed, 666 insertions(+), 17 deletions(-) create mode 100644 java/res/xml-xlarge/popup_smileys.xml (limited to 'java/src') diff --git a/java/res/xml-xlarge/kbd_qwerty.xml b/java/res/xml-xlarge/kbd_qwerty.xml index 984d61f10..740e7f5f2 100644 --- a/java/res/xml-xlarge/kbd_qwerty.xml +++ b/java/res/xml-xlarge/kbd_qwerty.xml @@ -97,7 +97,10 @@ latin:isRepeatable="true" latin:keyEdgeFlags="right" /> - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 3fc484d09..11e7ef936 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -164,7 +164,7 @@ public class LatinKeyboard extends BaseKeyboard { mEnterKey.popupCharacters = null; mEnterKey.popupResId = 0; mEnterKey.text = null; - switch (options&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { + switch (options & (EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { case EditorInfo.IME_ACTION_GO: mEnterKey.iconPreview = null; mEnterKey.icon = null; @@ -193,19 +193,11 @@ public class LatinKeyboard extends BaseKeyboard { mEnterKey.label = res.getText(R.string.label_send_key); break; default: - if (mode == KeyboardSwitcher.MODE_IM) { - mEnterKey.icon = null; - mEnterKey.iconPreview = null; - mEnterKey.label = ":-)"; - mEnterKey.text = ":-) "; - mEnterKey.popupResId = R.xml.popup_smileys; - } else { - mEnterKey.iconPreview = res.getDrawable( - R.drawable.sym_keyboard_feedback_return); - mEnterKey.icon = res.getDrawable(mIsBlackSym ? - R.drawable.sym_bkeyboard_return : R.drawable.sym_keyboard_return); - mEnterKey.label = null; - } + mEnterKey.iconPreview = res.getDrawable( + R.drawable.sym_keyboard_feedback_return); + mEnterKey.icon = res.getDrawable(mIsBlackSym ? + R.drawable.sym_bkeyboard_return : R.drawable.sym_keyboard_return); + mEnterKey.label = null; break; } // Set the initial size of the preview icon -- cgit v1.2.3-83-g751a From adf24e2eb49acd32d2655a3964f68da1e54c05ec Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 12 Oct 2010 20:24:53 +0900 Subject: Follow up change of If9472a2a This change is follow up of If9472a2acb029e56790dc4d19ab62e608c970175 Change-Id: I0a474a130f49e2acccbb5a164bdf2984a5bd9042 --- java/src/com/android/inputmethod/latin/PointerTracker.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index 3b886200e..d1cdbfe26 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -21,7 +21,6 @@ import com.android.inputmethod.latin.LatinKeyboardBaseView.OnKeyboardActionListe import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler; import android.content.res.Resources; -import android.inputmethodservice.Keyboard; import android.util.Log; import android.view.MotionEvent; @@ -286,7 +285,7 @@ public class PointerTracker { mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart, keyIndex, this); mIsRepeatableKey = true; } - mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); + startLongPressTimer(keyIndex); } showKeyPreviewAndUpdateKey(keyIndex); } @@ -302,11 +301,11 @@ public class PointerTracker { if (key != null) { if (keyState.getKeyIndex() == NOT_A_KEY) { keyState.onMoveToNewKey(keyIndex, x, y); - mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); + startLongPressTimer(keyIndex); } else if (!isMinorMoveBounce(x, y, keyIndex)) { resetMultiTap(); keyState.onMoveToNewKey(keyIndex, x, y); - mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); + startLongPressTimer(keyIndex); } } else { if (keyState.getKeyIndex() != NOT_A_KEY) { -- cgit v1.2.3-83-g751a From ed3443ebd7af6ecd803c53201687d8c0e5e57d29 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 12 Oct 2010 20:23:08 +0900 Subject: Follow up change of I4c6df819 This change is follow up of I4c6df8197b734feb998da78478a4d9a41f6d92b2 Change-Id: I3b8a82dd71305f34afb2e8b6a705efabdc2bc0cf --- .../android/inputmethod/latin/LatinKeyboard.java | 38 ++++++++-------------- 1 file changed, 14 insertions(+), 24 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 11e7ef936..e10346570 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -158,46 +158,36 @@ public class LatinKeyboard extends BaseKeyboard { return key; } + private static void resetKeyAttributes(Key key, CharSequence label) { + key.popupCharacters = null; + key.popupResId = 0; + key.text = null; + key.iconPreview = null; + key.icon = null; + key.label = label; + } + public void setImeOptions(Resources res, int mode, int options) { if (mEnterKey != null) { - // Reset some of the rarely used attributes. - mEnterKey.popupCharacters = null; - mEnterKey.popupResId = 0; - mEnterKey.text = null; switch (options & (EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { case EditorInfo.IME_ACTION_GO: - mEnterKey.iconPreview = null; - mEnterKey.icon = null; - mEnterKey.label = res.getText(R.string.label_go_key); + resetKeyAttributes(mEnterKey, res.getText(R.string.label_go_key)); break; case EditorInfo.IME_ACTION_NEXT: - mEnterKey.iconPreview = null; - mEnterKey.icon = null; - mEnterKey.label = res.getText(R.string.label_next_key); + resetKeyAttributes(mEnterKey, res.getText(R.string.label_next_key)); break; case EditorInfo.IME_ACTION_DONE: - mEnterKey.iconPreview = null; - mEnterKey.icon = null; - mEnterKey.label = res.getText(R.string.label_done_key); + resetKeyAttributes(mEnterKey, res.getText(R.string.label_done_key)); break; case EditorInfo.IME_ACTION_SEARCH: + resetKeyAttributes(mEnterKey, null); mEnterKey.iconPreview = res.getDrawable( R.drawable.sym_keyboard_feedback_search); mEnterKey.icon = res.getDrawable(mIsBlackSym ? R.drawable.sym_bkeyboard_search : R.drawable.sym_keyboard_search); - mEnterKey.label = null; break; case EditorInfo.IME_ACTION_SEND: - mEnterKey.iconPreview = null; - mEnterKey.icon = null; - mEnterKey.label = res.getText(R.string.label_send_key); - break; - default: - mEnterKey.iconPreview = res.getDrawable( - R.drawable.sym_keyboard_feedback_return); - mEnterKey.icon = res.getDrawable(mIsBlackSym ? - R.drawable.sym_bkeyboard_return : R.drawable.sym_keyboard_return); - mEnterKey.label = null; + resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key)); break; } // Set the initial size of the preview icon -- cgit v1.2.3-83-g751a From 3d20d999025bbaab96b41d172225a39f7a1017b7 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 12 Oct 2010 15:02:44 +0900 Subject: Specify keyboard metrics with physical unit "inch" (DO NOT MERGE) This change also introduces the key background drawables which has no fixed bottom padding. Instead of relying on bottom padding in drawable, this change also specifies Keyboard.verticalGap with physical unit. Other keyboard related length, distance and size are also specified by physical unit. Bug: 3066107 Change-Id: I44f3b2eef8086d6e0b0db53d38f08487549060c6 --- .../btn_keyboard_key_dark_normal.9.png | Bin 521 -> 511 bytes .../btn_keyboard_key_dark_normal_off.9.png | Bin 783 -> 760 bytes .../btn_keyboard_key_dark_normal_on.9.png | Bin 1112 -> 1088 bytes .../btn_keyboard_key_dark_pressed.9.png | Bin 747 -> 730 bytes .../btn_keyboard_key_dark_pressed_off.9.png | Bin 962 -> 940 bytes .../btn_keyboard_key_dark_pressed_on.9.png | Bin 1282 -> 1260 bytes .../btn_keyboard_key_light_normal.9.png | Bin 481 -> 461 bytes .../btn_keyboard_key_light_pressed.9.png | Bin 1643 -> 811 bytes .../btn_keyboard_key_dark_normal.9.png | Bin 385 -> 377 bytes .../btn_keyboard_key_dark_normal_off.9.png | Bin 550 -> 545 bytes .../btn_keyboard_key_dark_normal_on.9.png | Bin 813 -> 806 bytes .../btn_keyboard_key_dark_pressed.9.png | Bin 518 -> 514 bytes .../btn_keyboard_key_dark_pressed_off.9.png | Bin 700 -> 687 bytes .../btn_keyboard_key_dark_pressed_on.9.png | Bin 950 -> 940 bytes .../btn_keyboard_key_light_normal.9.png | Bin 358 -> 355 bytes .../btn_keyboard_key_light_pressed.9.png | Bin 530 -> 526 bytes java/res/layout/input_gingerbread.xml | 1 + java/res/values-land/dimens.xml | 14 ++-- java/res/values/dimens.xml | 26 +++--- java/res/xml-da/kbd_qwerty.xml | 6 +- java/res/xml-da/kbd_qwerty_black.xml | 6 +- java/res/xml-de/kbd_qwerty.xml | 6 +- java/res/xml-de/kbd_qwerty_black.xml | 6 +- java/res/xml-fr/kbd_qwerty.xml | 6 +- java/res/xml-fr/kbd_qwerty_black.xml | 6 +- java/res/xml-iw/kbd_qwerty.xml | 6 +- java/res/xml-iw/kbd_qwerty_black.xml | 6 +- java/res/xml-nb/kbd_qwerty.xml | 6 +- java/res/xml-nb/kbd_qwerty_black.xml | 6 +- java/res/xml-ru/kbd_qwerty.xml | 6 +- java/res/xml-ru/kbd_qwerty_black.xml | 6 +- java/res/xml-sr/kbd_qwerty.xml | 6 +- java/res/xml-sr/kbd_qwerty_black.xml | 6 +- java/res/xml-sv/kbd_qwerty.xml | 6 +- java/res/xml-sv/kbd_qwerty_black.xml | 6 +- java/res/xml/kbd_phone.xml | 2 +- java/res/xml/kbd_phone_black.xml | 2 +- java/res/xml/kbd_phone_symbols.xml | 2 +- java/res/xml/kbd_phone_symbols_black.xml | 2 +- java/res/xml/kbd_popup_narrow_template.xml | 2 +- java/res/xml/kbd_popup_template.xml | 2 +- java/res/xml/kbd_qwerty.xml | 6 +- java/res/xml/kbd_qwerty_black.xml | 6 +- java/res/xml/kbd_symbols.xml | 2 +- java/res/xml/kbd_symbols_black.xml | 2 +- java/res/xml/kbd_symbols_shift.xml | 2 +- java/res/xml/kbd_symbols_shift_black.xml | 2 +- java/res/xml/popup_comma.xml | 2 +- java/res/xml/popup_domains.xml | 2 +- java/res/xml/popup_mic.xml | 2 +- java/res/xml/popup_punctuation.xml | 2 +- java/res/xml/popup_smileys.xml | 2 +- .../android/inputmethod/latin/LatinKeyboard.java | 32 +++++--- .../inputmethod/latin/LatinKeyboardBaseView.java | 89 ++++++++++++++------- 54 files changed, 196 insertions(+), 104 deletions(-) (limited to 'java/src') diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png index 0c4820b34..01fc8ca78 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png index 5a20da1db..af4017e2c 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png index 4ec703d6c..4c35aca95 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png index 93322d2e2..174f3452c 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png index 5a9c722ce..1fcbd9a88 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png index 99b6cb170..072753f37 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png index 7dc59bf82..1ad746053 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png index c150341e3..ccd59d5fa 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png index 53fe9c97d..4e337fa08 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png index 649ef9773..fe18497d8 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png index 93f7d87c2..00aab3d5a 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png index 8560b3ba7..ac0bfd3c1 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png index 778abaf24..ea2f35789 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png index 2a23945e5..6195ac0d4 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png index 6af2d8d0c..50cd06ae3 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png index fdaf69966..7ce52f0f5 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png differ diff --git a/java/res/layout/input_gingerbread.xml b/java/res/layout/input_gingerbread.xml index 8f59cae21..73cf0a3fa 100644 --- a/java/res/layout/input_gingerbread.xml +++ b/java/res/layout/input_gingerbread.xml @@ -25,6 +25,7 @@ android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingBottom="@dimen/keyboard_bottom_padding" android:background="@drawable/keyboard_dark_background" android:textStyle="bold" diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 1396bff9b..043f4b363 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -19,13 +19,17 @@ --> - 47dip + + 0.250in + 0.020in + 0.270in + 0.0in 38dip 63dip 2dip - - 79.9dip - - -47dip + + 0.459in + + -0.270in diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 1378be72c..c00c56a89 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -19,7 +19,11 @@ --> - 54dip + + 0.290in + 0.035in + 0.325in + 0.06in 22dip 42dip 63dip @@ -27,18 +31,20 @@ 2.5in - 22sp - 14sp - 0dip - 80dip + 0.13in + 0.083in + 0.236in + 0.000in + + 0.464in - - 91.8dip - - -54dip + + 0.553in + + -0.325in 0.05in - -0.06in + -0.05in 0.3in diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 084795463..6e2e69208 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -28,10 +28,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="9.09%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_popup_template.xml index aca46930f..a287be1fd 100644 --- a/java/res/xml/kbd_popup_template.xml +++ b/java/res/xml/kbd_popup_template.xml @@ -22,6 +22,6 @@ android:keyWidth="10%p" android:horizontalGap="0px" android:verticalGap="0px" - android:keyHeight="@dimen/key_height" + android:keyHeight="@dimen/popup_key_height" > diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index c6113abf7..a2c9b2b8e 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" - android:verticalGap="0px" + android:verticalGap="@dimen/key_bottom_gap" android:keyHeight="@dimen/key_height" > - + - + mTextHeightCache = new HashMap(); + // Distance from horizontal center of the key, proportional to key label text height. + private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR = 0.55f; + private final String KEY_LABEL_HEIGHT_REFERENCE_CHAR = "H"; private final UIHandler mHandler = new UIHandler(); @@ -465,7 +474,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mPreviewPopup = new PopupWindow(context); if (previewLayout != 0) { mPreviewText = (TextView) inflate.inflate(previewLayout, null); - mPreviewTextSizeLarge = (int) mPreviewText.getTextSize(); + mPreviewTextSizeLarge = (int) res.getDimension(R.dimen.key_preview_text_size_large); mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); } else { @@ -576,6 +585,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx LatinImeLogger.onSetKeyboard(keyboard); mKeys = mKeyDetector.setKeyboard(keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection); + mKeyboardVerticalGap = (int)getResources().getDimension(R.dimen.key_bottom_gap); for (PointerTracker tracker : mPointerTrackers) { tracker.setKeyboard(mKeys, mKeyHysteresisDistance); } @@ -720,7 +730,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx int dimensionSum = 0; for (int i = 0; i < length; i++) { Key key = keys[i]; - dimensionSum += Math.min(key.width, key.height) + key.gap; + dimensionSum += Math.min(key.width, key.height + mKeyboardVerticalGap) + key.gap; } if (dimensionSum < 0 || length == 0) return; mKeyDetector.setProximityThreshold((int) (dimensionSum * 1.4f / length)); @@ -772,13 +782,14 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx paint.setColor(mKeyTextColor); boolean drawSingleKey = false; if (invalidKey != null && canvas.getClipBounds(clipRegion)) { - // Is clipRegion completely contained within the invalidated key? - if (invalidKey.x + kbdPaddingLeft - 1 <= clipRegion.left && - invalidKey.y + kbdPaddingTop - 1 <= clipRegion.top && - invalidKey.x + invalidKey.width + kbdPaddingLeft + 1 >= clipRegion.right && - invalidKey.y + invalidKey.height + kbdPaddingTop + 1 >= clipRegion.bottom) { - drawSingleKey = true; - } + // TODO we should use Rect.inset and Rect.contains here. + // Is clipRegion completely contained within the invalidated key? + if (invalidKey.x + kbdPaddingLeft - 1 <= clipRegion.left && + invalidKey.y + kbdPaddingTop - 1 <= clipRegion.top && + invalidKey.x + invalidKey.width + kbdPaddingLeft + 1 >= clipRegion.right && + invalidKey.y + invalidKey.height + kbdPaddingTop + 1 >= clipRegion.bottom) { + drawSingleKey = true; + } } canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); final int keyCount = keys.length; @@ -794,8 +805,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx String label = key.label == null? null : adjustCase(key.label).toString(); final Rect bounds = keyBackground.getBounds(); - if (key.width != bounds.right || - key.height != bounds.bottom) { + if (key.width != bounds.right || key.height != bounds.bottom) { keyBackground.setBounds(0, 0, key.width, key.height); } canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop); @@ -804,22 +814,34 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx boolean shouldDrawIcon = true; if (label != null) { // For characters, use large font. For labels like "Done", use small font. + final int labelSize; if (label.length() > 1 && key.codes.length < 2) { - paint.setTextSize(mLabelTextSize); + labelSize = mLabelTextSize; paint.setTypeface(Typeface.DEFAULT_BOLD); } else { - paint.setTextSize(mKeyTextSize); + labelSize = mKeyTextSize; paint.setTypeface(mKeyTextStyle); } + paint.setTextSize(labelSize); + + Integer labelHeightValue = mTextHeightCache.get(labelSize); + final int labelHeight; + if (labelHeightValue != null) { + labelHeight = labelHeightValue; + } else { + Rect textBounds = new Rect(); + paint.getTextBounds(KEY_LABEL_HEIGHT_REFERENCE_CHAR, 0, 1, textBounds); + labelHeight = textBounds.height(); + mTextHeightCache.put(labelSize, labelHeight); + } + // Draw a drop shadow for the text paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor); - // Draw the text - canvas.drawText(label, - (key.width - padding.left - padding.right) / 2 - + padding.left, - (key.height - padding.top - padding.bottom) / 2 - + (paint.getTextSize() - paint.descent()) / 2 + padding.top, - paint); + final int centerX = (key.width + padding.left - padding.right) / 2; + final int centerY = (key.height + padding.top - padding.bottom) / 2; + final float baseline = centerY + + labelHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR; + canvas.drawText(label, centerX, baseline, paint); // Turn off drop shadow paint.setShadowLayer(0, 0, 0, 0); @@ -829,15 +851,23 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } if (key.icon != null && shouldDrawIcon) { // Special handing for the upper-right number hint icons - final int drawableWidth = isNumberAtEdgeOfPopupChars(key) ? - key.width : key.icon.getIntrinsicWidth(); - final int drawableHeight = isNumberAtEdgeOfPopupChars(key) ? - key.height : key.icon.getIntrinsicHeight(); - - final int drawableX = (key.width - padding.left - padding.right - - drawableWidth) / 2 + padding.left; - final int drawableY = (key.height - padding.top - padding.bottom - - drawableHeight) / 2 + padding.top; + final int drawableWidth; + final int drawableHeight; + final int drawableX; + final int drawableY; + if (isNumberAtEdgeOfPopupChars(key)) { + drawableWidth = key.width; + drawableHeight = key.height; + drawableX = 0; + drawableY = NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL; + } else { + drawableWidth = key.icon.getIntrinsicWidth(); + drawableHeight = key.icon.getIntrinsicHeight(); + drawableX = (key.width - padding.left - padding.right - drawableWidth) + / 2 + padding.left; + drawableY = (key.height - padding.top - padding.bottom - drawableHeight) + / 2 + padding.top; + } canvas.translate(drawableX, drawableY); key.icon.setBounds(0, 0, drawableWidth, drawableHeight); key.icon.draw(canvas); @@ -1003,6 +1033,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (key == null) return; mInvalidatedKey = key; + // TODO we should clean up this and record key's region to use in onBufferDraw. mDirtyRect.union(key.x + getPaddingLeft(), key.y + getPaddingTop(), key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop()); onBufferDraw(); -- cgit v1.2.3-83-g751a From 179fa2c03e749df736f43e0838200bec52b4808a Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Tue, 12 Oct 2010 16:16:38 +0900 Subject: DO NOT MERGE. Add visual indicator that long press , or mic key will bring up Settings bug:3084022 Change-Id: I8b38e2803eb32469653484701882af35108eb69a --- java/res/drawable-hdpi/hint_settings.9.png | Bin 0 -> 236 bytes java/res/drawable-mdpi/hint_settings.9.png | Bin 0 -> 222 bytes .../android/inputmethod/latin/LatinKeyboard.java | 34 +++++++++++++++++++-- .../inputmethod/latin/LatinKeyboardBaseView.java | 12 ++++++-- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 java/res/drawable-hdpi/hint_settings.9.png create mode 100644 java/res/drawable-mdpi/hint_settings.9.png (limited to 'java/src') diff --git a/java/res/drawable-hdpi/hint_settings.9.png b/java/res/drawable-hdpi/hint_settings.9.png new file mode 100644 index 000000000..85c183a61 Binary files /dev/null and b/java/res/drawable-hdpi/hint_settings.9.png differ diff --git a/java/res/drawable-mdpi/hint_settings.9.png b/java/res/drawable-mdpi/hint_settings.9.png new file mode 100644 index 000000000..5077f3e6a Binary files /dev/null and b/java/res/drawable-mdpi/hint_settings.9.png differ diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index f0d5ef60a..cf702f391 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -61,6 +61,7 @@ public class LatinKeyboard extends Keyboard { private Key mShiftKey; private Key mEnterKey; private Key mF1Key; + private Drawable mF1HintIcon; private Key mSpaceKey; private Key m123Key; private final int NUMBER_HINT_COUNT = 10; @@ -135,6 +136,7 @@ public class LatinKeyboard extends Keyboard { mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right); m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic); m123MicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic); + mF1HintIcon = res.getDrawable(R.drawable.hint_settings); setDefaultBounds(m123MicPreviewIcon); sSpacebarVerticalCorrection = res.getDimensionPixelOffset( R.dimen.spacebar_vertical_correction); @@ -368,13 +370,18 @@ public class LatinKeyboard extends Keyboard { if (mHasVoiceButton && mVoiceEnabled) { mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; mF1Key.label = null; - mF1Key.icon = mMicIcon; + // HACK: draw mMicIcon and mF1HintIcon at the same time + mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( + mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon)); mF1Key.iconPreview = mMicPreviewIcon; mF1Key.popupResId = R.xml.popup_mic; } else { mF1Key.label = ","; mF1Key.codes = new int[] { ',' }; - mF1Key.icon = null; + // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to the + // above synthesized icon + mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( + mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon)); mF1Key.iconPreview = null; mF1Key.popupResId = R.xml.popup_comma; } @@ -424,6 +431,29 @@ public class LatinKeyboard extends Keyboard { return bounds.width(); } + // Overlay two images. Note that mainIcon can be null. + private Bitmap drawSynthesizedSettingsHintImage( + int width, int height, Drawable mainIcon, Drawable hintIcon) { + if (hintIcon == null) + return null; + final Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + final Canvas canvas = new Canvas(buffer); + canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR); + // draw main icon at centered position + if (mainIcon != null) { + setDefaultBounds(mainIcon); + final int drawableX = (width - mainIcon.getIntrinsicWidth()) / 2; + final int drawableY = (height - mainIcon.getIntrinsicHeight()) / 2; + canvas.translate(drawableX, drawableY); + mainIcon.draw(canvas); + canvas.translate(-drawableX, -drawableY); + } + // draw hint icon fully in the key + hintIcon.setBounds(0, 0, width, height); + hintIcon.draw(canvas); + return buffer; + } + // Layout local language name and left and right arrow on space bar. private static String layoutSpaceBar(Paint paint, Locale locale, Drawable lArrow, Drawable rArrow, int width, int height, float origTextSize, diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 9ff7b9aef..b3f1364d8 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -847,7 +847,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Usually don't draw icon if label is not null, but we draw icon for the number // hint. - shouldDrawIcon = isNumberAtEdgeOfPopupChars(key); + shouldDrawIcon = isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key); } if (key.icon != null && shouldDrawIcon) { // Special handing for the upper-right number hint icons @@ -940,7 +940,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (key == null) return; // Should not draw number hint icons - if (key.icon != null && !isNumberAtEdgeOfPopupChars(key)) { + if (key.icon != null && !isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key)) { mPreviewText.setCompoundDrawables(null, null, null, key.iconPreview != null ? key.iconPreview : key.icon); mPreviewText.setText(null); @@ -1221,6 +1221,14 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; } + private static boolean isCommaKeyLabelOrNumberAtEdgeOfPopupChars(Key key) { + return isNumberAtEdgeOfPopupChars(key) || isCommaKeyLabel(key); + } + + private static boolean isCommaKeyLabel(Key key) { + return ",".equals(key.label); + } + private static boolean isNumberAtEdgeOfPopupChars(Key key) { return isNumberAtLeftmostPopupChar(key) || isNumberAtRightmostPopupChar(key); } -- cgit v1.2.3-83-g751a From 0661496ee0988391f9214616ef091625bcc7f8cb Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 15 Oct 2010 01:23:20 +0900 Subject: Follow up change of I8b38e280 (DO NOT MERGE) This is follow up change of I8b38e2803eb32469653484701882af35108eb69a This change fixes the following when "Voice input on symbols keyboard" option is selected. - LatinIME.onCreateInputView fails to show "123mic" icon. - Email and URL variation keyboard fails to show "123mic" icon. Bug: 3084022 Change-Id: Ia3929bb0cc5c5c8651af816718c21d1f20e8f016 --- .../inputmethod/latin/KeyboardSwitcher.java | 3 +- .../com/android/inputmethod/latin/LatinIME.java | 4 +- .../android/inputmethod/latin/LatinKeyboard.java | 45 ++++++++++++---------- 3 files changed, 28 insertions(+), 24 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 86dbf1f60..a7b695eb3 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -260,7 +260,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha mMode = mode; mImeOptions = imeOptions; if (enableVoice != mHasVoice) { - setVoiceMode(mHasVoice, mVoiceOnPrimary); + // TODO clean up this unnecessary recursive call. + setVoiceMode(enableVoice, mVoiceOnPrimary); } mIsSymbols = isSymbols; diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 4e0f7c56b..b6fee1170 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2329,8 +2329,8 @@ public class LatinIME extends InputMethodService private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) { return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext) - && !(attribute != null && attribute.privateImeOptions != null - && attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE)) + && !(attribute != null + && IME_OPTION_NO_MICROPHONE.equals(attribute.privateImeOptions)) && SpeechRecognizer.isRecognitionAvailable(this); } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index cf702f391..e33ae145b 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -336,7 +336,7 @@ public class LatinKeyboard extends Keyboard { mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic); m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic); } - updateF1Key(); + updateDynamicKeys(); if (mSpaceKey != null) { updateSpaceBarForLocale(isAutoCompletion, isBlack); } @@ -350,11 +350,11 @@ public class LatinKeyboard extends Keyboard { public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) { mHasVoiceButton = hasVoiceButton; mVoiceEnabled = hasVoice; - updateF1Key(); + updateDynamicKeys(); } - private void updateF1Key() { - if (mF1Key == null) return; + private void updateDynamicKeys() { + // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode. if (m123Key != null && mIsAlphaKeyboard) { if (mVoiceEnabled && !mHasVoiceButton) { m123Key.icon = m123MicIcon; @@ -367,23 +367,26 @@ public class LatinKeyboard extends Keyboard { } } - if (mHasVoiceButton && mVoiceEnabled) { - mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; - mF1Key.label = null; - // HACK: draw mMicIcon and mF1HintIcon at the same time - mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( - mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon)); - mF1Key.iconPreview = mMicPreviewIcon; - mF1Key.popupResId = R.xml.popup_mic; - } else { - mF1Key.label = ","; - mF1Key.codes = new int[] { ',' }; - // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to the - // above synthesized icon - mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( - mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon)); - mF1Key.iconPreview = null; - mF1Key.popupResId = R.xml.popup_comma; + // Update KEYCODE_F1 key. Please note that some keyboard layout has no F1 key. + if (mF1Key != null) { + if (mHasVoiceButton && mVoiceEnabled) { + mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; + mF1Key.label = null; + // HACK: draw mMicIcon and mF1HintIcon at the same time + mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( + mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon)); + mF1Key.iconPreview = mMicPreviewIcon; + mF1Key.popupResId = R.xml.popup_mic; + } else { + mF1Key.label = ","; + mF1Key.codes = new int[] { ',' }; + // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to + // the above synthesized icon + mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( + mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon)); + mF1Key.iconPreview = null; + mF1Key.popupResId = R.xml.popup_comma; + } } } -- cgit v1.2.3-83-g751a From 8a26e85387d7fb964b76af502a6e89574d85d58d Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 15 Oct 2010 17:56:05 +0900 Subject: Fix an issue of adding extra character. LatinKeyboardBaseView should have removed "long pressed" pointer tracker from the multi-touch pointer queue. bug: 3099130 Change-Id: I3d358a373b0de07558a204e9ff5a95e9ece38bcc --- java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index b3f1364d8..c1b1008b0 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -214,7 +214,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private OnKeyboardActionListener mKeyboardActionListener; private final ArrayList mPointerTrackers = new ArrayList(); + + // TODO: Let the PointerTracker class manage this pointer queue private final PointerQueue mPointerQueue = new PointerQueue(); + private final boolean mHasDistinctMultitouch; private int mOldPointerCount = 1; @@ -1053,8 +1056,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx boolean result = onLongPress(popupKey); if (result) { dismissKeyPreview(); - tracker.setAlreadyProcessed(); mMiniKeyboardTrackerId = tracker.mPointerId; + // Mark this tracker "already processed" and remove it from the pointer queue + tracker.setAlreadyProcessed(); + mPointerQueue.remove(tracker); } return result; } -- cgit v1.2.3-83-g751a From 1cbfc6c968378f2e0a20b41677ec2a96bf69b621 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sat, 16 Oct 2010 02:15:04 +0900 Subject: DO NOT MERGE. Follow up change to I8b38e280 Add visual indicator that long press / or @ on F1 key will bring up Settings bug: 3084022 Change-Id: If925b546829ca8e8806e1f8f89eaf72fc8c220da --- java/res/xml-da/kbd_qwerty.xml | 8 +-- java/res/xml-da/kbd_qwerty_black.xml | 8 +-- java/res/xml-de/kbd_qwerty.xml | 8 +-- java/res/xml-fr/kbd_qwerty.xml | 8 +-- java/res/xml-fr/kbd_qwerty_black.xml | 8 +-- java/res/xml-iw/kbd_qwerty.xml | 8 +-- java/res/xml-iw/kbd_qwerty_black.xml | 8 +-- java/res/xml-nb/kbd_qwerty.xml | 8 +-- java/res/xml-nb/kbd_qwerty_black.xml | 8 +-- java/res/xml-ru/kbd_qwerty.xml | 8 +-- java/res/xml-ru/kbd_qwerty_black.xml | 8 +-- java/res/xml-sr/kbd_qwerty.xml | 8 +-- java/res/xml-sr/kbd_qwerty_black.xml | 8 +-- java/res/xml-sv/kbd_qwerty.xml | 8 +-- java/res/xml-sv/kbd_qwerty_black.xml | 8 +-- java/res/xml/kbd_qwerty.xml | 8 +-- java/res/xml/kbd_qwerty_black.xml | 8 +-- java/res/xml/popup_at.xml | 39 +++++++++++ java/res/xml/popup_slash.xml | 39 +++++++++++ .../android/inputmethod/latin/LatinKeyboard.java | 79 +++++++++++++++++----- .../inputmethod/latin/LatinKeyboardBaseView.java | 13 ++-- 21 files changed, 214 insertions(+), 92 deletions(-) create mode 100644 java/res/xml/popup_at.xml create mode 100644 java/res/xml/popup_slash.xml (limited to 'java/src') diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 6e2e69208..70eab096d 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -209,7 +209,7 @@ android:isModifier="true" android:keyEdgeFlags="left" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + android:codes="@integer/key_f1" /> + + + + + + + + diff --git a/java/res/xml/popup_slash.xml b/java/res/xml/popup_slash.xml new file mode 100644 index 000000000..a38fde0e4 --- /dev/null +++ b/java/res/xml/popup_slash.xml @@ -0,0 +1,39 @@ + + + + + + + + + diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index e33ae145b..8060ac996 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -74,6 +74,7 @@ public class LatinKeyboard extends Keyboard { private LanguageSwitcher mLanguageSwitcher; private final Resources mRes; private final Context mContext; + private int mMode; // Whether this keyboard has voice icon on it private boolean mHasVoiceButton; // Whether voice icon is enabled at all @@ -122,6 +123,7 @@ public class LatinKeyboard extends Keyboard { super(context, xmlLayoutResId, mode); final Resources res = context.getResources(); mContext = context; + mMode = mode; mRes = res; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); @@ -202,6 +204,7 @@ public class LatinKeyboard extends Keyboard { } void setImeOptions(Resources res, int mode, int options) { + mMode = mode; // TODO should clean up this method if (mEnterKey != null) { // Reset some of the rarely used attributes. @@ -354,6 +357,11 @@ public class LatinKeyboard extends Keyboard { } private void updateDynamicKeys() { + update123Key(); + updateF1Key(); + } + + private void update123Key() { // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode. if (m123Key != null && mIsAlphaKeyboard) { if (mVoiceEnabled && !mHasVoiceButton) { @@ -366,30 +374,65 @@ public class LatinKeyboard extends Keyboard { m123Key.label = m123Label; } } + } + + private void updateF1Key() { + // Update KEYCODE_F1 key. Please note that some keyboard layouts have no F1 key. + if (mF1Key == null) + return; - // Update KEYCODE_F1 key. Please note that some keyboard layout has no F1 key. - if (mF1Key != null) { - if (mHasVoiceButton && mVoiceEnabled) { - mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; - mF1Key.label = null; - // HACK: draw mMicIcon and mF1HintIcon at the same time - mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( - mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon)); - mF1Key.iconPreview = mMicPreviewIcon; - mF1Key.popupResId = R.xml.popup_mic; + if (mIsAlphaKeyboard) { + if (mMode == KeyboardSwitcher.MODE_URL) { + setNonMicF1Key(mF1Key, "/", R.xml.popup_slash); + } else if (mMode == KeyboardSwitcher.MODE_EMAIL) { + setNonMicF1Key(mF1Key, "@", R.xml.popup_at); + } else { + if (mVoiceEnabled && mHasVoiceButton) { + setMicF1Key(mF1Key); + } else { + setNonMicF1Key(mF1Key, ",", R.xml.popup_comma); + } + } + } else { // Symbols keyboard + if (mVoiceEnabled && mHasVoiceButton) { + setMicF1Key(mF1Key); } else { - mF1Key.label = ","; - mF1Key.codes = new int[] { ',' }; - // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to - // the above synthesized icon - mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage( - mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon)); - mF1Key.iconPreview = null; - mF1Key.popupResId = R.xml.popup_comma; + setNonMicF1Key(mF1Key, ",", R.xml.popup_comma); } } } + private void setMicF1Key(Key key) { + // HACK: draw mMicIcon and mF1HintIcon at the same time + final Drawable micWithSettingsHintDrawable = new BitmapDrawable(mRes, + drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap, + mMicIcon, mF1HintIcon)); + + key.label = null; + key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; + key.popupResId = R.xml.popup_mic; + key.icon = micWithSettingsHintDrawable; + key.iconPreview = mMicPreviewIcon; + } + + private void setNonMicF1Key(Key key, String label, int popupResId) { + // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to + // the mic+hint synthesized icon + final Drawable onlySettingsHintDrawable = new BitmapDrawable(mRes, + drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap, + null, mF1HintIcon)); + + key.label = label; + key.codes = new int[] { label.charAt(0) }; + key.popupResId = popupResId; + key.icon = onlySettingsHintDrawable; + key.iconPreview = null; + } + + public boolean isF1Key(Key key) { + return key == mF1Key; + } + /** * @return a key which should be invalidated. */ diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index c1b1008b0..832c76880 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -850,7 +850,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Usually don't draw icon if label is not null, but we draw icon for the number // hint. - shouldDrawIcon = isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key); + shouldDrawIcon = isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(key); } if (key.icon != null && shouldDrawIcon) { // Special handing for the upper-right number hint icons @@ -943,7 +943,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (key == null) return; // Should not draw number hint icons - if (key.icon != null && !isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key)) { + if (key.icon != null && !isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(key)) { mPreviewText.setCompoundDrawables(null, null, null, key.iconPreview != null ? key.iconPreview : key.icon); mPreviewText.setText(null); @@ -1226,12 +1226,13 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; } - private static boolean isCommaKeyLabelOrNumberAtEdgeOfPopupChars(Key key) { - return isNumberAtEdgeOfPopupChars(key) || isCommaKeyLabel(key); + private boolean isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(Key key) { + return isNumberAtEdgeOfPopupChars(key) || isNonMicLatinF1Key(key); } - private static boolean isCommaKeyLabel(Key key) { - return ",".equals(key.label); + private boolean isNonMicLatinF1Key(Key key) { + return (mKeyboard instanceof LatinKeyboard) + && ((LatinKeyboard)mKeyboard).isF1Key(key) && key.label != null; } private static boolean isNumberAtEdgeOfPopupChars(Key key) { -- cgit v1.2.3-83-g751a From 86953d170d3a1c189628a373a5987cfc4c17c997 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sun, 17 Oct 2010 05:33:57 +0900 Subject: DO NOT MERGE. Revise the setting hint visual and its handling code. This is a follow up change to I8b38e280. bug: 3084022 Change-Id: I1062763d87b4498e19598b4e7d99bb91c510c6d2 --- java/res/drawable-hdpi/hint_settings.9.png | Bin 236 -> 226 bytes java/res/drawable-mdpi/hint_settings.9.png | Bin 222 -> 202 bytes .../android/inputmethod/latin/LatinKeyboard.java | 42 ++++++++++----------- .../inputmethod/latin/LatinKeyboardBaseView.java | 13 +++++-- 4 files changed, 30 insertions(+), 25 deletions(-) (limited to 'java/src') diff --git a/java/res/drawable-hdpi/hint_settings.9.png b/java/res/drawable-hdpi/hint_settings.9.png index 85c183a61..b5ec003e6 100644 Binary files a/java/res/drawable-hdpi/hint_settings.9.png and b/java/res/drawable-hdpi/hint_settings.9.png differ diff --git a/java/res/drawable-mdpi/hint_settings.9.png b/java/res/drawable-mdpi/hint_settings.9.png index 5077f3e6a..444cc26ee 100644 Binary files a/java/res/drawable-mdpi/hint_settings.9.png and b/java/res/drawable-mdpi/hint_settings.9.png differ diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 8060ac996..d04fc586a 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -61,7 +61,7 @@ public class LatinKeyboard extends Keyboard { private Key mShiftKey; private Key mEnterKey; private Key mF1Key; - private Drawable mF1HintIcon; + private final Drawable mF1HintIcon; private Key mSpaceKey; private Key m123Key; private final int NUMBER_HINT_COUNT = 10; @@ -405,8 +405,7 @@ public class LatinKeyboard extends Keyboard { private void setMicF1Key(Key key) { // HACK: draw mMicIcon and mF1HintIcon at the same time final Drawable micWithSettingsHintDrawable = new BitmapDrawable(mRes, - drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap, - mMicIcon, mF1HintIcon)); + drawSynthesizedSettingsHintImage(key.width, key.height, mMicIcon, mF1HintIcon)); key.label = null; key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; @@ -416,16 +415,10 @@ public class LatinKeyboard extends Keyboard { } private void setNonMicF1Key(Key key, String label, int popupResId) { - // HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to - // the mic+hint synthesized icon - final Drawable onlySettingsHintDrawable = new BitmapDrawable(mRes, - drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap, - null, mF1HintIcon)); - key.label = label; key.codes = new int[] { label.charAt(0) }; key.popupResId = popupResId; - key.icon = onlySettingsHintDrawable; + key.icon = mF1HintIcon; key.iconPreview = null; } @@ -477,24 +470,29 @@ public class LatinKeyboard extends Keyboard { return bounds.width(); } - // Overlay two images. Note that mainIcon can be null. + // Overlay two images: mainIcon and hintIcon. private Bitmap drawSynthesizedSettingsHintImage( int width, int height, Drawable mainIcon, Drawable hintIcon) { - if (hintIcon == null) + if (mainIcon == null || hintIcon == null) return null; + Rect hintIconPadding = new Rect(0, 0, 0, 0); + hintIcon.getPadding(hintIconPadding); final Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(buffer); canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR); - // draw main icon at centered position - if (mainIcon != null) { - setDefaultBounds(mainIcon); - final int drawableX = (width - mainIcon.getIntrinsicWidth()) / 2; - final int drawableY = (height - mainIcon.getIntrinsicHeight()) / 2; - canvas.translate(drawableX, drawableY); - mainIcon.draw(canvas); - canvas.translate(-drawableX, -drawableY); - } - // draw hint icon fully in the key + + // Draw main icon at the center of the key visual + // Assuming the hintIcon shares the same padding with the key's background drawable + final int drawableX = (width + hintIconPadding.left - hintIconPadding.right + - mainIcon.getIntrinsicWidth()) / 2; + final int drawableY = (height + hintIconPadding.top - hintIconPadding.bottom + - mainIcon.getIntrinsicHeight()) / 2; + setDefaultBounds(mainIcon); + canvas.translate(drawableX, drawableY); + mainIcon.draw(canvas); + canvas.translate(-drawableX, -drawableY); + + // Draw hint icon fully in the key hintIcon.setBounds(0, 0, width, height); hintIcon.draw(canvas); return buffer; diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 832c76880..b1b82b64d 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -858,7 +858,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx final int drawableHeight; final int drawableX; final int drawableY; - if (isNumberAtEdgeOfPopupChars(key)) { + if (isLatinF1KeyOrNumberAtEdgeOfPopupChars(key)) { drawableWidth = key.width; drawableHeight = key.height; drawableX = 0; @@ -1226,13 +1226,20 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; } + private boolean isLatinF1KeyOrNumberAtEdgeOfPopupChars(Key key) { + return isNumberAtEdgeOfPopupChars(key) || isLatinF1Key(key); + } + private boolean isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(Key key) { return isNumberAtEdgeOfPopupChars(key) || isNonMicLatinF1Key(key); } + private boolean isLatinF1Key(Key key) { + return (mKeyboard instanceof LatinKeyboard) && ((LatinKeyboard)mKeyboard).isF1Key(key); + } + private boolean isNonMicLatinF1Key(Key key) { - return (mKeyboard instanceof LatinKeyboard) - && ((LatinKeyboard)mKeyboard).isF1Key(key) && key.label != null; + return isLatinF1Key(key) && key.label != null; } private static boolean isNumberAtEdgeOfPopupChars(Key key) { -- cgit v1.2.3-83-g751a From cd7b7d3e8febcfbcab4628d1fc5b87e809ce56cc Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 12 Oct 2010 15:02:44 +0900 Subject: Specify keyboard metrics with physical unit "inch" Cherrypick I44f3b2eef8086d6e0b0db53d38f08487549060c6 from Gingerbread This change also introduces the key background drawables which has no fixed bottom padding. Instead of relying on bottom padding in drawable, this change also specifies Keyboard.verticalGap with physical unit. Other keyboard related length, distance and size are also specified by physical unit. Bug: 3066107 Change-Id: Ib38355ebfc2f8d5b1d26c4e90eba87196fbeddfa --- .../btn_keyboard_key_dark_normal.9.png | Bin 521 -> 511 bytes .../btn_keyboard_key_dark_normal_off.9.png | Bin 783 -> 760 bytes .../btn_keyboard_key_dark_normal_on.9.png | Bin 1112 -> 1088 bytes .../btn_keyboard_key_dark_pressed.9.png | Bin 747 -> 730 bytes .../btn_keyboard_key_dark_pressed_off.9.png | Bin 962 -> 940 bytes .../btn_keyboard_key_dark_pressed_on.9.png | Bin 1282 -> 1260 bytes .../btn_keyboard_key_light_normal.9.png | Bin 481 -> 461 bytes .../btn_keyboard_key_light_pressed.9.png | Bin 1643 -> 811 bytes .../btn_keyboard_key_dark_normal.9.png | Bin 385 -> 377 bytes .../btn_keyboard_key_dark_normal_off.9.png | Bin 550 -> 545 bytes .../btn_keyboard_key_dark_normal_on.9.png | Bin 813 -> 806 bytes .../btn_keyboard_key_dark_pressed.9.png | Bin 518 -> 514 bytes .../btn_keyboard_key_dark_pressed_off.9.png | Bin 700 -> 687 bytes .../btn_keyboard_key_dark_pressed_on.9.png | Bin 950 -> 940 bytes .../btn_keyboard_key_light_normal.9.png | Bin 358 -> 355 bytes .../btn_keyboard_key_light_pressed.9.png | Bin 530 -> 526 bytes java/res/layout/input_gingerbread.xml | 1 + java/res/values-land/dimens.xml | 14 ++-- java/res/values-xlarge/dimens.xml | 28 ++++--- java/res/values/dimens.xml | 37 +++++---- java/res/xml-da/kbd_qwerty.xml | 6 +- java/res/xml-da/kbd_qwerty_black.xml | 6 +- java/res/xml-de/kbd_qwerty.xml | 6 +- java/res/xml-de/kbd_qwerty_black.xml | 6 +- java/res/xml-fr/kbd_qwerty.xml | 6 +- java/res/xml-fr/kbd_qwerty_black.xml | 6 +- java/res/xml-iw/kbd_qwerty.xml | 6 +- java/res/xml-iw/kbd_qwerty_black.xml | 6 +- java/res/xml-nb/kbd_qwerty.xml | 6 +- java/res/xml-nb/kbd_qwerty_black.xml | 6 +- java/res/xml-ru/kbd_qwerty.xml | 6 +- java/res/xml-ru/kbd_qwerty_black.xml | 6 +- java/res/xml-sr/kbd_qwerty.xml | 6 +- java/res/xml-sr/kbd_qwerty_black.xml | 6 +- java/res/xml-sv/kbd_qwerty.xml | 6 +- java/res/xml-sv/kbd_qwerty_black.xml | 6 +- java/res/xml-xlarge/kbd_qwerty.xml | 2 +- java/res/xml-xlarge/popup_smileys.xml | 2 +- java/res/xml/kbd_phone.xml | 2 +- java/res/xml/kbd_phone_black.xml | 2 +- java/res/xml/kbd_phone_symbols.xml | 2 +- java/res/xml/kbd_phone_symbols_black.xml | 2 +- java/res/xml/kbd_popup_narrow_template.xml | 2 +- java/res/xml/kbd_popup_template.xml | 2 +- java/res/xml/kbd_qwerty.xml | 6 +- java/res/xml/kbd_qwerty_black.xml | 6 +- java/res/xml/kbd_symbols.xml | 2 +- java/res/xml/kbd_symbols_black.xml | 2 +- java/res/xml/kbd_symbols_shift.xml | 2 +- java/res/xml/kbd_symbols_shift_black.xml | 2 +- java/res/xml/popup_comma.xml | 2 +- java/res/xml/popup_domains.xml | 2 +- java/res/xml/popup_mic.xml | 2 +- java/res/xml/popup_punctuation.xml | 2 +- java/res/xml/popup_smileys.xml | 2 +- .../android/inputmethod/latin/LatinKeyboard.java | 65 +++++++++------ .../inputmethod/latin/LatinKeyboardBaseView.java | 89 ++++++++++++++------- 57 files changed, 240 insertions(+), 136 deletions(-) (limited to 'java/src') diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png index 0c4820b34..01fc8ca78 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png index 5a20da1db..af4017e2c 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_off.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png index 4ec703d6c..4c35aca95 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_normal_on.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png index 93322d2e2..174f3452c 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png index 5a9c722ce..1fcbd9a88 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_off.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png index 99b6cb170..072753f37 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_dark_pressed_on.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png index 7dc59bf82..1ad746053 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_light_normal.9.png differ diff --git a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png index c150341e3..ccd59d5fa 100644 Binary files a/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png and b/java/res/drawable-hdpi/btn_keyboard_key_light_pressed.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png index 53fe9c97d..4e337fa08 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png index 649ef9773..fe18497d8 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_off.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png index 93f7d87c2..00aab3d5a 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_normal_on.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png index 8560b3ba7..ac0bfd3c1 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png index 778abaf24..ea2f35789 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_off.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png index 2a23945e5..6195ac0d4 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_dark_pressed_on.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png index 6af2d8d0c..50cd06ae3 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_light_normal.9.png differ diff --git a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png index fdaf69966..7ce52f0f5 100644 Binary files a/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png and b/java/res/drawable-mdpi/btn_keyboard_key_light_pressed.9.png differ diff --git a/java/res/layout/input_gingerbread.xml b/java/res/layout/input_gingerbread.xml index 8f59cae21..73cf0a3fa 100644 --- a/java/res/layout/input_gingerbread.xml +++ b/java/res/layout/input_gingerbread.xml @@ -25,6 +25,7 @@ android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingBottom="@dimen/keyboard_bottom_padding" android:background="@drawable/keyboard_dark_background" android:textStyle="bold" diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 1396bff9b..043f4b363 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -19,13 +19,17 @@ --> - 47dip + + 0.250in + 0.020in + 0.270in + 0.0in 38dip 63dip 2dip - - 79.9dip - - -47dip + + 0.459in + + -0.270in diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml index 5674ef628..d2cd6c7d1 100644 --- a/java/res/values-xlarge/dimens.xml +++ b/java/res/values-xlarge/dimens.xml @@ -19,18 +19,26 @@ --> - 72dip - 46dip - 0dip - 28sp - 16sp - 40dip + + 0.450in + 0.0in + 0.450in + 0.10in + + 0.720in - - 122.4dip - - -72dip + + 0.765in + + -0.450in + + 0.175in + 0.100in + 0.245in 0.0in + + 46dip + 0dip diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 1378be72c..2fa47ae52 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -19,26 +19,35 @@ --> - 54dip - 22dip + + 0.290in + 0.035in + 0.325in + 0.06in + + 0.464in + + + 0.553in + + -0.325in + + 0.13in + 0.083in + 0.236in + 0.000in + + -0.05in + 42dip 63dip 4dip 2.5in - 22sp - 14sp - 0dip - 80dip - - - 91.8dip - - -54dip + 22dip + 0.05in - - -0.06in 0.3in diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index c66290c62..66771c287 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -28,10 +28,12 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" latin:keyWidth="9.09%p" latin:horizontalGap="0px" - latin:verticalGap="0px" + latin:verticalGap="@dimen/key_bottom_gap" latin:keyHeight="@dimen/key_height" > - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/java/res/xml-xlarge/popup_smileys.xml b/java/res/xml-xlarge/popup_smileys.xml index cf30a2461..2cfcf741d 100644 --- a/java/res/xml-xlarge/popup_smileys.xml +++ b/java/res/xml-xlarge/popup_smileys.xml @@ -23,7 +23,7 @@ latin:keyWidth="7.5%p" latin:horizontalGap="0px" latin:verticalGap="0px" - latin:keyHeight="@dimen/key_height" + latin:keyHeight="@dimen/popup_key_height" > diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_popup_template.xml index cbb705835..f1aa86f39 100644 --- a/java/res/xml/kbd_popup_template.xml +++ b/java/res/xml/kbd_popup_template.xml @@ -22,6 +22,6 @@ latin:keyWidth="10%p" latin:horizontalGap="0px" latin:verticalGap="0px" - latin:keyHeight="@dimen/key_height" + latin:keyHeight="@dimen/popup_key_height" > diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index c14c7fa0c..21a7ccb78 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -22,10 +22,12 @@ xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" latin:keyWidth="10%p" latin:horizontalGap="0px" - latin:verticalGap="0px" + latin:verticalGap="@dimen/key_bottom_gap" latin:keyHeight="@dimen/key_height" > - + - + mTextHeightCache = new HashMap(); + // Distance from horizontal center of the key, proportional to key label text height. + private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR = 0.55f; + private final String KEY_LABEL_HEIGHT_REFERENCE_CHAR = "H"; private final UIHandler mHandler = new UIHandler(); @@ -468,7 +477,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mPreviewPopup = new PopupWindow(context); if (previewLayout != 0) { mPreviewText = (TextView) inflate.inflate(previewLayout, null); - mPreviewTextSizeLarge = (int) mPreviewText.getTextSize(); + mPreviewTextSizeLarge = (int) res.getDimension(R.dimen.key_preview_text_size_large); mPreviewPopup.setContentView(mPreviewText); mPreviewPopup.setBackgroundDrawable(null); } else { @@ -579,6 +588,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx LatinImeLogger.onSetKeyboard(keyboard); mKeys = mKeyDetector.setKeyboard(keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection); + mKeyboardVerticalGap = (int)getResources().getDimension(R.dimen.key_bottom_gap); for (PointerTracker tracker : mPointerTrackers) { tracker.setKeyboard(keyboard, mKeys, mKeyHysteresisDistance); } @@ -723,7 +733,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx int dimensionSum = 0; for (int i = 0; i < length; i++) { Key key = keys[i]; - dimensionSum += Math.min(key.width, key.height) + key.gap; + dimensionSum += Math.min(key.width, key.height + mKeyboardVerticalGap) + key.gap; } if (dimensionSum < 0 || length == 0) return; mKeyDetector.setProximityThreshold((int) (dimensionSum * 1.4f / length)); @@ -775,13 +785,14 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx paint.setColor(mKeyTextColor); boolean drawSingleKey = false; if (invalidKey != null && canvas.getClipBounds(clipRegion)) { - // Is clipRegion completely contained within the invalidated key? - if (invalidKey.x + kbdPaddingLeft - 1 <= clipRegion.left && - invalidKey.y + kbdPaddingTop - 1 <= clipRegion.top && - invalidKey.x + invalidKey.width + kbdPaddingLeft + 1 >= clipRegion.right && - invalidKey.y + invalidKey.height + kbdPaddingTop + 1 >= clipRegion.bottom) { - drawSingleKey = true; - } + // TODO we should use Rect.inset and Rect.contains here. + // Is clipRegion completely contained within the invalidated key? + if (invalidKey.x + kbdPaddingLeft - 1 <= clipRegion.left && + invalidKey.y + kbdPaddingTop - 1 <= clipRegion.top && + invalidKey.x + invalidKey.width + kbdPaddingLeft + 1 >= clipRegion.right && + invalidKey.y + invalidKey.height + kbdPaddingTop + 1 >= clipRegion.bottom) { + drawSingleKey = true; + } } canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); final int keyCount = keys.length; @@ -797,8 +808,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx String label = key.label == null? null : adjustCase(key.label).toString(); final Rect bounds = keyBackground.getBounds(); - if (key.width != bounds.right || - key.height != bounds.bottom) { + if (key.width != bounds.right || key.height != bounds.bottom) { keyBackground.setBounds(0, 0, key.width, key.height); } canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop); @@ -818,22 +828,34 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } // For characters, use large font. For labels like "Done", use small font. + final int labelSize; if (label.length() > 1 && key.codes.length < 2) { - paint.setTextSize(mLabelTextSize); + labelSize = mLabelTextSize; paint.setTypeface(Typeface.DEFAULT_BOLD); } else { - paint.setTextSize(mKeyTextSize); + labelSize = mKeyTextSize; paint.setTypeface(mKeyTextStyle); } + paint.setTextSize(labelSize); + + Integer labelHeightValue = mTextHeightCache.get(labelSize); + final int labelHeight; + if (labelHeightValue != null) { + labelHeight = labelHeightValue; + } else { + Rect textBounds = new Rect(); + paint.getTextBounds(KEY_LABEL_HEIGHT_REFERENCE_CHAR, 0, 1, textBounds); + labelHeight = textBounds.height(); + mTextHeightCache.put(labelSize, labelHeight); + } + // Draw a drop shadow for the text paint.setShadowLayer(mShadowRadius, 0, 0, mShadowColor); - // Draw the text - canvas.drawText(label, - (key.width - padding.left - padding.right) / 2 - + padding.left, - (key.height - padding.top - padding.bottom) / 2 - + (paint.getTextSize() - paint.descent()) / 2 + padding.top, - paint); + final int centerX = (key.width + padding.left - padding.right) / 2; + final int centerY = (key.height + padding.top - padding.bottom) / 2; + final float baseline = centerY + + labelHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR; + canvas.drawText(label, centerX, baseline, paint); // Turn off drop shadow paint.setShadowLayer(0, 0, 0, 0); } @@ -843,16 +865,22 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (icon == null && key.hintIcon != null && drawHintIcon) icon = key.hintIcon; if (icon != null) { - // Hack for key hint icon displaying at the top right corner of the key. - final int drawableWidth = icon == key.hintIcon - ? key.width : icon.getIntrinsicWidth(); - final int drawableHeight = icon == key.hintIcon - ? key.height : icon.getIntrinsicHeight(); - - final int drawableX = (key.width - padding.left - padding.right - - drawableWidth) / 2 + padding.left; - final int drawableY = (key.height - padding.top - padding.bottom - - drawableHeight) / 2 + padding.top; + // Special handing for the upper-right number hint icons + final int drawableWidth; + final int drawableHeight; + final int drawableX; + final int drawableY; + if (icon == key.hintIcon) { + drawableWidth = key.width; + drawableHeight = key.height; + drawableX = 0; + drawableY = NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL; + } else { + drawableWidth = key.icon.getIntrinsicWidth(); + drawableHeight = key.icon.getIntrinsicHeight(); + drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2; + drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2; + } canvas.translate(drawableX, drawableY); icon.setBounds(0, 0, drawableWidth, drawableHeight); icon.draw(canvas); @@ -1020,6 +1048,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (key == null) return; mInvalidatedKey = key; + // TODO we should clean up this and record key's region to use in onBufferDraw. mDirtyRect.union(key.x + getPaddingLeft(), key.y + getPaddingTop(), key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop()); onBufferDraw(); -- cgit v1.2.3-83-g751a From a2de8f0f835399dfd6c6732235839481a6bfb620 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Sun, 17 Oct 2010 14:19:39 +0900 Subject: Save default enter key attributes and restore these if needed Bug: 3103016 Change-Id: Id8128d5b685ac040afd2c248e1ad17e9aaf1fdf0 --- .../android/inputmethod/latin/LatinKeyboard.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 246df5fc4..31a9acc71 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -83,6 +83,12 @@ public class LatinKeyboard extends BaseKeyboard { private int mPrefLetterY; private int mPrefDistance; + // Default Enter key attributes + private final Drawable mDefaultEnterIcon; + private final Drawable mDefaultEnterPreview; + private final CharSequence mDefaultEnterLabel; + private final CharSequence mDefaultEnterText; + // TODO: generalize for any keyboardId private boolean mIsBlackSym; @@ -139,6 +145,15 @@ public class LatinKeyboard extends BaseKeyboard { mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); // TODO remove this initialization after cleanup mVerticalGap = super.getVerticalGap(); + if (mEnterKey != null) { + mDefaultEnterIcon = mEnterKey.icon; + mDefaultEnterPreview = mEnterKey.iconPreview; + mDefaultEnterLabel = mEnterKey.label; + mDefaultEnterText = mEnterKey.text; + } else { + mDefaultEnterIcon = mDefaultEnterPreview = null; + mDefaultEnterLabel = mDefaultEnterText = null; + } } @Override @@ -195,6 +210,12 @@ public class LatinKeyboard extends BaseKeyboard { case EditorInfo.IME_ACTION_SEND: resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key)); break; + default: + resetKeyAttributes(mEnterKey, mDefaultEnterLabel); + mEnterKey.text = mDefaultEnterText; + mEnterKey.icon = mDefaultEnterIcon; + mEnterKey.iconPreview = mDefaultEnterPreview; + break; } // Set the initial size of the preview icon setDefaultBounds(mEnterKey.iconPreview); -- cgit v1.2.3-83-g751a From 3740a26c21ddbcfffd2ddccee3918810e026a6d4 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Sun, 17 Oct 2010 19:10:46 +0900 Subject: Showing popup preview only when IME is in foreground Bug: 3100922 Change-Id: Icd59fc3978dc1fccb523a368b0a7d4549fc2db78 --- .../com/android/inputmethod/latin/LatinIME.java | 4 +++ .../inputmethod/latin/LatinKeyboardBaseView.java | 34 +++++++++++++++------- 2 files changed, 28 insertions(+), 10 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 687870622..edda9e866 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -680,6 +680,7 @@ public class LatinIME extends InputMethodService // If we just entered a text field, maybe it has some old text that requires correction checkReCorrectionOnStart(); checkTutorial(attribute.privateImeOptions); + inputView.setForeground(true); if (TRACE) Debug.startMethodTracing("/data/trace/latinime"); } @@ -731,6 +732,9 @@ public class LatinIME extends InputMethodService @Override public void onFinishInputView(boolean finishingInput) { super.onFinishInputView(finishingInput); + LatinKeyboardBaseView inputView = mKeyboardSwitcher.getInputView(); + if (inputView != null) + inputView.setForeground(false); // Remove penging messages related to update suggestions mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS); mHandler.removeMessages(MSG_UPDATE_OLD_SUGGESTIONS); diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 660fe0ed0..872b4d245 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -43,6 +43,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup.LayoutParams; +import android.view.WindowManager; import android.widget.PopupWindow; import android.widget.TextView; @@ -184,6 +185,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private int mKeyboardVerticalGap; // Key preview popup + private boolean mInForeground; private TextView mPreviewText; private PopupWindow mPreviewPopup; private int mPreviewTextSizeLarge; @@ -573,7 +575,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx /** * Attaches a keyboard to this view. The keyboard can be switched at any time and the * view will re-layout itself to accommodate the keyboard. - * @see Keyboard + * @see BaseKeyboard * @see #getKeyboard() * @param keyboard the keyboard to display in this view */ @@ -603,7 +605,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx /** * Returns the current keyboard being displayed by this view. * @return the currently attached keyboard - * @see #setKeyboard(Keyboard) + * @see #setKeyboard(BaseKeyboard) */ public BaseKeyboard getKeyboard() { return mKeyboard; @@ -918,6 +920,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mDirtyRect.setEmpty(); } + public void setForeground(boolean foreground) { + mInForeground = foreground; + } + // TODO: clean up this method. private void dismissKeyPreview() { for (PointerTracker tracker : mPointerTrackers) @@ -951,7 +957,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // TODO Must fix popup preview on xlarge layout private void showKey(final int keyIndex, PointerTracker tracker) { Key key = tracker.getKey(keyIndex); - if (key == null) + // If keyIndex is invalid or IME is already closed, we must not show key preview. + // Trying to show preview PopupWindow while root window is closed causes + // WindowManager.BadTokenException. + if (key == null || !mInForeground) return; // Should not draw number hint icons if (key.icon != null && key.label == null) { @@ -1012,13 +1021,18 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx popupPreviewY += popupHeight; } - if (mPreviewPopup.isShowing()) { - mPreviewPopup.update(popupPreviewX, popupPreviewY, popupWidth, popupHeight); - } else { - mPreviewPopup.setWidth(popupWidth); - mPreviewPopup.setHeight(popupHeight); - mPreviewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY, - popupPreviewX, popupPreviewY); + try { + if (mPreviewPopup.isShowing()) { + mPreviewPopup.update(popupPreviewX, popupPreviewY, popupWidth, popupHeight); + } else { + mPreviewPopup.setWidth(popupWidth); + mPreviewPopup.setHeight(popupHeight); + mPreviewPopup.showAtLocation(mMiniKeyboardParent, Gravity.NO_GRAVITY, + popupPreviewX, popupPreviewY); + } + } catch (WindowManager.BadTokenException e) { + // Swallow the exception which will be happened when IME is already closed. + Log.w(TAG, "LatinIME is already closed when tried showing key preview."); } // Record popup preview position to display mini-keyboard later at the same positon mPopupPreviewDisplayedY = popupPreviewY; -- cgit v1.2.3-83-g751a From 2348ca0e769b3f8027f581426d9de1b401c58145 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Sun, 17 Oct 2010 20:46:01 +0900 Subject: Cleanup LatinKeyboard and LatinKeyboard.LatinKey classes Change-Id: I4c5a37315dea1c7545b77a8a6c93b930927a5a82 --- .../android/inputmethod/latin/BaseKeyboard.java | 13 +++++--- .../android/inputmethod/latin/LatinKeyboard.java | 39 ++++++---------------- 2 files changed, 19 insertions(+), 33 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index 0327006c9..bad1544e5 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -150,9 +150,9 @@ public class BaseKeyboard { /** The keyboard mode for this row */ public int mode; - private BaseKeyboard parent; + private final BaseKeyboard parent; - public Row(BaseKeyboard parent) { + private Row(BaseKeyboard parent) { this.parent = parent; } @@ -232,7 +232,7 @@ public class BaseKeyboard { /** Whether this is a modifier key, such as Shift or Alt */ public boolean modifier; /** The BaseKeyboard that this key belongs to */ - private BaseKeyboard keyboard; + protected final BaseKeyboard keyboard; /** * If this key pops up a mini keyboard, this is the resource id for the XML layout for that * keyboard. @@ -361,7 +361,7 @@ public class BaseKeyboard { } } - int[] parseCSV(String value) { + private int[] parseCSV(String value) { int count = 0; int lastIndex = 0; if (value.length() > 0) { @@ -413,8 +413,11 @@ public class BaseKeyboard { * @return the square of the distance of the point from the center of the key */ public int squaredDistanceFrom(int x, int y) { + // We should count vertical gap between rows to calculate the center of this Key. + // TODO: We should re-think how we define the center of the key. + final int verticalGap = keyboard.getVerticalGap(); int xDist = this.x + width / 2 - x; - int yDist = this.y + height / 2 - y; + int yDist = this.y + (height + verticalGap) / 2 - y; return xDist * xDist + yDist * yDist; } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 31a9acc71..3ca85c5d0 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -92,10 +92,6 @@ public class LatinKeyboard extends BaseKeyboard { // TODO: generalize for any keyboardId private boolean mIsBlackSym; - // TODO: remove this attribute when either Keyboard.mDefaultVerticalGap or Key.parent becomes - // non-private. - private final int mVerticalGap; - private static final int SHIFT_OFF = 0; private static final int SHIFT_ON = 1; private static final int SHIFT_LOCKED = 2; @@ -143,8 +139,7 @@ public class LatinKeyboard extends BaseKeyboard { mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty || xmlLayoutResId == R.xml.kbd_qwerty_black; mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); - // TODO remove this initialization after cleanup - mVerticalGap = super.getVerticalGap(); + if (mEnterKey != null) { mDefaultEnterIcon = mEnterKey.icon; mDefaultEnterPreview = mEnterKey.iconPreview; @@ -280,7 +275,7 @@ public class LatinKeyboard extends BaseKeyboard { return mIsAlphaKeyboard && isShifted() && !isShiftLocked(); } - /* package */ boolean isAlphaKeyboard() { + public boolean isAlphaKeyboard() { return mIsAlphaKeyboard; } @@ -521,12 +516,12 @@ public class LatinKeyboard extends BaseKeyboard { return mCurrentlyInSpace; } - void setPreferredLetters(int[] frequencies) { + public void setPreferredLetters(int[] frequencies) { mPrefLetterFrequencies = frequencies; mPrefLetter = 0; } - void keyReleased() { + public void keyReleased() { mCurrentlyInSpace = false; mSpaceDragLastDiff = 0; mPrefLetter = 0; @@ -542,10 +537,9 @@ public class LatinKeyboard extends BaseKeyboard { * Does the magic of locking the touch gesture into the spacebar when * switching input languages. */ - boolean isInside(LatinKey key, int x, int y) { + public boolean isInside(LatinKey key, int x, int y) { final int code = key.codes[0]; - if (code == KEYCODE_SHIFT || - code == KEYCODE_DELETE) { + if (code == KEYCODE_SHIFT || code == KEYCODE_DELETE) { y -= key.height / 10; if (code == KEYCODE_SHIFT) x += key.width / 6; if (code == KEYCODE_DELETE) x -= key.width / 6; @@ -689,8 +683,7 @@ public class LatinKeyboard extends BaseKeyboard { return textSize; } - // TODO LatinKey could be static class - class LatinKey extends BaseKeyboard.Key { + public static class LatinKey extends BaseKeyboard.Key { // functional normal state (with properties) private final int[] KEY_STATE_FUNCTIONAL_NORMAL = { @@ -738,13 +731,12 @@ public class LatinKeyboard extends BaseKeyboard { */ @Override public boolean isInside(int x, int y) { - // TODO This should be done by parent.isInside(this, x, y) - // if Key.parent were protected. - boolean result = LatinKeyboard.this.isInside(this, x, y); + boolean result = (keyboard instanceof LatinKeyboard) + && ((LatinKeyboard)keyboard).isInside(this, x, y); return result; } - boolean isInsideSuper(int x, int y) { + private boolean isInsideSuper(int x, int y) { return super.isInside(x, y); } @@ -759,15 +751,6 @@ public class LatinKeyboard extends BaseKeyboard { } return super.getCurrentDrawableState(); } - - @Override - public int squaredDistanceFrom(int x, int y) { - // We should count vertical gap between rows to calculate the center of this Key. - final int verticalGap = LatinKeyboard.this.mVerticalGap; - final int xDist = this.x + width / 2 - x; - final int yDist = this.y + (height + verticalGap) / 2 - y; - return xDist * xDist + yDist * yDist; - } } /** @@ -775,7 +758,7 @@ public class LatinKeyboard extends BaseKeyboard { * languages by swiping the spacebar. It draws the current, previous and * next languages and moves them by the delta of touch movement on the spacebar. */ - class SlidingLocaleDrawable extends Drawable { + private class SlidingLocaleDrawable extends Drawable { private final int mWidth; private final int mHeight; -- cgit v1.2.3-83-g751a From b0a6f354aca8f643766719c663297e7be3fc6424 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Mon, 18 Oct 2010 19:45:01 +0900 Subject: DO NOT MERGE. Add '...' (hint) to period/smiley keys which triggers mini popup by long-press. bug: 3105185 Change-Id: I901e36aa12dad5968ba1a420fff6a2f2efb16da5 --- java/res/drawable-hdpi/hint_popup.9.png | Bin 0 -> 226 bytes java/res/drawable-hdpi/hint_settings.9.png | Bin 226 -> 0 bytes java/res/drawable-mdpi/hint_popup.9.png | Bin 0 -> 202 bytes java/res/drawable-mdpi/hint_settings.9.png | Bin 202 -> 0 bytes java/res/xml-da/kbd_qwerty.xml | 12 +++++++++ java/res/xml-da/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-de/kbd_qwerty.xml | 12 +++++++++ java/res/xml-de/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-fr/kbd_qwerty.xml | 12 +++++++++ java/res/xml-fr/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-iw/kbd_qwerty.xml | 12 +++++++++ java/res/xml-iw/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-nb/kbd_qwerty.xml | 12 +++++++++ java/res/xml-nb/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-ru/kbd_qwerty.xml | 12 +++++++++ java/res/xml-ru/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-sr/kbd_qwerty.xml | 12 +++++++++ java/res/xml-sr/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml-sv/kbd_qwerty.xml | 12 +++++++++ java/res/xml-sv/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml/kbd_qwerty.xml | 12 +++++++++ java/res/xml/kbd_qwerty_black.xml | 12 +++++++++ java/res/xml/kbd_symbols.xml | 2 ++ java/res/xml/kbd_symbols_black.xml | 2 ++ .../android/inputmethod/latin/LatinKeyboard.java | 16 +++++++----- .../inputmethod/latin/LatinKeyboardBaseView.java | 28 +++++++++++---------- 26 files changed, 245 insertions(+), 19 deletions(-) create mode 100644 java/res/drawable-hdpi/hint_popup.9.png delete mode 100644 java/res/drawable-hdpi/hint_settings.9.png create mode 100644 java/res/drawable-mdpi/hint_popup.9.png delete mode 100644 java/res/drawable-mdpi/hint_settings.9.png (limited to 'java/src') diff --git a/java/res/drawable-hdpi/hint_popup.9.png b/java/res/drawable-hdpi/hint_popup.9.png new file mode 100644 index 000000000..b5ec003e6 Binary files /dev/null and b/java/res/drawable-hdpi/hint_popup.9.png differ diff --git a/java/res/drawable-hdpi/hint_settings.9.png b/java/res/drawable-hdpi/hint_settings.9.png deleted file mode 100644 index b5ec003e6..000000000 Binary files a/java/res/drawable-hdpi/hint_settings.9.png and /dev/null differ diff --git a/java/res/drawable-mdpi/hint_popup.9.png b/java/res/drawable-mdpi/hint_popup.9.png new file mode 100644 index 000000000..444cc26ee Binary files /dev/null and b/java/res/drawable-mdpi/hint_popup.9.png differ diff --git a/java/res/drawable-mdpi/hint_settings.9.png b/java/res/drawable-mdpi/hint_settings.9.png deleted file mode 100644 index 444cc26ee..000000000 Binary files a/java/res/drawable-mdpi/hint_settings.9.png and /dev/null differ diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 70eab096d..b7b1b1769 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -187,6 +187,7 @@ android:isModifier="true" /> @@ -296,6 +301,7 @@ android:keyWidth="20%p" /> @@ -455,6 +466,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -275,6 +280,7 @@ android:keyWidth="20%p" /> @@ -434,6 +445,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -276,6 +281,7 @@ android:keyWidth="20%p" /> @@ -435,6 +446,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -234,6 +239,7 @@ android:keyWidth="20%p" /> @@ -393,6 +404,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -296,6 +301,7 @@ android:keyWidth="20%p" /> @@ -455,6 +466,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -274,6 +279,7 @@ android:keyWidth="20%p" /> @@ -433,6 +444,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -267,6 +272,7 @@ android:keyWidth="20%p" /> @@ -426,6 +437,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -298,6 +303,7 @@ android:keyWidth="20%p" /> @@ -457,6 +468,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> @@ -270,6 +275,7 @@ android:keyWidth="20%p" /> @@ -424,6 +435,7 @@ android:iconPreview="@drawable/sym_keyboard_feedback_tab" /> Date: Mon, 18 Oct 2010 21:10:11 +0900 Subject: Disable gesture detector on mini-keyboard Gesture detector, for closing keyboard by swiping down, must be disabled not only when mini-keyboard is on the screen, but also in the mini-keyboard itself. Bug: 3105595 Change-Id: I548501f7117ca2310943cabb678c1e250e5012ce --- .../src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 872b4d245..b02780bf6 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -226,7 +226,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx protected KeyDetector mKeyDetector = new ProximityKeyDetector(); // Swipe gesture detector - private final GestureDetector mGestureDetector; + private GestureDetector mGestureDetector; private final SwipeTracker mSwipeTracker = new SwipeTracker(); private final int mSwipeThreshold; private final boolean mDisambiguateSwipe; @@ -1132,6 +1132,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx }); // Override default ProximityKeyDetector. miniKeyboard.mKeyDetector = new MiniKeyboardKeyDetector(mMiniKeyboardSlideAllowance); + // Remove gesture detector on mini-keyboard + miniKeyboard.mGestureDetector = null; BaseKeyboard keyboard; if (popupKey.popupCharacters != null) { @@ -1304,8 +1306,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Track the last few movements to look for spurious swipes. mSwipeTracker.addMovement(me); - // We must disable gesture detector while mini-keyboard is on the screen. - if (mMiniKeyboard == null && mGestureDetector.onTouchEvent(me)) { + // Gesture detector must be enabled only when mini-keyboard is not on the screen. + if (mMiniKeyboard == null + && mGestureDetector != null && mGestureDetector.onTouchEvent(me)) { dismissKeyPreview(); mHandler.cancelKeyTimers(); return true; -- cgit v1.2.3-83-g751a From 58bfa350726c6a9b6b41e44e0313a2a366dab3d2 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 19 Oct 2010 17:08:54 +0900 Subject: Update xlarge drawable of Keyboard Bug: 3109804 Change-Id: I316f9cfcec377a7d0ea1417e1e3cea55cbdb9e2b --- .../btn_keyboard_key_dark_normal_holo.9.png | Bin 0 -> 1327 bytes .../btn_keyboard_key_dark_normal_off_holo.9.png | Bin 0 -> 1389 bytes .../btn_keyboard_key_dark_normal_on_holo.9.png | Bin 0 -> 1408 bytes .../btn_keyboard_key_dark_pressed_holo.9.png | Bin 0 -> 1321 bytes .../btn_keyboard_key_dark_pressed_off_holo.9.png | Bin 0 -> 1388 bytes .../btn_keyboard_key_dark_pressed_on_holo.9.png | Bin 0 -> 1399 bytes .../btn_keyboard_key_gingerbread.xml | 43 ++++++++ .../btn_keyboard_key_light_normal_holo.9.png | Bin 0 -> 1321 bytes .../btn_keyboard_key_light_pressed_holo.9.png | Bin 0 -> 1324 bytes java/res/drawable-xlarge/key_hint_0_holo.9.png | Bin 0 -> 1426 bytes java/res/drawable-xlarge/key_hint_1_holo.9.png | Bin 0 -> 1298 bytes java/res/drawable-xlarge/key_hint_2_holo.9.png | Bin 0 -> 1443 bytes java/res/drawable-xlarge/key_hint_3_holo.9.png | Bin 0 -> 1457 bytes java/res/drawable-xlarge/key_hint_4_holo.9.png | Bin 0 -> 1412 bytes java/res/drawable-xlarge/key_hint_5_holo.9.png | Bin 0 -> 1427 bytes java/res/drawable-xlarge/key_hint_6_holo.9.png | Bin 0 -> 1442 bytes java/res/drawable-xlarge/key_hint_7_holo.9.png | Bin 0 -> 1409 bytes java/res/drawable-xlarge/key_hint_8_holo.9.png | Bin 0 -> 1478 bytes java/res/drawable-xlarge/key_hint_9_holo.9.png | Bin 0 -> 1443 bytes java/res/drawable-xlarge/key_hint_at_holo.9.png | Bin 0 -> 1594 bytes java/res/drawable-xlarge/key_hint_colon_holo.9.png | Bin 0 -> 1219 bytes java/res/drawable-xlarge/key_hint_comma_holo.9.png | Bin 0 -> 1192 bytes java/res/drawable-xlarge/key_hint_dash_holo.9.png | Bin 0 -> 1191 bytes java/res/drawable-xlarge/key_hint_equal_holo.9.png | Bin 0 -> 1292 bytes .../key_hint_exclamation_holo.9.png | Bin 0 -> 1278 bytes .../res/drawable-xlarge/key_hint_larger_holo.9.png | Bin 0 -> 1317 bytes .../drawable-xlarge/key_hint_parenclose_holo.9.png | Bin 0 -> 1316 bytes .../drawable-xlarge/key_hint_parenopen_holo.9.png | Bin 0 -> 1323 bytes .../res/drawable-xlarge/key_hint_period_holo.9.png | Bin 0 -> 1164 bytes java/res/drawable-xlarge/key_hint_plus_holo.9.png | Bin 0 -> 1340 bytes .../drawable-xlarge/key_hint_question_holo.9.png | Bin 0 -> 1392 bytes java/res/drawable-xlarge/key_hint_quote_holo.9.png | Bin 0 -> 1257 bytes .../drawable-xlarge/key_hint_semicolon_holo.9.png | Bin 0 -> 1248 bytes .../key_hint_simplequote_holo.9.png | Bin 0 -> 1204 bytes java/res/drawable-xlarge/key_hint_slash_holo.9.png | Bin 0 -> 1317 bytes .../drawable-xlarge/key_hint_smaller_holo.9.png | Bin 0 -> 1326 bytes java/res/drawable-xlarge/key_hint_star_holo.9.png | Bin 0 -> 1344 bytes .../drawable-xlarge/key_hint_underline_holo.9.png | Bin 0 -> 1158 bytes java/res/values-xlarge/dimens.xml | 3 +- java/res/values/dimens.xml | 1 + java/res/xml-da/kbd_qwerty.xml | 2 +- java/res/xml-da/kbd_qwerty_black.xml | 2 +- java/res/xml-de/kbd_qwerty.xml | 5 +- java/res/xml-de/kbd_qwerty_black.xml | 5 +- java/res/xml-fr/kbd_qwerty.xml | 2 +- java/res/xml-fr/kbd_qwerty_black.xml | 2 +- java/res/xml-iw/kbd_qwerty.xml | 11 +- java/res/xml-iw/kbd_qwerty_black.xml | 11 +- java/res/xml-nb/kbd_qwerty.xml | 2 +- java/res/xml-nb/kbd_qwerty_black.xml | 2 +- java/res/xml-ru/kbd_qwerty.xml | 4 +- java/res/xml-ru/kbd_qwerty_black.xml | 2 +- java/res/xml-sr/kbd_qwerty.xml | 2 +- java/res/xml-sr/kbd_qwerty_black.xml | 2 +- java/res/xml-sv/kbd_qwerty.xml | 2 +- java/res/xml-sv/kbd_qwerty_black.xml | 2 +- java/res/xml-xlarge/kbd_phone.xml | 80 +++++++++------ java/res/xml-xlarge/kbd_phone_symbols.xml | 78 ++++++++------ java/res/xml-xlarge/kbd_popup_template.xml | 2 +- java/res/xml-xlarge/kbd_qwerty.xml | 112 +++++++++++---------- java/res/xml-xlarge/kbd_symbols.xml | 10 +- java/res/xml-xlarge/kbd_symbols_shift.xml | 10 +- java/res/xml/kbd_phone.xml | 2 +- java/res/xml/kbd_phone_black.xml | 2 +- java/res/xml/kbd_phone_symbols.xml | 2 +- java/res/xml/kbd_phone_symbols_black.xml | 2 +- java/res/xml/kbd_popup_template.xml | 2 +- java/res/xml/kbd_qwerty.xml | 5 +- java/res/xml/kbd_qwerty_black.xml | 5 +- java/res/xml/kbd_symbols.xml | 2 +- java/res/xml/kbd_symbols_black.xml | 2 +- java/res/xml/kbd_symbols_shift.xml | 2 +- java/res/xml/kbd_symbols_shift_black.xml | 2 +- .../android/inputmethod/latin/BaseKeyboard.java | 47 +++++---- 74 files changed, 297 insertions(+), 175 deletions(-) create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_dark_normal_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_dark_normal_off_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_dark_normal_on_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_off_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_on_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_gingerbread.xml create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_light_normal_holo.9.png create mode 100644 java/res/drawable-xlarge/btn_keyboard_key_light_pressed_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_0_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_1_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_2_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_3_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_4_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_5_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_6_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_7_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_8_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_9_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_at_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_colon_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_comma_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_dash_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_equal_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_exclamation_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_larger_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_parenclose_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_parenopen_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_period_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_plus_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_question_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_quote_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_semicolon_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_simplequote_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_slash_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_smaller_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_star_holo.9.png create mode 100644 java/res/drawable-xlarge/key_hint_underline_holo.9.png (limited to 'java/src') diff --git a/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_holo.9.png new file mode 100644 index 000000000..c23ff1878 Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_off_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_off_holo.9.png new file mode 100644 index 000000000..e29de9a7f Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_off_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_on_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_on_holo.9.png new file mode 100644 index 000000000..d46c03aa4 Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_dark_normal_on_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_holo.9.png new file mode 100644 index 000000000..45ca3a7fc Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_off_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_off_holo.9.png new file mode 100644 index 000000000..da039f3df Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_off_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_on_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_on_holo.9.png new file mode 100644 index 000000000..315ab17c0 Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_dark_pressed_on_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_gingerbread.xml b/java/res/drawable-xlarge/btn_keyboard_key_gingerbread.xml new file mode 100644 index 000000000..3dab8430f --- /dev/null +++ b/java/res/drawable-xlarge/btn_keyboard_key_gingerbread.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/drawable-xlarge/btn_keyboard_key_light_normal_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_light_normal_holo.9.png new file mode 100644 index 000000000..a1c80a2ed Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_light_normal_holo.9.png differ diff --git a/java/res/drawable-xlarge/btn_keyboard_key_light_pressed_holo.9.png b/java/res/drawable-xlarge/btn_keyboard_key_light_pressed_holo.9.png new file mode 100644 index 000000000..90babfc87 Binary files /dev/null and b/java/res/drawable-xlarge/btn_keyboard_key_light_pressed_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_0_holo.9.png b/java/res/drawable-xlarge/key_hint_0_holo.9.png new file mode 100644 index 000000000..33b6b40f3 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_0_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_1_holo.9.png b/java/res/drawable-xlarge/key_hint_1_holo.9.png new file mode 100644 index 000000000..df47e7b7c Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_1_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_2_holo.9.png b/java/res/drawable-xlarge/key_hint_2_holo.9.png new file mode 100644 index 000000000..bea76f3f2 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_2_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_3_holo.9.png b/java/res/drawable-xlarge/key_hint_3_holo.9.png new file mode 100644 index 000000000..8f8f89d50 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_3_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_4_holo.9.png b/java/res/drawable-xlarge/key_hint_4_holo.9.png new file mode 100644 index 000000000..feaa88ae1 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_4_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_5_holo.9.png b/java/res/drawable-xlarge/key_hint_5_holo.9.png new file mode 100644 index 000000000..b3635e01e Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_5_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_6_holo.9.png b/java/res/drawable-xlarge/key_hint_6_holo.9.png new file mode 100644 index 000000000..1345980e4 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_6_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_7_holo.9.png b/java/res/drawable-xlarge/key_hint_7_holo.9.png new file mode 100644 index 000000000..437301012 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_7_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_8_holo.9.png b/java/res/drawable-xlarge/key_hint_8_holo.9.png new file mode 100644 index 000000000..1bde6d10a Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_8_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_9_holo.9.png b/java/res/drawable-xlarge/key_hint_9_holo.9.png new file mode 100644 index 000000000..61d6f5518 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_9_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_at_holo.9.png b/java/res/drawable-xlarge/key_hint_at_holo.9.png new file mode 100644 index 000000000..f422a84d6 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_at_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_colon_holo.9.png b/java/res/drawable-xlarge/key_hint_colon_holo.9.png new file mode 100644 index 000000000..7c769bd97 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_colon_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_comma_holo.9.png b/java/res/drawable-xlarge/key_hint_comma_holo.9.png new file mode 100644 index 000000000..a9689adf5 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_comma_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_dash_holo.9.png b/java/res/drawable-xlarge/key_hint_dash_holo.9.png new file mode 100644 index 000000000..2402994f0 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_dash_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_equal_holo.9.png b/java/res/drawable-xlarge/key_hint_equal_holo.9.png new file mode 100644 index 000000000..89e508418 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_equal_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_exclamation_holo.9.png b/java/res/drawable-xlarge/key_hint_exclamation_holo.9.png new file mode 100644 index 000000000..f34953818 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_exclamation_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_larger_holo.9.png b/java/res/drawable-xlarge/key_hint_larger_holo.9.png new file mode 100644 index 000000000..2d734369a Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_larger_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_parenclose_holo.9.png b/java/res/drawable-xlarge/key_hint_parenclose_holo.9.png new file mode 100644 index 000000000..48f9f8065 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_parenclose_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_parenopen_holo.9.png b/java/res/drawable-xlarge/key_hint_parenopen_holo.9.png new file mode 100644 index 000000000..f05ae2075 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_parenopen_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_period_holo.9.png b/java/res/drawable-xlarge/key_hint_period_holo.9.png new file mode 100644 index 000000000..ec330fb6e Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_period_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_plus_holo.9.png b/java/res/drawable-xlarge/key_hint_plus_holo.9.png new file mode 100644 index 000000000..770bf5dbe Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_plus_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_question_holo.9.png b/java/res/drawable-xlarge/key_hint_question_holo.9.png new file mode 100644 index 000000000..f24bb1c09 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_question_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_quote_holo.9.png b/java/res/drawable-xlarge/key_hint_quote_holo.9.png new file mode 100644 index 000000000..ceee67ddc Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_quote_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_semicolon_holo.9.png b/java/res/drawable-xlarge/key_hint_semicolon_holo.9.png new file mode 100644 index 000000000..e8d6b0223 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_semicolon_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_simplequote_holo.9.png b/java/res/drawable-xlarge/key_hint_simplequote_holo.9.png new file mode 100644 index 000000000..7cafbb0d4 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_simplequote_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_slash_holo.9.png b/java/res/drawable-xlarge/key_hint_slash_holo.9.png new file mode 100644 index 000000000..676d56698 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_slash_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_smaller_holo.9.png b/java/res/drawable-xlarge/key_hint_smaller_holo.9.png new file mode 100644 index 000000000..97cf26edc Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_smaller_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_star_holo.9.png b/java/res/drawable-xlarge/key_hint_star_holo.9.png new file mode 100644 index 000000000..b10aa89bd Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_star_holo.9.png differ diff --git a/java/res/drawable-xlarge/key_hint_underline_holo.9.png b/java/res/drawable-xlarge/key_hint_underline_holo.9.png new file mode 100644 index 000000000..38abfcb01 Binary files /dev/null and b/java/res/drawable-xlarge/key_hint_underline_holo.9.png differ diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml index d2cd6c7d1..4614f720a 100644 --- a/java/res/values-xlarge/dimens.xml +++ b/java/res/values-xlarge/dimens.xml @@ -21,7 +21,8 @@ 0.450in - 0.0in + 0.03in + 0.03in 0.450in 0.10in diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 2fa47ae52..765262d56 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -22,6 +22,7 @@ 0.290in 0.035in + 0.000in 0.325in 0.06in diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml index 66771c287..f1f9904e3 100644 --- a/java/res/xml-da/kbd_qwerty.xml +++ b/java/res/xml-da/kbd_qwerty.xml @@ -27,7 +27,7 @@ diff --git a/java/res/xml-da/kbd_qwerty_black.xml b/java/res/xml-da/kbd_qwerty_black.xml index d89204ae6..b7ebc66de 100644 --- a/java/res/xml-da/kbd_qwerty_black.xml +++ b/java/res/xml-da/kbd_qwerty_black.xml @@ -27,7 +27,7 @@ diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml index 30d8de0cf..0832cbc92 100644 --- a/java/res/xml-de/kbd_qwerty.xml +++ b/java/res/xml-de/kbd_qwerty.xml @@ -21,7 +21,7 @@ @@ -82,11 +82,12 @@ latin:keyEdgeFlags="right" /> + @@ -82,11 +82,12 @@ latin:keyEdgeFlags="right" /> + diff --git a/java/res/xml-fr/kbd_qwerty_black.xml b/java/res/xml-fr/kbd_qwerty_black.xml index be2befbe8..b46ce9cb9 100644 --- a/java/res/xml-fr/kbd_qwerty_black.xml +++ b/java/res/xml-fr/kbd_qwerty_black.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml index 7f66eef56..fd94a1202 100644 --- a/java/res/xml-iw/kbd_qwerty.xml +++ b/java/res/xml-iw/kbd_qwerty.xml @@ -21,16 +21,17 @@ + @@ -46,13 +47,14 @@ latin:keyLabel="ם" /> + @@ -81,9 +83,10 @@ latin:keyEdgeFlags="right" /> + diff --git a/java/res/xml-iw/kbd_qwerty_black.xml b/java/res/xml-iw/kbd_qwerty_black.xml index 80ade2020..1c1c1e37f 100644 --- a/java/res/xml-iw/kbd_qwerty_black.xml +++ b/java/res/xml-iw/kbd_qwerty_black.xml @@ -21,16 +21,17 @@ + @@ -46,12 +47,13 @@ latin:keyLabel="ם" /> + @@ -80,9 +82,10 @@ latin:keyEdgeFlags="right" /> + diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml index 96a86b013..32512daaa 100644 --- a/java/res/xml-nb/kbd_qwerty.xml +++ b/java/res/xml-nb/kbd_qwerty.xml @@ -27,7 +27,7 @@ diff --git a/java/res/xml-nb/kbd_qwerty_black.xml b/java/res/xml-nb/kbd_qwerty_black.xml index 4adeb4801..982a3de65 100644 --- a/java/res/xml-nb/kbd_qwerty_black.xml +++ b/java/res/xml-nb/kbd_qwerty_black.xml @@ -27,7 +27,7 @@ diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml index 57114a8ea..80a9ddd4f 100644 --- a/java/res/xml-ru/kbd_qwerty.xml +++ b/java/res/xml-ru/kbd_qwerty.xml @@ -20,8 +20,8 @@ diff --git a/java/res/xml-ru/kbd_qwerty_black.xml b/java/res/xml-ru/kbd_qwerty_black.xml index 8f2f599c3..2635541e8 100644 --- a/java/res/xml-ru/kbd_qwerty_black.xml +++ b/java/res/xml-ru/kbd_qwerty_black.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml-sr/kbd_qwerty.xml b/java/res/xml-sr/kbd_qwerty.xml index 1a657055a..c9a4e449c 100644 --- a/java/res/xml-sr/kbd_qwerty.xml +++ b/java/res/xml-sr/kbd_qwerty.xml @@ -22,7 +22,7 @@ diff --git a/java/res/xml-sr/kbd_qwerty_black.xml b/java/res/xml-sr/kbd_qwerty_black.xml index e4b09c717..f760c5eb1 100644 --- a/java/res/xml-sr/kbd_qwerty_black.xml +++ b/java/res/xml-sr/kbd_qwerty_black.xml @@ -22,7 +22,7 @@ diff --git a/java/res/xml-sv/kbd_qwerty.xml b/java/res/xml-sv/kbd_qwerty.xml index 8819159e8..ae7002463 100644 --- a/java/res/xml-sv/kbd_qwerty.xml +++ b/java/res/xml-sv/kbd_qwerty.xml @@ -29,7 +29,7 @@ diff --git a/java/res/xml-sv/kbd_qwerty_black.xml b/java/res/xml-sv/kbd_qwerty_black.xml index 2532fca8c..463b60bd9 100644 --- a/java/res/xml-sv/kbd_qwerty_black.xml +++ b/java/res/xml-sv/kbd_qwerty_black.xml @@ -29,7 +29,7 @@ diff --git a/java/res/xml-xlarge/kbd_phone.xml b/java/res/xml-xlarge/kbd_phone.xml index 977bbf2df..107731f3b 100644 --- a/java/res/xml-xlarge/kbd_phone.xml +++ b/java/res/xml-xlarge/kbd_phone.xml @@ -21,8 +21,8 @@ @@ -35,29 +35,35 @@ latin:keyEdgeFlags="left" /> + + latin:keyLabel=" - " /> + + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num2" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num3" + latin:keyWidth="10.5%p " /> + @@ -72,29 +78,35 @@ latin:keyEdgeFlags="left" /> + + latin:keyLabel=" , " /> + + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num5" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num6" + latin:keyWidth="10.5%p " /> + @@ -103,47 +115,57 @@ and ')'. --> + + latin:keyLabel=" ( " /> + + latin:keyWidth="10.5%p " /> - + latin:keyIcon="@drawable/sym_keyboard_num8" + latin:keyWidth="10.5%p " /> - + latin:keyIcon="@drawable/sym_keyboard_num9" + latin:keyWidth="10.5%p " /> + + + + latin:keyWidth="15.0%p" /> + + latin:keyWidth="10.5%p " /> - + latin:keyIcon="@drawable/sym_keyboard_num0" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_numpound" + latin:keyWidth="10.5%p " /> + diff --git a/java/res/xml-xlarge/kbd_phone_symbols.xml b/java/res/xml-xlarge/kbd_phone_symbols.xml index 6fbf3a902..a7dcd325a 100644 --- a/java/res/xml-xlarge/kbd_phone_symbols.xml +++ b/java/res/xml-xlarge/kbd_phone_symbols.xml @@ -21,8 +21,8 @@ @@ -33,10 +33,11 @@ latin:keyWidth="15.0%p" latin:isModifier="true" latin:keyEdgeFlags="left" /> + + latin:keyLabel="@string/label_pause_key" /> + + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num2" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num3" + latin:keyWidth="10.5%p " /> + @@ -73,10 +79,11 @@ latin:isModifier="true" latin:isSticky="true" latin:keyEdgeFlags="left" /> + + latin:keyLabel="@string/label_wait_key" /> + + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num5" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num6" + latin:keyWidth="10.5%p " /> + @@ -109,50 +121,60 @@ char 'N', '(' and ')'. --> + + latin:keyLabel=" N " /> + + latin:keyWidth="10.5%p " /> - + latin:keyIcon="@drawable/sym_keyboard_num8" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_num9" + latin:keyWidth="10.5%p " /> + + + latin:keyWidth="22.5%p" /> + + latin:keyWidth="10.5%p " /> - + latin:keyIcon="@drawable/sym_keyboard_num0" + latin:keyWidth="10.5%p " /> + latin:keyIcon="@drawable/sym_keyboard_numpound" + latin:keyWidth="10.5%p " /> + diff --git a/java/res/xml-xlarge/kbd_popup_template.xml b/java/res/xml-xlarge/kbd_popup_template.xml index 382d90afc..55ebda5e4 100644 --- a/java/res/xml-xlarge/kbd_popup_template.xml +++ b/java/res/xml-xlarge/kbd_popup_template.xml @@ -20,7 +20,7 @@ diff --git a/java/res/xml-xlarge/kbd_qwerty.xml b/java/res/xml-xlarge/kbd_qwerty.xml index b72503414..9485ca7b3 100644 --- a/java/res/xml-xlarge/kbd_qwerty.xml +++ b/java/res/xml-xlarge/kbd_qwerty.xml @@ -21,7 +21,7 @@ @@ -30,62 +30,63 @@ + + latin:popupCharacters="<" /> + + latin:keyOutputText=".com" + latin:keyWidth="15.0%p" /> + + latin:keyOutputText=".com" + latin:keyWidth="15.0%p" /> + + latin:keyWidth="15.0%p" /> + + latin:popupCharacters="<" /> @@ -30,6 +30,7 @@ - + @@ -30,6 +30,7 @@ - + diff --git a/java/res/xml/kbd_phone_black.xml b/java/res/xml/kbd_phone_black.xml index 6ade277d9..86759d676 100644 --- a/java/res/xml/kbd_phone_black.xml +++ b/java/res/xml/kbd_phone_black.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml/kbd_phone_symbols.xml b/java/res/xml/kbd_phone_symbols.xml index 5062d4707..1c691d2a5 100644 --- a/java/res/xml/kbd_phone_symbols.xml +++ b/java/res/xml/kbd_phone_symbols.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml/kbd_phone_symbols_black.xml b/java/res/xml/kbd_phone_symbols_black.xml index 2a6932a9e..3e46c5307 100644 --- a/java/res/xml/kbd_phone_symbols_black.xml +++ b/java/res/xml/kbd_phone_symbols_black.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml/kbd_popup_template.xml b/java/res/xml/kbd_popup_template.xml index f1aa86f39..004d490d6 100644 --- a/java/res/xml/kbd_popup_template.xml +++ b/java/res/xml/kbd_popup_template.xml @@ -20,7 +20,7 @@ diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml index 21a7ccb78..517b4fe5c 100644 --- a/java/res/xml/kbd_qwerty.xml +++ b/java/res/xml/kbd_qwerty.xml @@ -21,7 +21,7 @@ @@ -82,11 +82,12 @@ latin:keyEdgeFlags="right" /> + @@ -82,11 +82,12 @@ latin:keyEdgeFlags="right" /> + diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml index dedd2da08..b6a069c25 100644 --- a/java/res/xml/kbd_symbols_black.xml +++ b/java/res/xml/kbd_symbols_black.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml index 52afa38e3..d83706b5c 100644 --- a/java/res/xml/kbd_symbols_shift.xml +++ b/java/res/xml/kbd_symbols_shift.xml @@ -21,7 +21,7 @@ diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml index c1bd4e395..e5f8abf6e 100644 --- a/java/res/xml/kbd_symbols_shift_black.xml +++ b/java/res/xml/kbd_symbols_shift_black.xml @@ -21,7 +21,7 @@ diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index bad1544e5..fc35ccc5d 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -61,6 +61,7 @@ public class BaseKeyboard { private static final String TAG_KEYBOARD = "Keyboard"; private static final String TAG_ROW = "Row"; private static final String TAG_KEY = "Key"; + private static final String TAG_SPACER = "Spacer"; private static final String TAG_INCLUDE = "include"; private static final String TAG_MERGE = "merge"; @@ -273,8 +274,8 @@ public class BaseKeyboard { public Key(Row parent) { keyboard = parent.parent; height = parent.defaultHeight; - width = parent.defaultWidth; gap = parent.defaultHorizontalGap; + width = parent.defaultWidth - gap; edgeFlags = parent.rowEdgeFlags; } @@ -290,21 +291,21 @@ public class BaseKeyboard { public Key(Resources res, Row parent, int x, int y, XmlResourceParser parser) { this(parent); - this.x = x; - this.y = y; - TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); - - width = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyWidth, - keyboard.mDisplayWidth, parent.defaultWidth); height = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyHeight, keyboard.mDisplayHeight, parent.defaultHeight); gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, keyboard.mDisplayWidth, parent.defaultHorizontalGap); + width = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyWidth, + keyboard.mDisplayWidth, parent.defaultWidth) - gap; a.recycle(); a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard_Key); - this.x += gap; + + // Horizontal gap is divided equally to both sides of the key. + this.x = x + gap / 2; + this.y = y; + TypedValue codesValue = new TypedValue(); a.getValue(R.styleable.BaseKeyboard_Key_codes, codesValue); if (codesValue.type == TypedValue.TYPE_INT_DEC @@ -731,6 +732,10 @@ public class BaseKeyboard { mTotalHeight = mCurrentY - defaultVerticalGap; } + public void setSpacer(int gap) { + mCurrentX += gap; + } + public int getMaxRowWidth() { return mMaxRowWidth; } @@ -774,6 +779,8 @@ public class BaseKeyboard { mKeys.add(key); if (key.codes[0] == KEYCODE_SHIFT) mShiftKeys.add(key); + } else if (TAG_SPACER.equals(tag)) { + parseSpacerAttribute(res, parser, state); } else if (TAG_KEYBOARD.equals(tag)) { parseKeyboardAttributes(res, parser); } else if (TAG_INCLUDE.equals(tag)) { @@ -791,6 +798,8 @@ public class BaseKeyboard { state.endKey(key); } else if (TAG_ROW.equals(tag)) { state.endRow(); + } else if (TAG_SPACER.equals(tag)) { + ; } else if (TAG_KEYBOARD.equals(tag)) { state.endKeyboard(mDefaultVerticalGap); } else if (TAG_INCLUDE.equals(tag)) { @@ -804,6 +813,15 @@ public class BaseKeyboard { } } + private void parseSpacerAttribute(Resources res, XmlResourceParser parser, + KeyboardParseState state) { + TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); + int gap = getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, mDisplayWidth, 0); + a.recycle(); + state.setSpacer(gap); + } + private void parseInclude(Resources res, XmlResourceParser parent, KeyboardParseState state) throws XmlPullParserException, IOException { final TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parent), @@ -848,19 +866,14 @@ public class BaseKeyboard { private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) { TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); - mDefaultWidth = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyWidth, - mDisplayWidth, mDisplayWidth / 10); + R.styleable.BaseKeyboard_keyWidth, mDisplayWidth, mDisplayWidth / 10); mDefaultHeight = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyHeight, - mDisplayHeight, 50); + R.styleable.BaseKeyboard_keyHeight, mDisplayHeight, 50); mDefaultHorizontalGap = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_horizontalGap, - mDisplayWidth, 0); + R.styleable.BaseKeyboard_horizontalGap, mDisplayWidth, 0); mDefaultVerticalGap = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_verticalGap, - mDisplayHeight, 0); + R.styleable.BaseKeyboard_verticalGap, mDisplayHeight, 0); mProximityThreshold = (int) (mDefaultWidth * SEARCH_DISTANCE); mProximityThreshold = mProximityThreshold * mProximityThreshold; a.recycle(); -- cgit v1.2.3-83-g751a From e354a85ef44e13999aaefd735cef7f659090f6e8 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Wed, 20 Oct 2010 00:18:50 +0900 Subject: Manual merge of the following Gingerbread changes logically I8b38e280 Ia3929bb0 If925b546 I1062763d I901e36aa bug: 3100311 Change-Id: Ic7e01277ec816e77d34732599b2b9552668b81c2 --- java/res/drawable-hdpi/hint_popup.9.png | Bin 0 -> 226 bytes java/res/drawable-mdpi/hint_popup.9.png | Bin 0 -> 202 bytes java/res/xml/kbd_popup_narrow_template.xml | 10 +- java/res/xml/kbd_qwerty_black_row4.xml | 20 ++- java/res/xml/kbd_qwerty_row4.xml | 20 ++- java/res/xml/kbd_symbols.xml | 111 +++++++------- java/res/xml/kbd_symbols_black.xml | 100 +++++++------ java/res/xml/kbd_symbols_black_row4_common.xml | 46 ++++++ ...symbols_black_row4_common_with_settings_key.xml | 50 +++++++ java/res/xml/kbd_symbols_black_row4_im.xml | 47 ++++++ ...kbd_symbols_black_row4_im_with_settings_key.xml | 51 +++++++ java/res/xml/kbd_symbols_row4_common.xml | 51 +++++++ .../kbd_symbols_row4_common_with_settings_key.xml | 56 +++++++ java/res/xml/kbd_symbols_row4_im.xml | 52 +++++++ .../xml/kbd_symbols_row4_im_with_settings_key.xml | 57 +++++++ java/res/xml/kbd_symbols_shift.xml | 109 +++++++------- java/res/xml/kbd_symbols_shift_black.xml | 98 +++++++------ .../xml/kbd_symbols_shift_black_row4_common.xml | 44 ++++++ ...s_shift_black_row4_common_with_settings_key.xml | 48 ++++++ java/res/xml/kbd_symbols_shift_black_row4_im.xml | 45 ++++++ ...mbols_shift_black_row4_im_with_settings_key.xml | 49 +++++++ java/res/xml/kbd_symbols_shift_row4_common.xml | 49 +++++++ ...symbols_shift_row4_common_with_settings_key.xml | 54 +++++++ java/res/xml/kbd_symbols_shift_row4_im.xml | 50 +++++++ ...kbd_symbols_shift_row4_im_with_settings_key.xml | 55 +++++++ java/res/xml/popup_at.xml | 39 +++++ java/res/xml/popup_slash.xml | 39 +++++ .../inputmethod/latin/KeyboardSwitcher.java | 163 ++++++++++++--------- .../com/android/inputmethod/latin/LatinIME.java | 4 +- .../android/inputmethod/latin/LatinKeyboard.java | 71 +++++++-- .../inputmethod/latin/LatinKeyboardBaseView.java | 54 ++++--- 31 files changed, 1302 insertions(+), 340 deletions(-) create mode 100644 java/res/drawable-hdpi/hint_popup.9.png create mode 100644 java/res/drawable-mdpi/hint_popup.9.png create mode 100644 java/res/xml/kbd_symbols_black_row4_common.xml create mode 100644 java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_black_row4_im.xml create mode 100644 java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_row4_common.xml create mode 100644 java/res/xml/kbd_symbols_row4_common_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_row4_im.xml create mode 100644 java/res/xml/kbd_symbols_row4_im_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_shift_black_row4_common.xml create mode 100644 java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_shift_black_row4_im.xml create mode 100644 java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_shift_row4_common.xml create mode 100644 java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml create mode 100644 java/res/xml/kbd_symbols_shift_row4_im.xml create mode 100644 java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml create mode 100644 java/res/xml/popup_at.xml create mode 100644 java/res/xml/popup_slash.xml (limited to 'java/src') diff --git a/java/res/drawable-hdpi/hint_popup.9.png b/java/res/drawable-hdpi/hint_popup.9.png new file mode 100644 index 000000000..b5ec003e6 Binary files /dev/null and b/java/res/drawable-hdpi/hint_popup.9.png differ diff --git a/java/res/drawable-mdpi/hint_popup.9.png b/java/res/drawable-mdpi/hint_popup.9.png new file mode 100644 index 000000000..444cc26ee Binary files /dev/null and b/java/res/drawable-mdpi/hint_popup.9.png differ diff --git a/java/res/xml/kbd_popup_narrow_template.xml b/java/res/xml/kbd_popup_narrow_template.xml index 23c686e8b..9b78711a0 100644 --- a/java/res/xml/kbd_popup_narrow_template.xml +++ b/java/res/xml/kbd_popup_narrow_template.xml @@ -18,10 +18,10 @@ */ --> - diff --git a/java/res/xml/kbd_qwerty_black_row4.xml b/java/res/xml/kbd_qwerty_black_row4.xml index 1718603fd..330ddda42 100644 --- a/java/res/xml/kbd_qwerty_black_row4.xml +++ b/java/res/xml/kbd_qwerty_black_row4.xml @@ -40,6 +40,7 @@ latin:keyWidth="40%p" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_f1" /> @@ -153,6 +158,7 @@ latin:keyWidth="20%p" /> + latin:codes="@integer/key_f1" /> + latin:codes="@integer/key_f1" /> @@ -312,6 +323,7 @@ latin:iconPreview="@drawable/sym_keyboard_feedback_tab" /> - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml index b6a069c25..9e401a1cd 100644 --- a/java/res/xml/kbd_symbols_black.xml +++ b/java/res/xml/kbd_symbols_black.xml @@ -142,59 +142,63 @@ latin:keyEdgeFlags="right" /> - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_black_row4_common.xml b/java/res/xml/kbd_symbols_black_row4_common.xml new file mode 100644 index 000000000..7433eca7f --- /dev/null +++ b/java/res/xml/kbd_symbols_black_row4_common.xml @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml new file mode 100644 index 000000000..bbb169919 --- /dev/null +++ b/java/res/xml/kbd_symbols_black_row4_common_with_settings_key.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_black_row4_im.xml b/java/res/xml/kbd_symbols_black_row4_im.xml new file mode 100644 index 000000000..a1546b7b5 --- /dev/null +++ b/java/res/xml/kbd_symbols_black_row4_im.xml @@ -0,0 +1,47 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml new file mode 100644 index 000000000..4cab461e7 --- /dev/null +++ b/java/res/xml/kbd_symbols_black_row4_im_with_settings_key.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_row4_common.xml b/java/res/xml/kbd_symbols_row4_common.xml new file mode 100644 index 000000000..ef7cdcaff --- /dev/null +++ b/java/res/xml/kbd_symbols_row4_common.xml @@ -0,0 +1,51 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_row4_common_with_settings_key.xml new file mode 100644 index 000000000..54b85429c --- /dev/null +++ b/java/res/xml/kbd_symbols_row4_common_with_settings_key.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_row4_im.xml b/java/res/xml/kbd_symbols_row4_im.xml new file mode 100644 index 000000000..c7d679bc4 --- /dev/null +++ b/java/res/xml/kbd_symbols_row4_im.xml @@ -0,0 +1,52 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_row4_im_with_settings_key.xml new file mode 100644 index 000000000..7cc209b6b --- /dev/null +++ b/java/res/xml/kbd_symbols_row4_im_with_settings_key.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml index d83706b5c..b8f8faeb2 100644 --- a/java/res/xml/kbd_symbols_shift.xml +++ b/java/res/xml/kbd_symbols_shift.xml @@ -122,68 +122,63 @@ latin:keyEdgeFlags="right" /> - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml index e5f8abf6e..34684a65b 100644 --- a/java/res/xml/kbd_symbols_shift_black.xml +++ b/java/res/xml/kbd_symbols_shift_black.xml @@ -121,57 +121,63 @@ latin:keyEdgeFlags="right" /> - - - - - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_black_row4_common.xml b/java/res/xml/kbd_symbols_shift_black_row4_common.xml new file mode 100644 index 000000000..beb5b3d67 --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_black_row4_common.xml @@ -0,0 +1,44 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml new file mode 100644 index 000000000..97f882a5a --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_black_row4_common_with_settings_key.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_black_row4_im.xml b/java/res/xml/kbd_symbols_shift_black_row4_im.xml new file mode 100644 index 000000000..c0263c215 --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_black_row4_im.xml @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml new file mode 100644 index 000000000..14d6a0b51 --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_black_row4_im_with_settings_key.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_row4_common.xml b/java/res/xml/kbd_symbols_shift_row4_common.xml new file mode 100644 index 000000000..4d5199e88 --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_row4_common.xml @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml new file mode 100644 index 000000000..df570ea1b --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_row4_common_with_settings_key.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_row4_im.xml b/java/res/xml/kbd_symbols_shift_row4_im.xml new file mode 100644 index 000000000..69c609254 --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_row4_im.xml @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml b/java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml new file mode 100644 index 000000000..aad6e400b --- /dev/null +++ b/java/res/xml/kbd_symbols_shift_row4_im_with_settings_key.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + diff --git a/java/res/xml/popup_at.xml b/java/res/xml/popup_at.xml new file mode 100644 index 000000000..4b19d4fd4 --- /dev/null +++ b/java/res/xml/popup_at.xml @@ -0,0 +1,39 @@ + + + + + + + + + diff --git a/java/res/xml/popup_slash.xml b/java/res/xml/popup_slash.xml new file mode 100644 index 000000000..1ace909ef --- /dev/null +++ b/java/res/xml/popup_slash.xml @@ -0,0 +1,39 @@ + + + + + + + + + diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 86dbf1f60..ec422174d 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -29,14 +29,14 @@ import java.util.Locale; public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener { - public static final int MODE_NONE = 0; - public static final int MODE_TEXT = 1; - public static final int MODE_SYMBOLS = 2; - public static final int MODE_PHONE = 3; - public static final int MODE_URL = 4; - public static final int MODE_EMAIL = 5; - public static final int MODE_IM = 6; - public static final int MODE_WEB = 7; + public static final int MODE_TEXT = 0; + public static final int MODE_URL = 1; + public static final int MODE_EMAIL = 2; + public static final int MODE_IM = 3; + public static final int MODE_WEB = 4; + public static final int MODE_PHONE = 5; + + public static final int MODE_NONE = -1; // Main keyboard layouts without the settings key public static final int KEYBOARDMODE_NORMAL = R.id.mode_normal; @@ -44,6 +44,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public static final int KEYBOARDMODE_EMAIL = R.id.mode_email; public static final int KEYBOARDMODE_IM = R.id.mode_im; public static final int KEYBOARDMODE_WEB = R.id.mode_webentry; + public static final int[] QWERTY_MODES = { + KEYBOARDMODE_NORMAL, + KEYBOARDMODE_URL, + KEYBOARDMODE_EMAIL, + KEYBOARDMODE_IM, + KEYBOARDMODE_WEB, + 0 /* for MODE_PHONE */ }; // Main keyboard layouts with the settings key public static final int KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY = R.id.mode_normal_with_settings_key; @@ -55,12 +62,45 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha R.id.mode_im_with_settings_key; public static final int KEYBOARDMODE_WEB_WITH_SETTINGS_KEY = R.id.mode_webentry_with_settings_key; - - // Symbols keyboard layout without the settings key - public static final int KEYBOARDMODE_SYMBOLS = R.id.mode_symbols; - // Symbols keyboard layout with the settings key - public static final int KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY = - R.id.mode_symbols_with_settings_key; + public static final int[] QWERTY_WITH_SETTINGS_KEY_MODES = { + KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY, + KEYBOARDMODE_URL_WITH_SETTINGS_KEY, + KEYBOARDMODE_EMAIL_WITH_SETTINGS_KEY, + KEYBOARDMODE_IM_WITH_SETTINGS_KEY, + KEYBOARDMODE_WEB_WITH_SETTINGS_KEY, + 0 /* for MODE_PHONE */ }; + + // Symbols keyboard layouts without the settings key + public static final int KEYBOARDMODE_SYMBOLS_NORMAL = R.id.mode_symbols_normal; + public static final int KEYBOARDMODE_SYMBOLS_URL = R.id.mode_symbols_url; + public static final int KEYBOARDMODE_SYMBOLS_EMAIL = R.id.mode_symbols_email; + public static final int KEYBOARDMODE_SYMBOLS_IM = R.id.mode_symbols_im; + public static final int KEYBOARDMODE_SYMBOLS_WEB = R.id.mode_symbols_webentry; + public static final int[] SYMBOLS_MODES = { + KEYBOARDMODE_SYMBOLS_NORMAL, + KEYBOARDMODE_SYMBOLS_URL, + KEYBOARDMODE_SYMBOLS_EMAIL, + KEYBOARDMODE_SYMBOLS_IM, + KEYBOARDMODE_SYMBOLS_WEB, + 0 /* for MODE_PHONE */ }; + // Symbols keyboard layouts with the settings key + public static final int KEYBOARDMODE_SYMBOLS_NORMAL_WITH_SETTINGS_KEY = + R.id.mode_symbols_normal_with_settings_key; + public static final int KEYBOARDMODE_SYMBOLS_URL_WITH_SETTINGS_KEY = + R.id.mode_symbols_url_with_settings_key; + public static final int KEYBOARDMODE_SYMBOLS_EMAIL_WITH_SETTINGS_KEY = + R.id.mode_symbols_email_with_settings_key; + public static final int KEYBOARDMODE_SYMBOLS_IM_WITH_SETTINGS_KEY = + R.id.mode_symbols_im_with_settings_key; + public static final int KEYBOARDMODE_SYMBOLS_WEB_WITH_SETTINGS_KEY = + R.id.mode_symbols_webentry_with_settings_key; + public static final int[] SYMBOLS_WITH_SETTINGS_KEY_MODES = { + KEYBOARDMODE_SYMBOLS_NORMAL_WITH_SETTINGS_KEY, + KEYBOARDMODE_SYMBOLS_URL_WITH_SETTINGS_KEY, + KEYBOARDMODE_SYMBOLS_EMAIL_WITH_SETTINGS_KEY, + KEYBOARDMODE_SYMBOLS_IM_WITH_SETTINGS_KEY, + KEYBOARDMODE_SYMBOLS_WEB_WITH_SETTINGS_KEY, + 0 /* for MODE_PHONE */ }; public static final String DEFAULT_LAYOUT_ID = "4"; public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20100902"; @@ -115,7 +155,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private boolean mIsAutoCompletionActive; private boolean mHasVoice; private boolean mVoiceOnPrimary; - private boolean mPreferSymbols; private int mSymbolsModeState = SYMBOLS_MODE_STATE_NONE; // Indicates whether or not we have the settings key @@ -158,21 +197,26 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } private KeyboardId makeSymbolsId(boolean hasVoice) { + final int mode = mMode == MODE_NONE ? MODE_TEXT : mMode; return new KeyboardId(KBD_SYMBOLS[getCharColorId()], mHasSettingsKey ? - KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, + SYMBOLS_WITH_SETTINGS_KEY_MODES[mode] : SYMBOLS_MODES[mode], false, hasVoice); } private KeyboardId makeSymbolsShiftedId(boolean hasVoice) { + final int mode = mMode == MODE_NONE ? MODE_TEXT : mMode; return new KeyboardId(KBD_SYMBOLS_SHIFT[getCharColorId()], mHasSettingsKey ? - KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, + SYMBOLS_WITH_SETTINGS_KEY_MODES[mode] : SYMBOLS_MODES[mode], false, hasVoice); } - public void makeKeyboards(boolean forceCreate) { + private void makeSymbolsKeyboardIds() { mSymbolsId = makeSymbolsId(mHasVoice && !mVoiceOnPrimary); mSymbolsShiftedId = makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary); + } + public void makeKeyboards(boolean forceCreate) { + makeSymbolsKeyboardIds(); if (forceCreate) mKeyboards.clear(); // Configuration change is coming after the keyboard gets recreated. So don't rely on that. // If keyboards have already been made, check if we have a screen width change and @@ -207,10 +251,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha }); } - public KeyboardId(int xml, boolean hasVoice) { - this(xml, 0, false, hasVoice); - } - @Override public boolean equals(Object other) { return other instanceof KeyboardId && equals((KeyboardId) other); @@ -244,14 +284,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public void setKeyboardMode(int mode, int imeOptions, boolean enableVoice) { mSymbolsModeState = SYMBOLS_MODE_STATE_NONE; - mPreferSymbols = mode == MODE_SYMBOLS; - if (mode == MODE_SYMBOLS) { - mode = MODE_TEXT; - } try { - setKeyboardMode(mode, imeOptions, enableVoice, mPreferSymbols); + setKeyboardMode(mode, imeOptions, enableVoice, false); } catch (RuntimeException e) { - LatinImeLogger.logOnException(mode + "," + imeOptions + "," + mPreferSymbols, e); + LatinImeLogger.logOnException(mode + "," + imeOptions, e); } } @@ -259,8 +295,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha if (mInputView == null) return; mMode = mode; mImeOptions = imeOptions; + makeSymbolsKeyboardIds(); if (enableVoice != mHasVoice) { - setVoiceMode(mHasVoice, mVoiceOnPrimary); + // TODO clean up this unnecessary recursive call. + setVoiceMode(enableVoice, mVoiceOnPrimary); } mIsSymbols = isSymbols; @@ -277,7 +315,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha mInputView.setKeyboard(keyboard); keyboard.setShifted(false); keyboard.setShiftLocked(keyboard.isShiftLocked()); - keyboard.setImeOptions(mInputMethodService.getResources(), mMode, imeOptions); + keyboard.setImeOptions(mInputMethodService.getResources(), mode, imeOptions); keyboard.setColorOfSymbolIcons(mIsAutoCompletionActive, isBlackSym()); // Update the settings key state because number of enabled IMEs could have been changed updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService)); @@ -309,48 +347,31 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } private KeyboardId getKeyboardId(int mode, int imeOptions, boolean isSymbols) { - boolean hasVoice = hasVoiceButton(isSymbols); - int charColorId = getCharColorId(); - // TODO: generalize for any KeyboardId - int keyboardRowsResId = KBD_QWERTY[charColorId]; - if (isSymbols) { - if (mode == MODE_PHONE) { - return new KeyboardId(KBD_PHONE_SYMBOLS[charColorId], hasVoice); - } else { - return new KeyboardId(KBD_SYMBOLS[charColorId], mHasSettingsKey ? - KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, - false, hasVoice); - } + final boolean hasVoice = hasVoiceButton(isSymbols); + final int charColorId = getCharColorId(); + final int keyboardRowsResId; + final boolean enableShiftLock; + final int keyboardMode; + + if (mode == MODE_NONE) { + LatinImeLogger.logOnWarning( + "getKeyboardId:" + mode + "," + imeOptions + "," + isSymbols); + mode = MODE_TEXT; } - switch (mode) { - case MODE_NONE: - LatinImeLogger.logOnWarning( - "getKeyboardId:" + mode + "," + imeOptions + "," + isSymbols); - /* fall through */ - case MODE_TEXT: - return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? - KEYBOARDMODE_NORMAL_WITH_SETTINGS_KEY : KEYBOARDMODE_NORMAL, - true, hasVoice); - case MODE_SYMBOLS: - return new KeyboardId(KBD_SYMBOLS[charColorId], mHasSettingsKey ? - KEYBOARDMODE_SYMBOLS_WITH_SETTINGS_KEY : KEYBOARDMODE_SYMBOLS, - false, hasVoice); - case MODE_PHONE: - return new KeyboardId(KBD_PHONE[charColorId], hasVoice); - case MODE_URL: - return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? - KEYBOARDMODE_URL_WITH_SETTINGS_KEY : KEYBOARDMODE_URL, true, hasVoice); - case MODE_EMAIL: - return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? - KEYBOARDMODE_EMAIL_WITH_SETTINGS_KEY : KEYBOARDMODE_EMAIL, true, hasVoice); - case MODE_IM: - return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? - KEYBOARDMODE_IM_WITH_SETTINGS_KEY : KEYBOARDMODE_IM, true, hasVoice); - case MODE_WEB: - return new KeyboardId(keyboardRowsResId, mHasSettingsKey ? - KEYBOARDMODE_WEB_WITH_SETTINGS_KEY : KEYBOARDMODE_WEB, true, hasVoice); + if (isSymbols) { + keyboardRowsResId = mode == MODE_PHONE + ? KBD_PHONE_SYMBOLS[charColorId] : KBD_SYMBOLS[charColorId]; + enableShiftLock = false; + keyboardMode = mHasSettingsKey + ? SYMBOLS_WITH_SETTINGS_KEY_MODES[mode] : SYMBOLS_MODES[mode]; + } else { // QWERTY + keyboardRowsResId = mode == MODE_PHONE + ? KBD_PHONE[charColorId] : KBD_QWERTY[charColorId]; + enableShiftLock = mode == MODE_PHONE ? false : true; + keyboardMode = mHasSettingsKey + ? QWERTY_WITH_SETTINGS_KEY_MODES[mode] : QWERTY_MODES[mode]; } - return null; + return new KeyboardId(keyboardRowsResId, keyboardMode, enableShiftLock, hasVoice); } public int getKeyboardMode() { @@ -411,7 +432,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public void toggleSymbols() { setKeyboardMode(mMode, mImeOptions, mHasVoice, !mIsSymbols); - if (mIsSymbols && !mPreferSymbols) { + if (mIsSymbols) { mSymbolsModeState = SYMBOLS_MODE_STATE_BEGIN; } else { mSymbolsModeState = SYMBOLS_MODE_STATE_NONE; diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index edda9e866..bb29e6367 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2333,8 +2333,8 @@ public class LatinIME extends InputMethodService private boolean shouldShowVoiceButton(FieldContext fieldContext, EditorInfo attribute) { return ENABLE_VOICE_BUTTON && fieldCanDoVoice(fieldContext) - && !(attribute != null && attribute.privateImeOptions != null - && attribute.privateImeOptions.equals(IME_OPTION_NO_MICROPHONE)) + && !(attribute != null + && IME_OPTION_NO_MICROPHONE.equals(attribute.privateImeOptions)) && SpeechRecognizer.isRecognitionAvailable(this); } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 3ca85c5d0..fcbada191 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -60,6 +60,7 @@ public class LatinKeyboard extends BaseKeyboard { private final Drawable mButtonArrowRightIcon; private Key mEnterKey; private Key mF1Key; + private final Drawable mHintIcon; private Key mSpaceKey; private Key m123Key; private int mSpaceKeyIndex = -1; @@ -69,6 +70,7 @@ public class LatinKeyboard extends BaseKeyboard { private LanguageSwitcher mLanguageSwitcher; private final Resources mRes; private final Context mContext; + private int mMode; // TODO: remove this and use the corresponding mode in the parent class // Whether this keyboard has voice icon on it private boolean mHasVoiceButton; // Whether voice icon is enabled at all @@ -119,6 +121,7 @@ public class LatinKeyboard extends BaseKeyboard { super(context, xmlLayoutResId, mode); final Resources res = context.getResources(); mContext = context; + mMode = mode; mRes = res; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); @@ -133,6 +136,7 @@ public class LatinKeyboard extends BaseKeyboard { mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right); m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic); m123MicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic); + mHintIcon = res.getDrawable(R.drawable.hint_popup); setDefaultBounds(m123MicPreviewIcon); sSpacebarVerticalCorrection = res.getDimensionPixelOffset( R.dimen.spacebar_vertical_correction); @@ -180,10 +184,12 @@ public class LatinKeyboard extends BaseKeyboard { key.text = null; key.iconPreview = null; key.icon = null; + key.hintIcon = null; key.label = label; } public void setImeOptions(Resources res, int mode, int options) { + mMode = mode; if (mEnterKey == null) return; switch (options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { @@ -292,7 +298,7 @@ public class LatinKeyboard extends BaseKeyboard { mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic); m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic); } - updateF1Key(); + updateDynamicKeys(); if (mSpaceKey != null) { updateSpaceBarForLocale(isAutoCompletion, isBlack); } @@ -301,11 +307,16 @@ public class LatinKeyboard extends BaseKeyboard { public void setVoiceMode(boolean hasVoiceButton, boolean hasVoice) { mHasVoiceButton = hasVoiceButton; mVoiceEnabled = hasVoice; + updateDynamicKeys(); + } + + private void updateDynamicKeys() { + update123Key(); updateF1Key(); } - private void updateF1Key() { - if (mF1Key == null) return; + private void update123Key() { + // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode. if (m123Key != null && mIsAlphaKeyboard) { if (mVoiceEnabled && !mHasVoiceButton) { m123Key.icon = m123MicIcon; @@ -317,22 +328,52 @@ public class LatinKeyboard extends BaseKeyboard { m123Key.label = m123Label; } } + } - if (mHasVoiceButton && mVoiceEnabled) { - mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; - mF1Key.label = null; - mF1Key.icon = mMicIcon; - mF1Key.iconPreview = mMicPreviewIcon; - mF1Key.popupResId = R.xml.popup_mic; - } else { - mF1Key.label = ","; - mF1Key.codes = new int[] { ',' }; - mF1Key.icon = null; - mF1Key.iconPreview = null; - mF1Key.popupResId = R.xml.popup_comma; + private void updateF1Key() { + // Update KEYCODE_F1 key. Please note that some keyboard layouts have no F1 key. + if (mF1Key == null) + return; + + if (mIsAlphaKeyboard) { + if (mMode == KeyboardSwitcher.MODE_URL) { + setNonMicF1Key(mF1Key, "/", R.xml.popup_slash); + } else if (mMode == KeyboardSwitcher.MODE_EMAIL) { + setNonMicF1Key(mF1Key, "@", R.xml.popup_at); + } else { + if (mVoiceEnabled && mHasVoiceButton) { + setMicF1Key(mF1Key); + } else { + setNonMicF1Key(mF1Key, ",", R.xml.popup_comma); + } + } + } else { // Symbols keyboard + if (mVoiceEnabled && mHasVoiceButton) { + setMicF1Key(mF1Key); + } else { + setNonMicF1Key(mF1Key, ",", R.xml.popup_comma); + } } } + private void setMicF1Key(Key key) { + key.label = null; + key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE }; + key.popupResId = R.xml.popup_mic; + key.icon = mMicIcon; + key.hintIcon = mHintIcon; + key.iconPreview = mMicPreviewIcon; + } + + private void setNonMicF1Key(Key key, String label, int popupResId) { + key.label = label; + key.codes = new int[] { label.charAt(0) }; + key.popupResId = popupResId; + key.icon = null; + key.hintIcon = mHintIcon; + key.iconPreview = null; + } + /** * @return a key which should be invalidated. */ diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index b02780bf6..4e264e853 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -57,6 +57,8 @@ import java.util.WeakHashMap; * A view that renders a virtual {@link LatinKeyboard}. It handles rendering of keys and * detecting key presses and touch movements. * + * TODO: References to LatinKeyboard in this class should be replaced with ones to its base class. + * * @attr ref R.styleable#LatinKeyboardBaseView_keyBackground * @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewLayout * @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewOffset @@ -160,7 +162,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Miscellaneous constants /* package */ static final int NOT_A_KEY = -1; private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable }; - private static final int NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL = -1; + private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1; // XML attribute private int mKeyTextSize; @@ -861,32 +863,20 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // Turn off drop shadow paint.setShadowLayer(0, 0, 0, 0); } - Drawable icon = null; - if (key.label == null && key.icon != null) - icon = key.icon; - if (icon == null && key.hintIcon != null && drawHintIcon) - icon = key.hintIcon; - if (icon != null) { - // Special handing for the upper-right number hint icons - final int drawableWidth; - final int drawableHeight; - final int drawableX; - final int drawableY; - if (icon == key.hintIcon) { - drawableWidth = key.width; - drawableHeight = key.height; - drawableX = 0; - drawableY = NUMBER_HINT_VERTICAL_ADJUSTMENT_PIXEL; - } else { - drawableWidth = key.icon.getIntrinsicWidth(); - drawableHeight = key.icon.getIntrinsicHeight(); - drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2; - drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2; - } - canvas.translate(drawableX, drawableY); - icon.setBounds(0, 0, drawableWidth, drawableHeight); - icon.draw(canvas); - canvas.translate(-drawableX, -drawableY); + if (key.label == null && key.icon != null) { + int drawableWidth = key.icon.getIntrinsicWidth(); + int drawableHeight = key.icon.getIntrinsicHeight(); + int drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2; + int drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2; + drawIcon(canvas, key.icon, drawableX, drawableY, drawableWidth, drawableHeight); + + } + if (key.hintIcon != null && drawHintIcon) { + int drawableWidth = key.width; + int drawableHeight = key.height; + int drawableX = 0; + int drawableY = HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL; + drawIcon(canvas, key.hintIcon, drawableX, drawableY, drawableWidth, drawableHeight); } canvas.translate(-key.x - kbdPaddingLeft, -key.y - kbdPaddingTop); } @@ -920,6 +910,13 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mDirtyRect.setEmpty(); } + private void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width, int height) { + canvas.translate(x, y); + icon.setBounds(0, 0, width, height); + icon.draw(canvas); + canvas.translate(-x, -y); + } + public void setForeground(boolean foreground) { mInForeground = foreground; } @@ -962,8 +959,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // WindowManager.BadTokenException. if (key == null || !mInForeground) return; - // Should not draw number hint icons - if (key.icon != null && key.label == null) { + if (key.icon != null) { mPreviewText.setCompoundDrawables(null, null, null, key.iconPreview != null ? key.iconPreview : key.icon); mPreviewText.setText(null); -- cgit v1.2.3-83-g751a From bf77bb7678c1129e291fb743c96f684821f1890d Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 21 Oct 2010 17:20:51 +0900 Subject: Refactor BaseKeyboard parsing code Change-Id: I241125b5b15c9d6bbba456476f1f4fd3ef9db3f2 --- .../android/inputmethod/latin/BaseKeyboard.java | 357 +++++++++++---------- 1 file changed, 193 insertions(+), 164 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index fc35ccc5d..0f42f6234 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -57,14 +57,6 @@ public class BaseKeyboard { static final String TAG = "BaseKeyboard"; - // Keyboard XML Tags - private static final String TAG_KEYBOARD = "Keyboard"; - private static final String TAG_ROW = "Row"; - private static final String TAG_KEY = "Key"; - private static final String TAG_SPACER = "Spacer"; - private static final String TAG_INCLUDE = "include"; - private static final String TAG_MERGE = "merge"; - public static final int EDGE_LEFT = 0x01; public static final int EDGE_RIGHT = 0x02; public static final int EDGE_TOP = 0x04; @@ -161,16 +153,16 @@ public class BaseKeyboard { this.parent = parent; TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); - defaultWidth = getDimensionOrFraction(a, + defaultWidth = BaseKeyboardParser.getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyWidth, parent.mDisplayWidth, parent.mDefaultWidth); - defaultHeight = getDimensionOrFraction(a, + defaultHeight = BaseKeyboardParser.getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyHeight, parent.mDisplayHeight, parent.mDefaultHeight); - defaultHorizontalGap = getDimensionOrFraction(a, + defaultHorizontalGap = BaseKeyboardParser.getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, parent.mDisplayWidth, parent.mDefaultHorizontalGap); - verticalGap = getDimensionOrFraction(a, + verticalGap = BaseKeyboardParser.getDimensionOrFraction(a, R.styleable.BaseKeyboard_verticalGap, parent.mDisplayHeight, parent.mDefaultVerticalGap); a.recycle(); @@ -293,11 +285,14 @@ public class BaseKeyboard { TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); - height = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyHeight, + height = BaseKeyboardParser.getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, keyboard.mDisplayHeight, parent.defaultHeight); - gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, + gap = BaseKeyboardParser.getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, keyboard.mDisplayWidth, parent.defaultHorizontalGap); - width = getDimensionOrFraction(a, R.styleable.BaseKeyboard_keyWidth, + width = BaseKeyboardParser.getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, keyboard.mDisplayWidth, parent.defaultWidth) - gap; a.recycle(); a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard_Key); @@ -388,9 +383,9 @@ public class BaseKeyboard { * Detects if a point falls inside this key. * @param x the x-coordinate of the point * @param y the y-coordinate of the point - * @return whether or not the point falls inside the key. If the key is attached to an edge, - * it will assume that all points between the key and the edge are considered to be inside - * the key. + * @return whether or not the point falls inside the key. If the key is attached to an + * edge, it will assume that all points between the key and the edge are considered to be + * inside the key. */ public boolean isInside(int x, int y) { boolean leftEdge = (edgeFlags & EDGE_LEFT) > 0; @@ -476,11 +471,11 @@ public class BaseKeyboard { mDisplayHeight = height; mDefaultHorizontalGap = 0; - mDefaultWidth = mDisplayWidth / 10; + setKeyWidth(mDisplayWidth / 10); mDefaultVerticalGap = 0; mDefaultHeight = mDefaultWidth; mKeyboardMode = modeId; - loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); + loadKeyboard(context, xmlLayoutResId); } /** @@ -497,11 +492,11 @@ public class BaseKeyboard { //Log.v(TAG, "keyboard's display metrics:" + dm); mDefaultHorizontalGap = 0; - mDefaultWidth = mDisplayWidth / 10; + setKeyWidth(mDisplayWidth / 10); mDefaultVerticalGap = 0; mDefaultHeight = mDefaultWidth; mKeyboardMode = modeId; - loadKeyboard(context, context.getResources().getXml(xmlLayoutResId)); + loadKeyboard(context, xmlLayoutResId); } /** @@ -590,6 +585,8 @@ public class BaseKeyboard { protected void setKeyWidth(int width) { mDefaultWidth = width; + final int threshold = (int) (width * SEARCH_DISTANCE); + mProximityThreshold = threshold * threshold; } /** @@ -604,6 +601,18 @@ public class BaseKeyboard { return mTotalWidth; } + public int getKeyboardHeight() { + return mDisplayHeight; + } + + public int getKeyboardWidth() { + return mDisplayWidth; + } + + public int getKeyboardMode() { + return mKeyboardMode; + } + public boolean setShifted(boolean shiftState) { for (final Key key : mShiftKeys) { key.on = shiftState; @@ -636,11 +645,12 @@ public class BaseKeyboard { int count = 0; for (int i = 0; i < mKeys.size(); i++) { final Key key = mKeys.get(i); - if (key.squaredDistanceFrom(x, y) < mProximityThreshold || - key.squaredDistanceFrom(x + mCellWidth - 1, y) < mProximityThreshold || + final int threshold = mProximityThreshold; + if (key.squaredDistanceFrom(x, y) < threshold || + key.squaredDistanceFrom(x + mCellWidth - 1, y) < threshold || key.squaredDistanceFrom(x + mCellWidth - 1, y + mCellHeight - 1) - < mProximityThreshold || - key.squaredDistanceFrom(x, y + mCellHeight - 1) < mProximityThreshold) { + < threshold || + key.squaredDistanceFrom(x, y + mCellHeight - 1) < threshold) { indices[count++] = i; } } @@ -670,26 +680,41 @@ public class BaseKeyboard { } // TODO should be private - protected Row createRowFromXml(Resources res, XmlResourceParser parser) { - return new Row(res, this, parser); + protected BaseKeyboard.Row createRowFromXml(Resources res, XmlResourceParser parser) { + return new BaseKeyboard.Row(res, this, parser); } // TODO should be private - protected Key createKeyFromXml(Resources res, Row parent, int x, int y, + protected BaseKeyboard.Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResourceParser parser) { - return new Key(res, parent, x, y, parser); + return new BaseKeyboard.Key(res, parent, x, y, parser); } - private static class KeyboardParseState { - private final int mKeyboardMode; + private static class BaseKeyboardParser { + // Keyboard XML Tags + private static final String TAG_KEYBOARD = "Keyboard"; + private static final String TAG_ROW = "Row"; + private static final String TAG_KEY = "Key"; + private static final String TAG_SPACER = "Spacer"; + private static final String TAG_INCLUDE = "include"; + private static final String TAG_MERGE = "merge"; + + private final BaseKeyboard mKeyboard; + private final List mKeys; + private final List mShiftKeys; + private final Resources mResources; + private int mCurrentX = 0; private int mCurrentY = 0; private int mMaxRowWidth = 0; private int mTotalHeight = 0; private Row mCurrentRow = null; - public KeyboardParseState(int keyboardMode) { - mKeyboardMode = keyboardMode; + public BaseKeyboardParser(BaseKeyboard keyboard, Resources res) { + mKeyboard = keyboard; + mKeys = keyboard.getKeys(); + mShiftKeys = keyboard.getShiftKeys(); + mResources = res; } public int getX() { @@ -708,7 +733,7 @@ public class BaseKeyboard { public boolean startRow(Row row) { mCurrentX = 0; mCurrentRow = row; - return row.mode == 0 || row.mode == mKeyboardMode; + return row.mode == 0 || row.mode == mKeyboard.getKeyboardMode(); } public void skipRow() { @@ -743,152 +768,156 @@ public class BaseKeyboard { public int getTotalHeight() { return mTotalHeight; } - } - private void loadKeyboard(Context context, XmlResourceParser parser) { - try { - KeyboardParseState state = new KeyboardParseState(mKeyboardMode); - parseKeyboard(context.getResources(), parser, state); - // mTotalWidth is the width of this keyboard which is maximum width of row. - mTotalWidth = state.getMaxRowWidth(); - mTotalHeight = state.getTotalHeight(); - } catch (XmlPullParserException e) { - throw new IllegalArgumentException(e); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private void parseKeyboard(Resources res, XmlResourceParser parser, KeyboardParseState state) - throws XmlPullParserException, IOException { - Key key = null; - - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.START_TAG) { - String tag = parser.getName(); - if (TAG_ROW.equals(tag)) { - // TODO createRowFromXml should not be called from BaseKeyboard constructor. - Row row = createRowFromXml(res, parser); - if (!state.startRow(row)) - skipToEndOfRow(parser, state); - } else if (TAG_KEY.equals(tag)) { - // TODO createKeyFromXml should not be called from BaseKeyboard constructor. - key = createKeyFromXml(res, state.getRow(), state.getX(), state.getY(), - parser); - mKeys.add(key); - if (key.codes[0] == KEYCODE_SHIFT) - mShiftKeys.add(key); - } else if (TAG_SPACER.equals(tag)) { - parseSpacerAttribute(res, parser, state); - } else if (TAG_KEYBOARD.equals(tag)) { - parseKeyboardAttributes(res, parser); - } else if (TAG_INCLUDE.equals(tag)) { - if (parser.getDepth() == 0) - throw new InflateException(" cannot be the root element"); - parseInclude(res, parser, state); - } else if (TAG_MERGE.equals(tag)) { - throw new InflateException(" must not be appeared in keyboard XML file"); - } else { - throw new InflateException("unknown start tag: " + tag); - } - } else if (event == XmlResourceParser.END_TAG) { - String tag = parser.getName(); - if (TAG_KEY.equals(tag)) { - state.endKey(key); - } else if (TAG_ROW.equals(tag)) { - state.endRow(); - } else if (TAG_SPACER.equals(tag)) { - ; - } else if (TAG_KEYBOARD.equals(tag)) { - state.endKeyboard(mDefaultVerticalGap); - } else if (TAG_INCLUDE.equals(tag)) { - ; - } else if (TAG_MERGE.equals(tag)) { - return; - } else { - throw new InflateException("unknown end tag: " + tag); + private void parseKeyboard(XmlResourceParser parser) + throws XmlPullParserException, IOException { + Key key = null; + + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + // TODO createRowFromXml should not be called from + // BaseKeyboard constructor. + Row row = mKeyboard.createRowFromXml(mResources, parser); + if (!startRow(row)) + skipToEndOfRow(parser); + } else if (TAG_KEY.equals(tag)) { + // TODO createKeyFromXml should not be called from + // BaseKeyboard constructor. + key = mKeyboard.createKeyFromXml(mResources, getRow(), getX(), getY(), + parser); + mKeys.add(key); + if (key.codes[0] == KEYCODE_SHIFT) + mShiftKeys.add(key); + } else if (TAG_SPACER.equals(tag)) { + parseSpacerAttribute(parser); + } else if (TAG_KEYBOARD.equals(tag)) { + parseKeyboardAttributes(parser); + } else if (TAG_INCLUDE.equals(tag)) { + if (parser.getDepth() == 0) + throw new InflateException(" cannot be the root element"); + parseInclude(parser); + } else if (TAG_MERGE.equals(tag)) { + throw new InflateException( + " must not be appeared in keyboard XML file"); + } else { + throw new InflateException("unknown start tag: " + tag); + } + } else if (event == XmlResourceParser.END_TAG) { + String tag = parser.getName(); + if (TAG_KEY.equals(tag)) { + endKey(key); + } else if (TAG_ROW.equals(tag)) { + endRow(); + } else if (TAG_SPACER.equals(tag)) { + ; + } else if (TAG_KEYBOARD.equals(tag)) { + endKeyboard(mKeyboard.getVerticalGap()); + } else if (TAG_INCLUDE.equals(tag)) { + ; + } else if (TAG_MERGE.equals(tag)) { + return; + } else { + throw new InflateException("unknown end tag: " + tag); + } } } } - } - private void parseSpacerAttribute(Resources res, XmlResourceParser parser, - KeyboardParseState state) { - TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.BaseKeyboard); - int gap = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_horizontalGap, mDisplayWidth, 0); - a.recycle(); - state.setSpacer(gap); - } + private void parseSpacerAttribute(XmlResourceParser parser) { + TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + int gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, + mKeyboard.getKeyboardWidth(), 0); + a.recycle(); + setSpacer(gap); + } - private void parseInclude(Resources res, XmlResourceParser parent, KeyboardParseState state) - throws XmlPullParserException, IOException { - final TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parent), - R.styleable.BaseKeyboard_Include); - final int keyboardLayout = a.getResourceId( - R.styleable.BaseKeyboard_Include_keyboardLayout, 0); - a.recycle(); - if (keyboardLayout == 0) - throw new InflateException(" must have keyboardLayout attribute"); - final XmlResourceParser parser = res.getLayout(keyboardLayout); - - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.START_TAG) { - String name = parser.getName(); - if (TAG_MERGE.equals(name)) { - parseKeyboard(res, parser, state); - return; - } else { - throw new InflateException( - "include keyboard layout must have root element"); + private void parseInclude(XmlResourceParser parent) + throws XmlPullParserException, IOException { + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parent), + R.styleable.BaseKeyboard_Include); + final int keyboardLayout = a.getResourceId( + R.styleable.BaseKeyboard_Include_keyboardLayout, 0); + a.recycle(); + if (keyboardLayout == 0) + throw new InflateException(" must have keyboardLayout attribute"); + final XmlResourceParser parser = mResources.getLayout(keyboardLayout); + + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String name = parser.getName(); + if (TAG_MERGE.equals(name)) { + parseKeyboard(parser); + return; + } else { + throw new InflateException( + "include keyboard layout must have root element"); + } } } } - } - private void skipToEndOfRow(XmlResourceParser parser, KeyboardParseState state) - throws XmlPullParserException, IOException { - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.END_TAG) { - String tag = parser.getName(); - if (TAG_ROW.equals(tag)) { - state.skipRow(); - return; + private void skipToEndOfRow(XmlResourceParser parser) + throws XmlPullParserException, IOException { + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.END_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + skipRow(); + return; + } } } + throw new InflateException("can not find "); } - throw new InflateException("can not find "); - } - private void parseKeyboardAttributes(Resources res, XmlResourceParser parser) { - TypedArray a = res.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.BaseKeyboard); - mDefaultWidth = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyWidth, mDisplayWidth, mDisplayWidth / 10); - mDefaultHeight = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyHeight, mDisplayHeight, 50); - mDefaultHorizontalGap = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_horizontalGap, mDisplayWidth, 0); - mDefaultVerticalGap = getDimensionOrFraction(a, - R.styleable.BaseKeyboard_verticalGap, mDisplayHeight, 0); - mProximityThreshold = (int) (mDefaultWidth * SEARCH_DISTANCE); - mProximityThreshold = mProximityThreshold * mProximityThreshold; - a.recycle(); + private void parseKeyboardAttributes(XmlResourceParser parser) { + TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + final int width = mKeyboard.getKeyboardWidth(); + final int height = mKeyboard.getKeyboardHeight(); + mKeyboard.setKeyWidth(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, width, width / 10)); + mKeyboard.setKeyHeight(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, height, 50)); + mKeyboard.setHorizontalGap(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, width, 0)); + mKeyboard.setVerticalGap(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_verticalGap, height, 0)); + a.recycle(); + } + + public static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { + TypedValue value = a.peekValue(index); + if (value == null) + return defValue; + if (value.type == TypedValue.TYPE_DIMENSION) { + return a.getDimensionPixelOffset(index, defValue); + } else if (value.type == TypedValue.TYPE_FRACTION) { + // Round it to avoid values like 47.9999 from getting truncated + return Math.round(a.getFraction(index, base, base, defValue)); + } + return defValue; + } } - static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { - TypedValue value = a.peekValue(index); - if (value == null) return defValue; - if (value.type == TypedValue.TYPE_DIMENSION) { - return a.getDimensionPixelOffset(index, defValue); - } else if (value.type == TypedValue.TYPE_FRACTION) { - // Round it to avoid values like 47.9999 from getting truncated - return Math.round(a.getFraction(index, base, base, defValue)); + private void loadKeyboard(Context context, int xmlLayoutResId) { + try { + BaseKeyboardParser parser = new BaseKeyboardParser(this, context.getResources()); + parser.parseKeyboard(context.getResources().getXml(xmlLayoutResId)); + // mTotalWidth is the width of this keyboard which is maximum width of row. + mTotalWidth = parser.getMaxRowWidth(); + mTotalHeight = parser.getTotalHeight(); + } catch (XmlPullParserException e) { + throw new IllegalArgumentException(e); + } catch (IOException e) { + throw new RuntimeException(e); } - return defValue; } protected static void setDefaultBounds(Drawable drawable) { -- cgit v1.2.3-83-g751a From 41338e6c32947d0bb889e0f98c62650b7889e0dd Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 21 Oct 2010 19:05:53 +0900 Subject: Move BaseKeyboardParser to top-level class Bug: 3082538 Change-Id: If0ddf32bc3811e3c65a7a96503c61ed3351eeb66 --- .../android/inputmethod/latin/BaseKeyboard.java | 217 ------------------- .../inputmethod/latin/BaseKeyboardParser.java | 233 +++++++++++++++++++++ 2 files changed, 233 insertions(+), 217 deletions(-) create mode 100644 java/src/com/android/inputmethod/latin/BaseKeyboardParser.java (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index 0f42f6234..517bfbfda 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -28,7 +28,6 @@ import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.util.Xml; -import android.view.InflateException; import java.io.IOException; import java.util.ArrayList; @@ -690,222 +689,6 @@ public class BaseKeyboard { return new BaseKeyboard.Key(res, parent, x, y, parser); } - private static class BaseKeyboardParser { - // Keyboard XML Tags - private static final String TAG_KEYBOARD = "Keyboard"; - private static final String TAG_ROW = "Row"; - private static final String TAG_KEY = "Key"; - private static final String TAG_SPACER = "Spacer"; - private static final String TAG_INCLUDE = "include"; - private static final String TAG_MERGE = "merge"; - - private final BaseKeyboard mKeyboard; - private final List mKeys; - private final List mShiftKeys; - private final Resources mResources; - - private int mCurrentX = 0; - private int mCurrentY = 0; - private int mMaxRowWidth = 0; - private int mTotalHeight = 0; - private Row mCurrentRow = null; - - public BaseKeyboardParser(BaseKeyboard keyboard, Resources res) { - mKeyboard = keyboard; - mKeys = keyboard.getKeys(); - mShiftKeys = keyboard.getShiftKeys(); - mResources = res; - } - - public int getX() { - return mCurrentX; - } - - public int getY() { - return mCurrentY; - } - - public Row getRow() { - return mCurrentRow; - } - - // return true if the row is valid for this keyboard mode - public boolean startRow(Row row) { - mCurrentX = 0; - mCurrentRow = row; - return row.mode == 0 || row.mode == mKeyboard.getKeyboardMode(); - } - - public void skipRow() { - mCurrentRow = null; - } - - public void endRow() { - if (mCurrentRow == null) - throw new InflateException("orphant end row tag"); - mCurrentY += mCurrentRow.verticalGap + mCurrentRow.defaultHeight; - mCurrentRow = null; - } - - public void endKey(Key key) { - mCurrentX += key.gap + key.width; - if (mCurrentX > mMaxRowWidth) - mMaxRowWidth = mCurrentX; - } - - public void endKeyboard(int defaultVerticalGap) { - mTotalHeight = mCurrentY - defaultVerticalGap; - } - - public void setSpacer(int gap) { - mCurrentX += gap; - } - - public int getMaxRowWidth() { - return mMaxRowWidth; - } - - public int getTotalHeight() { - return mTotalHeight; - } - - private void parseKeyboard(XmlResourceParser parser) - throws XmlPullParserException, IOException { - Key key = null; - - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.START_TAG) { - String tag = parser.getName(); - if (TAG_ROW.equals(tag)) { - // TODO createRowFromXml should not be called from - // BaseKeyboard constructor. - Row row = mKeyboard.createRowFromXml(mResources, parser); - if (!startRow(row)) - skipToEndOfRow(parser); - } else if (TAG_KEY.equals(tag)) { - // TODO createKeyFromXml should not be called from - // BaseKeyboard constructor. - key = mKeyboard.createKeyFromXml(mResources, getRow(), getX(), getY(), - parser); - mKeys.add(key); - if (key.codes[0] == KEYCODE_SHIFT) - mShiftKeys.add(key); - } else if (TAG_SPACER.equals(tag)) { - parseSpacerAttribute(parser); - } else if (TAG_KEYBOARD.equals(tag)) { - parseKeyboardAttributes(parser); - } else if (TAG_INCLUDE.equals(tag)) { - if (parser.getDepth() == 0) - throw new InflateException(" cannot be the root element"); - parseInclude(parser); - } else if (TAG_MERGE.equals(tag)) { - throw new InflateException( - " must not be appeared in keyboard XML file"); - } else { - throw new InflateException("unknown start tag: " + tag); - } - } else if (event == XmlResourceParser.END_TAG) { - String tag = parser.getName(); - if (TAG_KEY.equals(tag)) { - endKey(key); - } else if (TAG_ROW.equals(tag)) { - endRow(); - } else if (TAG_SPACER.equals(tag)) { - ; - } else if (TAG_KEYBOARD.equals(tag)) { - endKeyboard(mKeyboard.getVerticalGap()); - } else if (TAG_INCLUDE.equals(tag)) { - ; - } else if (TAG_MERGE.equals(tag)) { - return; - } else { - throw new InflateException("unknown end tag: " + tag); - } - } - } - } - - private void parseSpacerAttribute(XmlResourceParser parser) { - TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.BaseKeyboard); - int gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, - mKeyboard.getKeyboardWidth(), 0); - a.recycle(); - setSpacer(gap); - } - - private void parseInclude(XmlResourceParser parent) - throws XmlPullParserException, IOException { - final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parent), - R.styleable.BaseKeyboard_Include); - final int keyboardLayout = a.getResourceId( - R.styleable.BaseKeyboard_Include_keyboardLayout, 0); - a.recycle(); - if (keyboardLayout == 0) - throw new InflateException(" must have keyboardLayout attribute"); - final XmlResourceParser parser = mResources.getLayout(keyboardLayout); - - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.START_TAG) { - String name = parser.getName(); - if (TAG_MERGE.equals(name)) { - parseKeyboard(parser); - return; - } else { - throw new InflateException( - "include keyboard layout must have root element"); - } - } - } - } - - private void skipToEndOfRow(XmlResourceParser parser) - throws XmlPullParserException, IOException { - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.END_TAG) { - String tag = parser.getName(); - if (TAG_ROW.equals(tag)) { - skipRow(); - return; - } - } - } - throw new InflateException("can not find "); - } - - private void parseKeyboardAttributes(XmlResourceParser parser) { - TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.BaseKeyboard); - final int width = mKeyboard.getKeyboardWidth(); - final int height = mKeyboard.getKeyboardHeight(); - mKeyboard.setKeyWidth(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyWidth, width, width / 10)); - mKeyboard.setKeyHeight(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyHeight, height, 50)); - mKeyboard.setHorizontalGap(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_horizontalGap, width, 0)); - mKeyboard.setVerticalGap(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_verticalGap, height, 0)); - a.recycle(); - } - - public static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { - TypedValue value = a.peekValue(index); - if (value == null) - return defValue; - if (value.type == TypedValue.TYPE_DIMENSION) { - return a.getDimensionPixelOffset(index, defValue); - } else if (value.type == TypedValue.TYPE_FRACTION) { - // Round it to avoid values like 47.9999 from getting truncated - return Math.round(a.getFraction(index, base, base, defValue)); - } - return defValue; - } - } - private void loadKeyboard(Context context, int xmlLayoutResId) { try { BaseKeyboardParser parser = new BaseKeyboardParser(this, context.getResources()); diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java b/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java new file mode 100644 index 000000000..b718c14be --- /dev/null +++ b/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2010 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.android.inputmethod.latin; + +import com.android.inputmethod.latin.BaseKeyboard.Key; +import com.android.inputmethod.latin.BaseKeyboard.Row; + +import org.xmlpull.v1.XmlPullParserException; + +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.content.res.XmlResourceParser; +import android.util.TypedValue; +import android.util.Xml; +import android.view.InflateException; + +import java.io.IOException; + +public class BaseKeyboardParser { + // Keyboard XML Tags + private static final String TAG_KEYBOARD = "Keyboard"; + private static final String TAG_ROW = "Row"; + private static final String TAG_KEY = "Key"; + private static final String TAG_SPACER = "Spacer"; + private static final String TAG_INCLUDE = "include"; + private static final String TAG_MERGE = "merge"; + + private final BaseKeyboard mKeyboard; + private final Resources mResources; + + private int mCurrentX = 0; + private int mCurrentY = 0; + private int mMaxRowWidth = 0; + private int mTotalHeight = 0; + private Row mCurrentRow = null; + + public BaseKeyboardParser(BaseKeyboard keyboard, Resources res) { + mKeyboard = keyboard; + mResources = res; + } + + public int getMaxRowWidth() { + return mMaxRowWidth; + } + + public int getTotalHeight() { + return mTotalHeight; + } + + public void parseKeyboard(XmlResourceParser parser) + throws XmlPullParserException, IOException { + final BaseKeyboard keyboard = mKeyboard; + Key key = null; + + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + // TODO createRowFromXml should not be called from + // BaseKeyboard constructor. + Row row = keyboard.createRowFromXml(mResources, parser); + if (!startRow(row)) + skipToEndOfRow(parser); + } else if (TAG_KEY.equals(tag)) { + // TODO createKeyFromXml should not be called from + // BaseKeyboard constructor. + key = keyboard.createKeyFromXml(mResources, mCurrentRow, mCurrentX, mCurrentY, + parser); + keyboard.getKeys().add(key); + if (key.codes[0] == BaseKeyboard.KEYCODE_SHIFT) + keyboard.getShiftKeys().add(key); + } else if (TAG_SPACER.equals(tag)) { + parseSpacerAttribute(parser); + } else if (TAG_KEYBOARD.equals(tag)) { + parseKeyboardAttributes(parser); + } else if (TAG_INCLUDE.equals(tag)) { + if (parser.getDepth() == 0) + throw new InflateException(" cannot be the root element"); + parseInclude(parser); + } else if (TAG_MERGE.equals(tag)) { + throw new InflateException( + " must not be appeared in keyboard XML file"); + } else { + throw new InflateException("unknown start tag: " + tag); + } + } else if (event == XmlResourceParser.END_TAG) { + String tag = parser.getName(); + if (TAG_KEY.equals(tag)) { + endKey(key); + } else if (TAG_ROW.equals(tag)) { + endRow(); + } else if (TAG_SPACER.equals(tag)) { + ; + } else if (TAG_KEYBOARD.equals(tag)) { + endKeyboard(mKeyboard.getVerticalGap()); + } else if (TAG_INCLUDE.equals(tag)) { + ; + } else if (TAG_MERGE.equals(tag)) { + return; + } else { + throw new InflateException("unknown end tag: " + tag); + } + } + } + } + + // return true if the row is valid for this keyboard mode + private boolean startRow(Row row) { + mCurrentX = 0; + mCurrentRow = row; + return row.mode == 0 || row.mode == mKeyboard.getKeyboardMode(); + } + + private void skipRow() { + mCurrentRow = null; + } + + private void endRow() { + if (mCurrentRow == null) + throw new InflateException("orphant end row tag"); + mCurrentY += mCurrentRow.verticalGap + mCurrentRow.defaultHeight; + mCurrentRow = null; + } + + private void endKey(Key key) { + mCurrentX += key.gap + key.width; + if (mCurrentX > mMaxRowWidth) + mMaxRowWidth = mCurrentX; + } + + private void endKeyboard(int defaultVerticalGap) { + mTotalHeight = mCurrentY - defaultVerticalGap; + } + + private void setSpacer(int gap) { + mCurrentX += gap; + } + + private void parseSpacerAttribute(XmlResourceParser parser) { + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + int gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, + mKeyboard.getKeyboardWidth(), 0); + a.recycle(); + setSpacer(gap); + } + + private void parseInclude(XmlResourceParser parent) + throws XmlPullParserException, IOException { + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parent), + R.styleable.BaseKeyboard_Include); + final int keyboardLayout = a.getResourceId( + R.styleable.BaseKeyboard_Include_keyboardLayout, 0); + a.recycle(); + if (keyboardLayout == 0) + throw new InflateException(" must have keyboardLayout attribute"); + final XmlResourceParser parser = mResources.getLayout(keyboardLayout); + + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + String name = parser.getName(); + if (TAG_MERGE.equals(name)) { + parseKeyboard(parser); + return; + } else { + throw new InflateException( + "include keyboard layout must have root element"); + } + } + } + } + + private void skipToEndOfRow(XmlResourceParser parser) + throws XmlPullParserException, IOException { + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.END_TAG) { + String tag = parser.getName(); + if (TAG_ROW.equals(tag)) { + skipRow(); + return; + } + } + } + throw new InflateException("can not find "); + } + + private void parseKeyboardAttributes(XmlResourceParser parser) { + final BaseKeyboard keyboard = mKeyboard; + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + final int width = keyboard.getKeyboardWidth(); + final int height = keyboard.getKeyboardHeight(); + keyboard.setKeyWidth(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, width, width / 10)); + keyboard.setKeyHeight(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, height, 50)); + keyboard.setHorizontalGap(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, width, 0)); + keyboard.setVerticalGap(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_verticalGap, height, 0)); + a.recycle(); + } + + public static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { + final TypedValue value = a.peekValue(index); + if (value == null) + return defValue; + if (value.type == TypedValue.TYPE_DIMENSION) { + return a.getDimensionPixelOffset(index, defValue); + } else if (value.type == TypedValue.TYPE_FRACTION) { + // Round it to avoid values like 47.9999 from getting truncated + return Math.round(a.getFraction(index, base, base, defValue)); + } + return defValue; + } +} -- cgit v1.2.3-83-g751a From 503797ae0e55c74068470d237fb47c4da13ec4fb Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 22 Oct 2010 14:28:12 +0900 Subject: Make "show settings key option" dependent to device configuration Bug: 3095814 Change-Id: I73b8a5023b398621a910c953eade252dc6412923 --- java/res/values-xlarge/bools.xml | 1 + java/res/values/bools.xml | 1 + .../com/android/inputmethod/latin/KeyboardSwitcher.java | 15 +++++++++------ .../com/android/inputmethod/latin/LatinIMESettings.java | 5 +++++ 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'java/src') diff --git a/java/res/values-xlarge/bools.xml b/java/res/values-xlarge/bools.xml index fe8fc5838..66cfd9d79 100644 --- a/java/res/values-xlarge/bools.xml +++ b/java/res/values-xlarge/bools.xml @@ -20,4 +20,5 @@ false + false diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml index 5a24e4c60..64d05bd17 100644 --- a/java/res/values/bools.xml +++ b/java/res/values/bools.xml @@ -30,4 +30,5 @@ true true true + true diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index ec422174d..3a54904d3 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -160,11 +160,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha // Indicates whether or not we have the settings key private boolean mHasSettingsKey; private static final int SETTINGS_KEY_MODE_AUTO = R.string.settings_key_mode_auto; - private static final int SETTINGS_KEY_MODE_ALWAYS_SHOW = R.string.settings_key_mode_always_show; - // NOTE: No need to have SETTINGS_KEY_MODE_ALWAYS_HIDE here because it's not being referred to - // in the source code now. - // Default is SETTINGS_KEY_MODE_AUTO. - private static final int DEFAULT_SETTINGS_KEY_MODE = SETTINGS_KEY_MODE_AUTO; + private static final int SETTINGS_KEY_MODE_ALWAYS_SHOW = + R.string.settings_key_mode_always_show; + private static final int SETTINGS_KEY_MODE_ALWAYS_HIDE = + R.string.settings_key_mode_always_hide; private int mLastDisplayWidth; private LanguageSwitcher mLanguageSwitcher; @@ -543,8 +542,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private void updateSettingsKeyState(SharedPreferences prefs) { Resources resources = mInputMethodService.getResources(); + final boolean showSettingsKeyOption = resources.getBoolean( + R.bool.config_enable_show_settings_key_option); + final int defaultSettingsKeyMode = showSettingsKeyOption + ? SETTINGS_KEY_MODE_AUTO : SETTINGS_KEY_MODE_ALWAYS_HIDE; final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY, - resources.getString(DEFAULT_SETTINGS_KEY_MODE)); + resources.getString(defaultSettingsKeyMode)); // We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or // 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW)) diff --git a/java/src/com/android/inputmethod/latin/LatinIMESettings.java b/java/src/com/android/inputmethod/latin/LatinIMESettings.java index 99d8a622e..4f20e9b10 100644 --- a/java/src/com/android/inputmethod/latin/LatinIMESettings.java +++ b/java/src/com/android/inputmethod/latin/LatinIMESettings.java @@ -96,6 +96,11 @@ public class LatinIMESettings extends PreferenceActivity mAutoCompletionThreshold = (ListPreference) findPreference(PREF_AUTO_COMPLETION_THRESHOLD); mBigramSuggestion = (CheckBoxPreference) findPreference(PREF_BIGRAM_SUGGESTIONS); ensureConsistencyOfAutoCompletionSettings(); + + final boolean showSettingsKeyOption = getResources().getBoolean( + R.bool.config_enable_show_settings_key_option); + if (!showSettingsKeyOption) + getPreferenceScreen().removePreference(mSettingsKeyPreference); } @Override -- cgit v1.2.3-83-g751a From 4f6060b8b77989d88f22f8020ec0d8f1db1dc2a9 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 22 Oct 2010 17:19:17 +0900 Subject: Table keyboard should always show return icon on enter key Bug: 3122750 Change-Id: I75d2b5adff3a349d29d8a56e7b761c26b04683c0 --- java/res/values-xlarge/bools.xml | 1 + java/res/values/bools.xml | 1 + .../android/inputmethod/latin/LatinKeyboard.java | 54 ++++++++++++---------- 3 files changed, 31 insertions(+), 25 deletions(-) (limited to 'java/src') diff --git a/java/res/values-xlarge/bools.xml b/java/res/values-xlarge/bools.xml index 66cfd9d79..3079133dd 100644 --- a/java/res/values-xlarge/bools.xml +++ b/java/res/values-xlarge/bools.xml @@ -21,4 +21,5 @@ false false + false diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml index 64d05bd17..5d932a693 100644 --- a/java/res/values/bools.xml +++ b/java/res/values/bools.xml @@ -31,4 +31,5 @@ true true true + true diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index fcbada191..8e16feb5e 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -192,31 +192,35 @@ public class LatinKeyboard extends BaseKeyboard { mMode = mode; if (mEnterKey == null) return; - switch (options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { - case EditorInfo.IME_ACTION_GO: - resetKeyAttributes(mEnterKey, res.getText(R.string.label_go_key)); - break; - case EditorInfo.IME_ACTION_NEXT: - resetKeyAttributes(mEnterKey, res.getText(R.string.label_next_key)); - break; - case EditorInfo.IME_ACTION_DONE: - resetKeyAttributes(mEnterKey, res.getText(R.string.label_done_key)); - break; - case EditorInfo.IME_ACTION_SEARCH: - resetKeyAttributes(mEnterKey, null); - mEnterKey.iconPreview = res.getDrawable(R.drawable.sym_keyboard_feedback_search); - mEnterKey.icon = res.getDrawable(mIsBlackSym ? R.drawable.sym_bkeyboard_search - : R.drawable.sym_keyboard_search); - break; - case EditorInfo.IME_ACTION_SEND: - resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key)); - break; - default: - resetKeyAttributes(mEnterKey, mDefaultEnterLabel); - mEnterKey.text = mDefaultEnterText; - mEnterKey.icon = mDefaultEnterIcon; - mEnterKey.iconPreview = mDefaultEnterPreview; - break; + final boolean configDynamicKeyToEnterKey = res.getBoolean( + R.bool.config_dynamic_key_top_enter_key); + if (configDynamicKeyToEnterKey) { + switch (options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { + case EditorInfo.IME_ACTION_GO: + resetKeyAttributes(mEnterKey, res.getText(R.string.label_go_key)); + break; + case EditorInfo.IME_ACTION_NEXT: + resetKeyAttributes(mEnterKey, res.getText(R.string.label_next_key)); + break; + case EditorInfo.IME_ACTION_DONE: + resetKeyAttributes(mEnterKey, res.getText(R.string.label_done_key)); + break; + case EditorInfo.IME_ACTION_SEARCH: + resetKeyAttributes(mEnterKey, null); + mEnterKey.iconPreview = res.getDrawable(R.drawable.sym_keyboard_feedback_search); + mEnterKey.icon = res.getDrawable(mIsBlackSym ? R.drawable.sym_bkeyboard_search + : R.drawable.sym_keyboard_search); + break; + case EditorInfo.IME_ACTION_SEND: + resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key)); + break; + default: + resetKeyAttributes(mEnterKey, mDefaultEnterLabel); + mEnterKey.text = mDefaultEnterText; + mEnterKey.icon = mDefaultEnterIcon; + mEnterKey.iconPreview = mDefaultEnterPreview; + break; + } } // Set the initial size of the preview icon setDefaultBounds(mEnterKey.iconPreview); -- cgit v1.2.3-83-g751a From 0b1cb2d039466acaeb5f1f180cf2fc60b5482b1e Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 22 Oct 2010 01:24:23 +0900 Subject: Refactor BaseKeyboardParser as Recursive Descendent Parser Bug: 3082538 Change-Id: Ic0d72c6fe08cfc20db86aeffb10a27efe678095e --- .../android/inputmethod/latin/BaseKeyboard.java | 10 +- .../inputmethod/latin/BaseKeyboardParser.java | 385 +++++++++++++++------ 2 files changed, 281 insertions(+), 114 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index 517bfbfda..cb41ad047 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -121,7 +121,7 @@ public class BaseKeyboard { /** * Container for keys in the keyboard. All keys in a row are at the same Y-coordinate. - * Some of the key size defaults can be overridden per row from what the {@link Keyboard} + * Some of the key size defaults can be overridden per row from what the {@link BaseKeyboard} * defines. */ public static class Row { @@ -135,7 +135,7 @@ public class BaseKeyboard { public int verticalGap; /** * Edge flags for this row of keys. Possible values that can be assigned are - * {@link Keyboard#EDGE_TOP EDGE_TOP} and {@link Keyboard#EDGE_BOTTOM EDGE_BOTTOM} + * {@link BaseKeyboard#EDGE_TOP EDGE_TOP} and {@link BaseKeyboard#EDGE_BOTTOM EDGE_BOTTOM} */ public int rowEdgeFlags; @@ -217,8 +217,8 @@ public class BaseKeyboard { /** * Flags that specify the anchoring to edges of the keyboard for detecting touch events * that are just out of the boundary of the key. This is a bit mask of - * {@link Keyboard#EDGE_LEFT}, {@link Keyboard#EDGE_RIGHT}, {@link Keyboard#EDGE_TOP} and - * {@link Keyboard#EDGE_BOTTOM}. + * {@link BaseKeyboard#EDGE_LEFT}, {@link BaseKeyboard#EDGE_RIGHT}, + * {@link BaseKeyboard#EDGE_TOP} and {@link BaseKeyboard#EDGE_BOTTOM}. */ public int edgeFlags; /** Whether this is a modifier key, such as Shift or Alt */ @@ -274,7 +274,7 @@ public class BaseKeyboard { * the XML parser. * @param res resources associated with the caller's context * @param parent the row that this key belongs to. The row must already be attached to - * a {@link Keyboard}. + * a {@link BaseKeyboard}. * @param x the x coordinate of the top-left * @param y the y coordinate of the top-left * @param parser the XML parser containing the attributes for this key diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java b/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java index b718c14be..628e764b5 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboardParser.java @@ -24,13 +24,58 @@ import org.xmlpull.v1.XmlPullParserException; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; +import android.util.Log; import android.util.TypedValue; import android.util.Xml; import android.view.InflateException; import java.io.IOException; +import java.util.List; +/** + * Parser for BaseKeyboard. + * + * This class parses Keyboard XML file and fill out keys in BaseKeyboard. + * The Keyboard XML file looks like: + *
+ *   >!-- xml/keyboard.xml --<
+ *   >Keyboard keyboard_attributes*<
+ *     >!-- Keyboard Content --<
+ *     >Row row_attributes*<
+ *       >!-- Row Content --<
+ *       >Key key_attributes* /<
+ *       >Spacer horizontalGap="0.2in" /<
+ *       >include keyboardLayout="@xml/other_keys"<
+ *       ...
+ *     >/Row<
+ *     >include keyboardLayout="@xml/other_rows"<
+ *     ...
+ *   >/Keyboard<
+ * 
+ * The xml file which is included in other file must have >merge< as root element, such as: + *
+ *   >!-- xml/other_keys.xml --<
+ *   >merge<
+ *     >Key key_attributes* /<
+ *     ...
+ *   >/merge<
+ * 
+ * and + *
+ *   >!-- xml/other_rows.xml --<
+ *   >merge<
+ *     >Row row_attributes*<
+ *       >Key key_attributes* /<
+ *     >/Row<
+ *     ...
+ *   >/merge<
+ * 
+ */ public class BaseKeyboardParser { + private static final String TAG = "BaseKeyboardParser"; + private static final boolean DEBUG_TAG = false; + private static final boolean DEBUG_PARSER = false; + // Keyboard XML Tags private static final String TAG_KEYBOARD = "Keyboard"; private static final String TAG_ROW = "Row"; @@ -63,159 +108,237 @@ public class BaseKeyboardParser { public void parseKeyboard(XmlResourceParser parser) throws XmlPullParserException, IOException { + if (DEBUG_PARSER) debugEnterMethod("parseKeyboard", false); + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + final String tag = parser.getName(); + if (DEBUG_TAG) debugStartTag("parseKeyboard", tag, false); + if (TAG_KEYBOARD.equals(tag)) { + parseKeyboardAttributes(parser); + parseKeyboardContent(parser, mKeyboard.getKeys()); + break; + } else { + throw new IllegalStartTag(parser, TAG_KEYBOARD); + } + } + } + if (DEBUG_PARSER) debugLeaveMethod("parseKeyboard", false); + } + + private void parseKeyboardAttributes(XmlResourceParser parser) { final BaseKeyboard keyboard = mKeyboard; - Key key = null; + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + final int width = keyboard.getKeyboardWidth(); + final int height = keyboard.getKeyboardHeight(); + keyboard.setKeyWidth(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyWidth, width, width / 10)); + keyboard.setKeyHeight(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_keyHeight, height, 50)); + keyboard.setHorizontalGap(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_horizontalGap, width, 0)); + keyboard.setVerticalGap(getDimensionOrFraction(a, + R.styleable.BaseKeyboard_verticalGap, height, 0)); + a.recycle(); + } + private void parseKeyboardContent(XmlResourceParser parser, final List keys) + throws XmlPullParserException, IOException { + if (DEBUG_PARSER) debugEnterMethod("parseKeyboardContent", keys == null); int event; while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { if (event == XmlResourceParser.START_TAG) { - String tag = parser.getName(); + final String tag = parser.getName(); + if (DEBUG_TAG) debugStartTag("parseKeyboardContent", tag, keys == null); if (TAG_ROW.equals(tag)) { - // TODO createRowFromXml should not be called from - // BaseKeyboard constructor. - Row row = keyboard.createRowFromXml(mResources, parser); - if (!startRow(row)) - skipToEndOfRow(parser); - } else if (TAG_KEY.equals(tag)) { - // TODO createKeyFromXml should not be called from - // BaseKeyboard constructor. - key = keyboard.createKeyFromXml(mResources, mCurrentRow, mCurrentX, mCurrentY, - parser); - keyboard.getKeys().add(key); - if (key.codes[0] == BaseKeyboard.KEYCODE_SHIFT) - keyboard.getShiftKeys().add(key); - } else if (TAG_SPACER.equals(tag)) { - parseSpacerAttribute(parser); - } else if (TAG_KEYBOARD.equals(tag)) { - parseKeyboardAttributes(parser); + Row row = mKeyboard.createRowFromXml(mResources, parser); + if (keys != null && maybeStartRow(row)) { + parseRowContent(parser, row, keys); + } else { + // Skip entire + parseRowContent(parser, row, null); + } } else if (TAG_INCLUDE.equals(tag)) { - if (parser.getDepth() == 0) - throw new InflateException(" cannot be the root element"); - parseInclude(parser); - } else if (TAG_MERGE.equals(tag)) { - throw new InflateException( - " must not be appeared in keyboard XML file"); + parseIncludeKeyboardContent(parser, keys); } else { - throw new InflateException("unknown start tag: " + tag); + throw new IllegalStartTag(parser, TAG_ROW); } } else if (event == XmlResourceParser.END_TAG) { - String tag = parser.getName(); - if (TAG_KEY.equals(tag)) { - endKey(key); - } else if (TAG_ROW.equals(tag)) { - endRow(); - } else if (TAG_SPACER.equals(tag)) { - ; - } else if (TAG_KEYBOARD.equals(tag)) { + final String tag = parser.getName(); + if (DEBUG_TAG) debugEndTag("parseKeyboardContent", tag, keys == null); + if (TAG_KEYBOARD.equals(tag)) { endKeyboard(mKeyboard.getVerticalGap()); - } else if (TAG_INCLUDE.equals(tag)) { - ; + break; } else if (TAG_MERGE.equals(tag)) { - return; + break; } else { - throw new InflateException("unknown end tag: " + tag); + throw new IllegalEndTag(parser, TAG_ROW); } } } + if (DEBUG_PARSER) debugLeaveMethod("parseKeyboardContent", keys == null); } - // return true if the row is valid for this keyboard mode - private boolean startRow(Row row) { - mCurrentX = 0; - mCurrentRow = row; - return row.mode == 0 || row.mode == mKeyboard.getKeyboardMode(); + private void parseRowContent(XmlResourceParser parser, Row row, List keys) + throws XmlPullParserException, IOException { + if (DEBUG_PARSER) debugEnterMethod("parseRowContent", keys == null); + int event; + while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { + if (event == XmlResourceParser.START_TAG) { + final String tag = parser.getName(); + if (DEBUG_TAG) debugStartTag("parseRowContent", tag, keys == null); + if (TAG_KEY.equals(tag)) { + parseKey(parser, row, keys); + } else if (TAG_SPACER.equals(tag)) { + parseSpacer(parser, keys); + } else if (TAG_INCLUDE.equals(tag)) { + parseIncludeRowContent(parser, row, keys); + } else { + throw new IllegalStartTag(parser, TAG_KEY); + } + } else if (event == XmlResourceParser.END_TAG) { + final String tag = parser.getName(); + if (DEBUG_TAG) debugEndTag("parseRowContent", tag, keys == null); + if (TAG_ROW.equals(tag)) { + if (keys != null) + endRow(); + break; + } else if (TAG_MERGE.equals(tag)) { + break; + } else { + throw new IllegalEndTag(parser, TAG_KEY); + } + } + } + if (DEBUG_PARSER) debugLeaveMethod("parseRowContent", keys == null); } - private void skipRow() { - mCurrentRow = null; + private void parseKey(XmlResourceParser parser, Row row, List keys) + throws XmlPullParserException, IOException { + if (DEBUG_PARSER) debugEnterMethod("parseKey", keys == null); + if (keys == null) { + checkEndTag(TAG_KEY, parser); + } else { + Key key = mKeyboard.createKeyFromXml(mResources, row, mCurrentX, mCurrentY, parser); + checkEndTag(TAG_KEY, parser); + keys.add(key); + if (key.codes[0] == BaseKeyboard.KEYCODE_SHIFT) + mKeyboard.getShiftKeys().add(key); + endKey(key); + } } - private void endRow() { - if (mCurrentRow == null) - throw new InflateException("orphant end row tag"); - mCurrentY += mCurrentRow.verticalGap + mCurrentRow.defaultHeight; - mCurrentRow = null; + private void parseSpacer(XmlResourceParser parser, List keys) + throws XmlPullParserException, IOException { + if (DEBUG_PARSER) debugEnterMethod("parseSpacer", keys == null); + if (keys == null) { + checkEndTag(TAG_SPACER, parser); + } else { + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard); + int gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, + mKeyboard.getKeyboardWidth(), 0); + a.recycle(); + checkEndTag(TAG_SPACER, parser); + setSpacer(gap); + } } - private void endKey(Key key) { - mCurrentX += key.gap + key.width; - if (mCurrentX > mMaxRowWidth) - mMaxRowWidth = mCurrentX; + private void parseIncludeKeyboardContent(XmlResourceParser parser, List keys) + throws XmlPullParserException, IOException { + parseIncludeInternal(parser, null, keys); } - private void endKeyboard(int defaultVerticalGap) { - mTotalHeight = mCurrentY - defaultVerticalGap; + private void parseIncludeRowContent(XmlResourceParser parser, Row row, List keys) + throws XmlPullParserException, IOException { + parseIncludeInternal(parser, row, keys); } - private void setSpacer(int gap) { - mCurrentX += gap; - } + private void parseIncludeInternal(XmlResourceParser parser, Row row, List keys) + throws XmlPullParserException, IOException { + if (DEBUG_PARSER) debugEnterMethod("parseInclude", keys == null); + if (keys == null) { + checkEndTag(TAG_INCLUDE, parser); + } else { + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.BaseKeyboard_Include); + final int keyboardLayout = a.getResourceId( + R.styleable.BaseKeyboard_Include_keyboardLayout, 0); + a.recycle(); - private void parseSpacerAttribute(XmlResourceParser parser) { - final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.BaseKeyboard); - int gap = getDimensionOrFraction(a, R.styleable.BaseKeyboard_horizontalGap, - mKeyboard.getKeyboardWidth(), 0); - a.recycle(); - setSpacer(gap); + checkEndTag(TAG_INCLUDE, parser); + if (keyboardLayout == 0) + throw new ParseException("No keyboardLayout attribute in ", parser); + parseMerge(mResources.getLayout(keyboardLayout), row, keys); + } + if (DEBUG_PARSER) debugLeaveMethod("parseInclude", keys == null); } - private void parseInclude(XmlResourceParser parent) + private void parseMerge(XmlResourceParser parser, Row row, List keys) throws XmlPullParserException, IOException { - final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parent), - R.styleable.BaseKeyboard_Include); - final int keyboardLayout = a.getResourceId( - R.styleable.BaseKeyboard_Include_keyboardLayout, 0); - a.recycle(); - if (keyboardLayout == 0) - throw new InflateException(" must have keyboardLayout attribute"); - final XmlResourceParser parser = mResources.getLayout(keyboardLayout); - + if (DEBUG_PARSER) debugEnterMethod("parseMerge", keys == null); int event; while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { if (event == XmlResourceParser.START_TAG) { - String name = parser.getName(); - if (TAG_MERGE.equals(name)) { - parseKeyboard(parser); - return; + String tag = parser.getName(); + if (DEBUG_TAG) debugStartTag("parseMerge", tag, keys == null); + if (TAG_MERGE.equals(tag)) { + if (row == null) { + parseKeyboardContent(parser, keys); + } else { + parseRowContent(parser, row, keys); + } + break; } else { - throw new InflateException( - "include keyboard layout must have root element"); + throw new ParseException( + "Included keyboard layout must have root element", parser); } } } + if (DEBUG_PARSER) debugLeaveMethod("parseMerge", keys == null); } - private void skipToEndOfRow(XmlResourceParser parser) + private static void checkEndTag(String tag, XmlResourceParser parser) throws XmlPullParserException, IOException { - int event; - while ((event = parser.next()) != XmlResourceParser.END_DOCUMENT) { - if (event == XmlResourceParser.END_TAG) { - String tag = parser.getName(); - if (TAG_ROW.equals(tag)) { - skipRow(); - return; - } - } + if (parser.next() == XmlResourceParser.END_TAG && tag.equals(parser.getName())) + return; + throw new NonEmptyTag(tag, parser); + } + + // return true if the row is valid for this keyboard mode + private boolean maybeStartRow(Row row) { + if (DEBUG_TAG) + Log.d(TAG, String.format("startRow: mode=0x%08x keyboardMode=0x%08x", + row.mode, mKeyboard.getKeyboardMode())); + if (row.mode == 0 || row.mode == mKeyboard.getKeyboardMode()) { + mCurrentX = 0; + mCurrentRow = row; + return true; + } else { + return false; } - throw new InflateException("can not find
"); } - private void parseKeyboardAttributes(XmlResourceParser parser) { - final BaseKeyboard keyboard = mKeyboard; - final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), - R.styleable.BaseKeyboard); - final int width = keyboard.getKeyboardWidth(); - final int height = keyboard.getKeyboardHeight(); - keyboard.setKeyWidth(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyWidth, width, width / 10)); - keyboard.setKeyHeight(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_keyHeight, height, 50)); - keyboard.setHorizontalGap(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_horizontalGap, width, 0)); - keyboard.setVerticalGap(getDimensionOrFraction(a, - R.styleable.BaseKeyboard_verticalGap, height, 0)); - a.recycle(); + private void endRow() { + if (mCurrentRow == null) + throw new InflateException("orphant end row tag"); + mCurrentY += mCurrentRow.verticalGap + mCurrentRow.defaultHeight; + mCurrentRow = null; + } + + private void endKey(Key key) { + mCurrentX += key.gap + key.width; + if (mCurrentX > mMaxRowWidth) + mMaxRowWidth = mCurrentX; + } + + private void endKeyboard(int defaultVerticalGap) { + mTotalHeight = mCurrentY - defaultVerticalGap; + } + + private void setSpacer(int gap) { + mCurrentX += gap; } public static int getDimensionOrFraction(TypedArray a, int index, int base, int defValue) { @@ -230,4 +353,48 @@ public class BaseKeyboardParser { } return defValue; } -} + + @SuppressWarnings("serial") + private static class ParseException extends InflateException { + public ParseException(String msg, XmlResourceParser parser) { + super(msg + " at line " + parser.getLineNumber()); + } + } + + @SuppressWarnings("serial") + private static class IllegalStartTag extends ParseException { + public IllegalStartTag(XmlResourceParser parser, String parent) { + super("Illegal start tag " + parser.getName() + " in " + parent, parser); + } + } + + @SuppressWarnings("serial") + private static class IllegalEndTag extends ParseException { + public IllegalEndTag(XmlResourceParser parser, String parent) { + super("Illegal end tag " + parser.getName() + " in " + parent, parser); + } + } + + @SuppressWarnings("serial") + private static class NonEmptyTag extends ParseException { + public NonEmptyTag(String tag, XmlResourceParser parser) { + super(tag + " must be empty tag", parser); + } + } + + private static void debugEnterMethod(String title, boolean skip) { + Log.d(TAG, title + ": enter" + (skip ? " skip" : "")); + } + + private static void debugLeaveMethod(String title, boolean skip) { + Log.d(TAG, title + ": leave" + (skip ? " skip" : "")); + } + + private static void debugStartTag(String title, String tag, boolean skip) { + Log.d(TAG, title + ": <" + tag + ">" + (skip ? " skip" : "")); + } + + private static void debugEndTag(String title, String tag, boolean skip) { + Log.d(TAG, title + ": " + (skip ? " skip" : "")); + } + } -- cgit v1.2.3-83-g751a From 36af0880c3bf7eaeeb4cdec0c3c519306df22c79 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 22 Oct 2010 22:18:40 +0900 Subject: Tablet keyboard should always show "?123" as symbol key Bug: 3118554 Change-Id: Ib609799f28dee56a4ded2e8144ac4a0c0d113ad6 --- java/res/values-xlarge/bools.xml | 1 + java/res/values/bools.xml | 1 + .../android/inputmethod/latin/LatinKeyboard.java | 65 ++++++++++++---------- 3 files changed, 38 insertions(+), 29 deletions(-) (limited to 'java/src') diff --git a/java/res/values-xlarge/bools.xml b/java/res/values-xlarge/bools.xml index 3079133dd..2ac5fc624 100644 --- a/java/res/values-xlarge/bools.xml +++ b/java/res/values-xlarge/bools.xml @@ -22,4 +22,5 @@ false false false + false diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml index 5d932a693..0497a6aed 100644 --- a/java/res/values/bools.xml +++ b/java/res/values/bools.xml @@ -32,4 +32,5 @@ true true true + true diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 8e16feb5e..37ce1e8e4 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -121,8 +121,8 @@ public class LatinKeyboard extends BaseKeyboard { super(context, xmlLayoutResId, mode); final Resources res = context.getResources(); mContext = context; - mMode = mode; mRes = res; + mMode = mode; mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked); setDefaultBounds(mShiftLockPreviewIcon); @@ -192,9 +192,9 @@ public class LatinKeyboard extends BaseKeyboard { mMode = mode; if (mEnterKey == null) return; - final boolean configDynamicKeyToEnterKey = res.getBoolean( + final boolean configDynamicKeyTopEnterKey = res.getBoolean( R.bool.config_dynamic_key_top_enter_key); - if (configDynamicKeyToEnterKey) { + if (configDynamicKeyTopEnterKey) { switch (options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { case EditorInfo.IME_ACTION_GO: resetKeyAttributes(mEnterKey, res.getText(R.string.label_go_key)); @@ -291,16 +291,17 @@ public class LatinKeyboard extends BaseKeyboard { public void setColorOfSymbolIcons(boolean isAutoCompletion, boolean isBlack) { mIsBlackSym = isBlack; + final Resources res = mRes; if (isBlack) { - mShiftLockIcon = mRes.getDrawable(R.drawable.sym_bkeyboard_shift_locked); - mSpaceIcon = mRes.getDrawable(R.drawable.sym_bkeyboard_space); - mMicIcon = mRes.getDrawable(R.drawable.sym_bkeyboard_mic); - m123MicIcon = mRes.getDrawable(R.drawable.sym_bkeyboard_123_mic); + mShiftLockIcon = res.getDrawable(R.drawable.sym_bkeyboard_shift_locked); + mSpaceIcon = res.getDrawable(R.drawable.sym_bkeyboard_space); + mMicIcon = res.getDrawable(R.drawable.sym_bkeyboard_mic); + m123MicIcon = res.getDrawable(R.drawable.sym_bkeyboard_123_mic); } else { - mShiftLockIcon = mRes.getDrawable(R.drawable.sym_keyboard_shift_locked); - mSpaceIcon = mRes.getDrawable(R.drawable.sym_keyboard_space); - mMicIcon = mRes.getDrawable(R.drawable.sym_keyboard_mic); - m123MicIcon = mRes.getDrawable(R.drawable.sym_keyboard_123_mic); + mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked); + mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space); + mMicIcon = res.getDrawable(R.drawable.sym_keyboard_mic); + m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic); } updateDynamicKeys(); if (mSpaceKey != null) { @@ -320,9 +321,11 @@ public class LatinKeyboard extends BaseKeyboard { } private void update123Key() { + final boolean configDynamicKeyTopSymbolKey = mRes.getBoolean( + R.bool.config_dynamic_key_top_symbol_key); // Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode. if (m123Key != null && mIsAlphaKeyboard) { - if (mVoiceEnabled && !mHasVoiceButton) { + if (configDynamicKeyTopSymbolKey && mVoiceEnabled && !mHasVoiceButton) { m123Key.icon = m123MicIcon; m123Key.iconPreview = m123MicPreviewIcon; m123Key.label = null; @@ -391,18 +394,19 @@ public class LatinKeyboard extends BaseKeyboard { } private void updateSpaceBarForLocale(boolean isAutoCompletion, boolean isBlack) { + final Resources res = mRes; // If application locales are explicitly selected. if (mLocale != null) { - mSpaceKey.icon = new BitmapDrawable(mRes, + mSpaceKey.icon = new BitmapDrawable(res, drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack)); } else { // sym_keyboard_space_led can be shared with Black and White symbol themes. if (isAutoCompletion) { - mSpaceKey.icon = new BitmapDrawable(mRes, + mSpaceKey.icon = new BitmapDrawable(res, drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack)); } else { - mSpaceKey.icon = isBlack ? mRes.getDrawable(R.drawable.sym_bkeyboard_space) - : mRes.getDrawable(R.drawable.sym_keyboard_space); + mSpaceKey.icon = isBlack ? res.getDrawable(R.drawable.sym_bkeyboard_space) + : res.getDrawable(R.drawable.sym_keyboard_space); } } } @@ -462,7 +466,8 @@ public class LatinKeyboard extends BaseKeyboard { final int height = mSpaceIcon.getIntrinsicHeight(); final Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); final Canvas canvas = new Canvas(buffer); - canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR); + final Resources res = mRes; + canvas.drawColor(res.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR); // If application locales are explicitly selected. if (mLocale != null) { @@ -478,14 +483,14 @@ public class LatinKeyboard extends BaseKeyboard { allowVariableTextSize); // Draw language text with shadow - final int shadowColor = mRes.getColor(isBlack + final int shadowColor = res.getColor(isBlack ? R.color.latinkeyboard_bar_language_shadow_black : R.color.latinkeyboard_bar_language_shadow_white); final float baseline = height * SPACEBAR_LANGUAGE_BASELINE; final float descent = paint.descent(); paint.setColor(shadowColor); canvas.drawText(language, width / 2, baseline - descent - 1, paint); - paint.setColor(mRes.getColor(R.color.latinkeyboard_bar_language_text)); + paint.setColor(res.getColor(R.color.latinkeyboard_bar_language_text)); canvas.drawText(language, width / 2, baseline - descent, paint); // Put arrows that are already layed out on either side of the text @@ -824,17 +829,19 @@ public class LatinKeyboard extends BaseKeyboard { setDefaultBounds(mBackground); mWidth = width; mHeight = height; - mTextPaint = new TextPaint(); - mTextPaint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Medium, 18)); - mTextPaint.setColor(R.color.latinkeyboard_transparent); - mTextPaint.setTextAlign(Align.CENTER); - mTextPaint.setAlpha(OPACITY_FULLY_OPAQUE); - mTextPaint.setAntiAlias(true); + final TextPaint textPaint = new TextPaint(); + textPaint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Medium, 18)); + textPaint.setColor(R.color.latinkeyboard_transparent); + textPaint.setTextAlign(Align.CENTER); + textPaint.setAlpha(OPACITY_FULLY_OPAQUE); + textPaint.setAntiAlias(true); + mTextPaint = textPaint; mMiddleX = (mWidth - mBackground.getIntrinsicWidth()) / 2; - mLeftDrawable = - mRes.getDrawable(R.drawable.sym_keyboard_feedback_language_arrows_left); - mRightDrawable = - mRes.getDrawable(R.drawable.sym_keyboard_feedback_language_arrows_right); + final Resources res = mRes; + mLeftDrawable = res.getDrawable( + R.drawable.sym_keyboard_feedback_language_arrows_left); + mRightDrawable = res.getDrawable( + R.drawable.sym_keyboard_feedback_language_arrows_right); mThreshold = ViewConfiguration.get(mContext).getScaledTouchSlop(); } -- cgit v1.2.3-83-g751a From 4189eb23082fcd4bf8cfb2085d18e226e0e7ce13 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 22 Oct 2010 19:35:23 +0900 Subject: Revise caps lock sequences This change also fixes that the popup preview of ALT on symbol keyboard is not showing. Bug: 3122877 Bug: 3127255 Change-Id: I978cb30a0d05298274d8ab6541b91323a0fef211 --- java/res/values/config.xml | 1 + .../com/android/inputmethod/latin/LatinIME.java | 153 ++++++++++++--------- .../android/inputmethod/latin/LatinKeyboard.java | 2 + .../inputmethod/latin/LatinKeyboardBaseView.java | 37 ++++- .../inputmethod/latin/LatinKeyboardView.java | 13 +- .../android/inputmethod/latin/PointerTracker.java | 38 +++-- 6 files changed, 151 insertions(+), 93 deletions(-) (limited to 'java/src') diff --git a/java/res/values/config.xml b/java/res/values/config.xml index a1577e4d1..410d34b00 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -28,6 +28,7 @@ 400 50 400 + 1000 800 diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index bb29e6367..3250cdd01 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -142,9 +142,10 @@ public class LatinIME extends InputMethodService // Key events coming any faster than this are long-presses. private static final int QUICK_PRESS = 200; - static final int KEYCODE_ENTER = '\n'; - static final int KEYCODE_SPACE = ' '; - static final int KEYCODE_PERIOD = '.'; + public static final int KEYCODE_ENTER = '\n'; + public static final int KEYCODE_TAB = '\t'; + public static final int KEYCODE_SPACE = ' '; + public static final int KEYCODE_PERIOD = '.'; // Contextual menu positions private static final int POS_METHOD = 0; @@ -1190,66 +1191,68 @@ public class LatinIME extends InputMethodService public void onKey(int primaryCode, int[] keyCodes, int x, int y) { long when = SystemClock.uptimeMillis(); - if (primaryCode != BaseKeyboard.KEYCODE_DELETE || - when > mLastKeyTime + QUICK_PRESS) { + if (primaryCode != BaseKeyboard.KEYCODE_DELETE || when > mLastKeyTime + QUICK_PRESS) { mDeleteCount = 0; } mLastKeyTime = when; final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); switch (primaryCode) { - case BaseKeyboard.KEYCODE_DELETE: - handleBackspace(); - mDeleteCount++; - LatinImeLogger.logOnDelete(); - break; - case BaseKeyboard.KEYCODE_SHIFT: - // Shift key is handled in onPress() when device has distinct multi-touch panel. - if (!distinctMultiTouch) - handleShift(); - break; - case BaseKeyboard.KEYCODE_MODE_CHANGE: - // Symbol key is handled in onPress() when device has distinct multi-touch panel. - if (!distinctMultiTouch) - changeKeyboardMode(); - break; - case BaseKeyboard.KEYCODE_CANCEL: - if (!isShowingOptionDialog()) { - handleClose(); - } - break; - case LatinKeyboardView.KEYCODE_OPTIONS: - onOptionKeyPressed(); - break; - case LatinKeyboardView.KEYCODE_OPTIONS_LONGPRESS: - onOptionKeyLongPressed(); - break; - case LatinKeyboardView.KEYCODE_NEXT_LANGUAGE: - toggleLanguage(false, true); - break; - case LatinKeyboardView.KEYCODE_PREV_LANGUAGE: - toggleLanguage(false, false); - break; - case LatinKeyboardView.KEYCODE_VOICE: - if (VOICE_INSTALLED) { - startListening(false /* was a button press, was not a swipe */); - } - break; - case 9 /*Tab*/: - sendDownUpKeyEvents(KeyEvent.KEYCODE_TAB); - break; - default: - if (primaryCode != KEYCODE_ENTER) { - mJustAddedAutoSpace = false; - } - RingCharBuffer.getInstance().push((char)primaryCode, x, y); - LatinImeLogger.logOnInputChar(); - if (isWordSeparator(primaryCode)) { - handleSeparator(primaryCode); - } else { - handleCharacter(primaryCode, keyCodes); - } - // Cancel the just reverted state - mJustRevertedSeparator = null; + case BaseKeyboard.KEYCODE_DELETE: + handleBackspace(); + mDeleteCount++; + LatinImeLogger.logOnDelete(); + break; + case BaseKeyboard.KEYCODE_SHIFT: + // Shift key is handled in onPress() when device has distinct multi-touch panel. + if (!distinctMultiTouch) + handleShift(); + break; + case BaseKeyboard.KEYCODE_MODE_CHANGE: + // Symbol key is handled in onPress() when device has distinct multi-touch panel. + if (!distinctMultiTouch) + changeKeyboardMode(); + break; + case BaseKeyboard.KEYCODE_CANCEL: + if (!isShowingOptionDialog()) { + handleClose(); + } + break; + case LatinKeyboardView.KEYCODE_OPTIONS: + onOptionKeyPressed(); + break; + case LatinKeyboardView.KEYCODE_OPTIONS_LONGPRESS: + onOptionKeyLongPressed(); + break; + case LatinKeyboardView.KEYCODE_NEXT_LANGUAGE: + toggleLanguage(false, true); + break; + case LatinKeyboardView.KEYCODE_PREV_LANGUAGE: + toggleLanguage(false, false); + break; + case LatinKeyboardView.KEYCODE_CAPSLOCK: + handleCapsLock(); + break; + case LatinKeyboardView.KEYCODE_VOICE: + if (VOICE_INSTALLED) { + startListening(false /* was a button press, was not a swipe */); + } + break; + case KEYCODE_TAB: + sendDownUpKeyEvents(KeyEvent.KEYCODE_TAB); + break; + default: + if (primaryCode != KEYCODE_ENTER) { + mJustAddedAutoSpace = false; + } + RingCharBuffer.getInstance().push((char)primaryCode, x, y); + LatinImeLogger.logOnInputChar(); + if (isWordSeparator(primaryCode)) { + handleSeparator(primaryCode); + } else { + handleCharacter(primaryCode, keyCodes); + } + // Cancel the just reverted state + mJustRevertedSeparator = null; } if (mKeyboardSwitcher.onKey(primaryCode)) { changeKeyboardMode(); @@ -1363,24 +1366,37 @@ public class LatinIME extends InputMethodService private void handleShiftInternal(boolean forceNormal) { mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE); KeyboardSwitcher switcher = mKeyboardSwitcher; - LatinKeyboardView inputView = switcher.getInputView(); if (switcher.isAlphabetMode()) { + LatinKeyboardView inputView = switcher.getInputView(); if (mCapsLock || forceNormal) { mCapsLock = false; switcher.setShifted(false); } else if (inputView != null) { - if (inputView.isShifted()) { - mCapsLock = true; - switcher.setShiftLocked(true); - } else { - switcher.setShifted(true); - } + switcher.setShifted(!inputView.isShifted()); } } else { switcher.toggleShift(); } } + private void handleCapsLock() { + mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE); + KeyboardSwitcher switcher = mKeyboardSwitcher; + if (switcher.isAlphabetMode()) { + if (mCapsLock) { + mCapsLock = false; + // LatinKeyboard.setShifted(false) also disable shift locked state. + // Note: Caps lock LED is off when Key.on is false. + switcher.setShifted(false); + } else { + mCapsLock = true; + // LatinKeyboard.setShiftLocked(true) enable shift state too. + // Note: Caps lock LED is on when Key.on is true. + switcher.setShiftLocked(true); + } + } + } + private void abortCorrection(boolean force) { if (force || TextEntryState.isCorrecting()) { getCurrentInputConnection().finishComposingText(); @@ -2291,7 +2307,9 @@ public class LatinIME extends InputMethodService final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { mShiftKeyState.onPress(); - handleShift(); + // Not in caps lock mode, shift key is in effect on pressed. + if (mKeyboardSwitcher.isAlphabetMode() && !mCapsLock) + handleShift(); } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { mSymbolKeyState.onPress(); changeKeyboardMode(); @@ -2309,6 +2327,9 @@ public class LatinIME extends InputMethodService if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { if (mShiftKeyState.isMomentary()) resetShift(); + // In caps lock mode, shift key is in effect on released. + if (mKeyboardSwitcher.isAlphabetMode() && mCapsLock) + handleShift(); mShiftKeyState.onRelease(); } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { if (mSymbolKeyState.isMomentary()) diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 37ce1e8e4..6494bdfca 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -236,6 +236,7 @@ public class LatinKeyboard extends BaseKeyboard { } public void setShiftLocked(boolean shiftLocked) { + // TODO: cleanup this method with BaseKeyboard.Key for (final Key key : getShiftKeys()) { key.on = shiftLocked; key.icon = mShiftLockIcon; @@ -249,6 +250,7 @@ public class LatinKeyboard extends BaseKeyboard { @Override public boolean setShifted(boolean shiftState) { + // TODO: cleanup this method with BaseKeyboard.Key. boolean shiftChanged = false; if (getShiftKeys().size() > 0) { for (final Key key : getShiftKeys()) { diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 4e264e853..6b46ab838 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -261,6 +261,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx private static final int MSG_DISMISS_PREVIEW = 2; private static final int MSG_REPEAT_KEY = 3; private static final int MSG_LONGPRESS_KEY = 4; + private static final int MSG_LONGPRESS_SHIFT_KEY = 5; private boolean mInKeyRepeat; @@ -284,6 +285,11 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx openPopupIfRequired(msg.arg1, tracker); break; } + case MSG_LONGPRESS_SHIFT_KEY: { + final PointerTracker tracker = (PointerTracker)msg.obj; + onLongPressShiftKey(tracker); + break; + } } } @@ -335,9 +341,20 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx removeMessages(MSG_LONGPRESS_KEY); } + public void startLongPressShiftTimer(long delay, int keyIndex, PointerTracker tracker) { + removeMessages(MSG_LONGPRESS_SHIFT_KEY); + sendMessageDelayed( + obtainMessage(MSG_LONGPRESS_SHIFT_KEY, keyIndex, 0, tracker), delay); + } + + public void cancelLongPressShiftTimer() { + removeMessages(MSG_LONGPRESS_SHIFT_KEY); + } + public void cancelKeyTimers() { cancelKeyRepeatTimer(); cancelLongPressTimer(); + cancelLongPressShiftTimer(); } public void cancelAllMessages() { @@ -869,7 +886,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx int drawableX = (key.width + padding.left - padding.right - drawableWidth) / 2; int drawableY = (key.height + padding.top - padding.bottom - drawableHeight) / 2; drawIcon(canvas, key.icon, drawableX, drawableY, drawableWidth, drawableHeight); - } if (key.hintIcon != null && drawHintIcon) { int drawableWidth = key.width; @@ -924,7 +940,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // TODO: clean up this method. private void dismissKeyPreview() { for (PointerTracker tracker : mPointerTrackers) - tracker.updateKey(NOT_A_KEY); + tracker.releaseKey(); showPreview(NOT_A_KEY, null); } @@ -959,11 +975,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx // WindowManager.BadTokenException. if (key == null || !mInForeground) return; - if (key.icon != null) { - mPreviewText.setCompoundDrawables(null, null, null, - key.iconPreview != null ? key.iconPreview : key.icon); - mPreviewText.setText(null); - } else { + // What we show as preview should match what we show on key top in onBufferDraw(). + if (key.label != null) { // TODO Should take care of temporaryShiftLabel here. mPreviewText.setCompoundDrawables(null, null, null, null); mPreviewText.setText(adjustCase(tracker.getPreviewText(key))); @@ -974,6 +987,10 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge); mPreviewText.setTypeface(mKeyTextStyle); } + } else { + mPreviewText.setCompoundDrawables(null, null, null, + key.iconPreview != null ? key.iconPreview : key.icon); + mPreviewText.setText(null); } mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); @@ -1086,6 +1103,12 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return result; } + private void onLongPressShiftKey(PointerTracker tracker) { + tracker.setAlreadyProcessed(); + mPointerQueue.remove(tracker); + mKeyboardActionListener.onKey(LatinKeyboardView.KEYCODE_CAPSLOCK, null, 0, 0); + } + private View inflateMiniKeyboardContainer(Key popupKey) { int popupKeyboardId = popupKey.popupResId; LayoutInflater inflater = (LayoutInflater)getContext().getSystemService( diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index f3d045bec..35428997f 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -32,12 +32,13 @@ import java.util.List; public class LatinKeyboardView extends LatinKeyboardBaseView { - static final int KEYCODE_OPTIONS = -100; - static final int KEYCODE_OPTIONS_LONGPRESS = -101; - static final int KEYCODE_VOICE = -102; - static final int KEYCODE_F1 = -103; - static final int KEYCODE_NEXT_LANGUAGE = -104; - static final int KEYCODE_PREV_LANGUAGE = -105; + public static final int KEYCODE_OPTIONS = -100; + public static final int KEYCODE_OPTIONS_LONGPRESS = -101; + public static final int KEYCODE_VOICE = -102; + public static final int KEYCODE_F1 = -103; + public static final int KEYCODE_NEXT_LANGUAGE = -104; + public static final int KEYCODE_PREV_LANGUAGE = -105; + public static final int KEYCODE_CAPSLOCK = -106; private BaseKeyboard mPhoneKeyboard; diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index d1cdbfe26..8824db6e3 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -40,6 +40,7 @@ public class PointerTracker { // Timing constants private final int mDelayBeforeKeyRepeatStart; private final int mLongPressKeyTimeout; + private final int mLongPressShiftKeyTimeout; private final int mMultiTapKeyTimeout; // Miscellaneous constants @@ -175,6 +176,7 @@ public class PointerTracker { mHasDistinctMultitouch = proxy.hasDistinctMultitouch(); mDelayBeforeKeyRepeatStart = res.getInteger(R.integer.config_delay_before_key_repeat_start); mLongPressKeyTimeout = res.getInteger(R.integer.config_long_press_key_timeout); + mLongPressShiftKeyTimeout = res.getInteger(R.integer.config_long_press_shift_key_timeout); mMultiTapKeyTimeout = res.getInteger(R.integer.config_multi_tap_key_timeout); resetMultiTap(); } @@ -223,9 +225,11 @@ public class PointerTracker { return key != null && key.codes[0] == LatinIME.KEYCODE_SPACE; } - public void updateKey(int keyIndex) { - if (mKeyAlreadyProcessed) - return; + public void releaseKey() { + updateKeyGraphics(NOT_A_KEY); + } + + private void updateKeyGraphics(int keyIndex) { int oldKeyIndex = mPreviousKey; mPreviousKey = keyIndex; if (keyIndex != oldKeyIndex) { @@ -287,7 +291,7 @@ public class PointerTracker { } startLongPressTimer(keyIndex); } - showKeyPreviewAndUpdateKey(keyIndex); + showKeyPreviewAndUpdateKeyGraphics(keyIndex); } public void onMoveEvent(int x, int y, long eventTime) { @@ -317,12 +321,13 @@ public class PointerTracker { mHandler.cancelLongPressTimer(); } } - showKeyPreviewAndUpdateKey(mKeyState.getKeyIndex()); + showKeyPreviewAndUpdateKeyGraphics(mKeyState.getKeyIndex()); } public void onUpEvent(int x, int y, long eventTime) { if (DEBUG) debugLog("onUpEvent :", x, y); + showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY); if (mKeyAlreadyProcessed) return; mHandler.cancelKeyTimers(); @@ -334,7 +339,6 @@ public class PointerTracker { x = mKeyState.getKeyX(); y = mKeyState.getKeyY(); } - showKeyPreviewAndUpdateKey(NOT_A_KEY); if (!mIsRepeatableKey) { detectAndSendKey(keyIndex, x, y, eventTime); } @@ -348,7 +352,7 @@ public class PointerTracker { debugLog("onCancelEvt:", x, y); mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); - showKeyPreviewAndUpdateKey(NOT_A_KEY); + showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY); int keyIndex = mKeyState.getKeyIndex(); if (isValidKeyIndex(keyIndex)) mProxy.invalidateKey(mKeys[keyIndex]); @@ -409,8 +413,8 @@ public class PointerTracker { return dx * dx + dy * dy; } - private void showKeyPreviewAndUpdateKey(int keyIndex) { - updateKey(keyIndex); + private void showKeyPreviewAndUpdateKeyGraphics(int keyIndex) { + updateKeyGraphics(keyIndex); // The modifier key, such as shift key, should not be shown as preview when multi-touch is // supported. On thge other hand, if multi-touch is not supported, the modifier key should // be shown as preview. @@ -423,11 +427,17 @@ public class PointerTracker { private void startLongPressTimer(int keyIndex) { Key key = getKey(keyIndex); - // If keyboard is in temporary upper case state and the key has temporary shift label, - // long press should not be started. - if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) - return; - mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); + if (key.codes[0] == BaseKeyboard.KEYCODE_SHIFT) { + mHandler.startLongPressShiftTimer(mLongPressShiftKeyTimeout, keyIndex, this); + } else { + // If keyboard is in temporary upper case state and the key has temporary shift label, + // non-shift long press should not be started. On distinct multi touch device, when + // pressing shift key (in temporary upper case), hint icon should not be drawn on key + // top. So we should disable long press for such key. + if (isTemporaryUpperCase() && key.temporaryShiftLabel != null) + return; + mHandler.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this); + } } private boolean isTemporaryUpperCase() { -- cgit v1.2.3-83-g751a From 0ce98cbf98c6409ac18fa341f467703d78352a4c Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Mon, 25 Oct 2010 18:04:01 +0900 Subject: Get rid of references to BaseKeyboard in Latin-specific classes Change-Id: I6871a24967b1410bdb14e902bdd311ef82fd4f0b --- .../com/android/inputmethod/latin/LatinIME.java | 10 +++--- .../inputmethod/latin/LatinKeyboardBaseView.java | 4 +-- .../inputmethod/latin/LatinKeyboardView.java | 42 ++++++++++++---------- 3 files changed, 30 insertions(+), 26 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 3250cdd01..0a39ab8de 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1791,7 +1791,7 @@ public class LatinIME extends InputMethodService private void updateSuggestions() { LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); - ((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(null); + inputView.getLatinKeyboard().setPreferredLetters(null); // Check if we have a suggestion engine attached. if ((mSuggest == null || !isPredictionOn()) && !mVoiceInputHighlighted) { @@ -1813,7 +1813,7 @@ public class LatinIME extends InputMethodService private void showCorrections(WordAlternatives alternatives) { List stringList = alternatives.getAlternatives(); - ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setPreferredLetters(null); + mKeyboardSwitcher.getInputView().getLatinKeyboard().setPreferredLetters(null); showSuggestions(stringList, alternatives.getOriginalWord(), false, false); } @@ -1829,7 +1829,7 @@ public class LatinIME extends InputMethodService int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies(); - ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).setPreferredLetters( + mKeyboardSwitcher.getInputView().getLatinKeyboard().setPreferredLetters( nextLettersFrequencies); boolean correctionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasMinimalCorrection(); @@ -2018,7 +2018,7 @@ public class LatinIME extends InputMethodService saveWordInHistory(suggestion); mPredicting = false; mCommittedLength = suggestion.length(); - ((LatinKeyboard) inputView.getKeyboard()).setPreferredLetters(null); + inputView.getLatinKeyboard().setPreferredLetters(null); // If we just corrected a word, then don't show punctuations if (!correcting) { setNextSuggestions(); @@ -2321,7 +2321,7 @@ public class LatinIME extends InputMethodService public void onRelease(int primaryCode) { // Reset any drag flags in the keyboard - ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased(); + mKeyboardSwitcher.getInputView().getLatinKeyboard().keyReleased(); //vibrate(); final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 6b46ab838..2bf70bf82 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -598,7 +598,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx * @see #getKeyboard() * @param keyboard the keyboard to display in this view */ - public void setKeyboard(BaseKeyboard keyboard) { + protected void setKeyboard(BaseKeyboard keyboard) { if (mKeyboard != null) { dismissKeyPreview(); } @@ -626,7 +626,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx * @return the currently attached keyboard * @see #setKeyboard(BaseKeyboard) */ - public BaseKeyboard getKeyboard() { + protected BaseKeyboard getKeyboard() { return mKeyboard; } diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java index 35428997f..6672dd22d 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java @@ -40,7 +40,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { public static final int KEYCODE_PREV_LANGUAGE = -105; public static final int KEYCODE_CAPSLOCK = -106; - private BaseKeyboard mPhoneKeyboard; + private LatinKeyboard mPhoneKeyboard; /** Whether we've started dropping move events because we found a big jump */ private boolean mDroppingEvents; @@ -62,13 +62,13 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { super(context, attrs, defStyle); } - public void setPhoneKeyboard(BaseKeyboard phoneKeyboard) { + public void setPhoneKeyboard(LatinKeyboard phoneKeyboard) { mPhoneKeyboard = phoneKeyboard; } @Override public void setPreviewEnabled(boolean previewEnabled) { - if (getKeyboard() == mPhoneKeyboard) { + if (getLatinKeyboard() == mPhoneKeyboard) { // Phone keyboard never shows popup preview (except language switch). super.setPreviewEnabled(false); } else { @@ -76,8 +76,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } } - @Override - public void setKeyboard(BaseKeyboard k) { + public void setLatinKeyboard(LatinKeyboard k) { super.setKeyboard(k); // One-seventh of the keyboard width seems like a reasonable threshold mJumpThresholdSquare = k.getMinWidth() / 7; @@ -87,12 +86,21 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { setKeyboardLocal(k); } + public LatinKeyboard getLatinKeyboard() { + BaseKeyboard keyboard = getKeyboard(); + if (keyboard instanceof LatinKeyboard) { + return (LatinKeyboard)keyboard; + } else { + return null; + } + } + @Override protected boolean onLongPress(Key key) { int primaryCode = key.codes[0]; if (primaryCode == KEYCODE_OPTIONS) { return invokeOnKey(KEYCODE_OPTIONS_LONGPRESS); - } else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) { + } else if (primaryCode == '0' && getLatinKeyboard() == mPhoneKeyboard) { // Long pressing on 0 in phone number keypad gives you a '+'. return invokeOnKey('+'); } else { @@ -109,9 +117,8 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { @Override protected CharSequence adjustCase(CharSequence label) { - BaseKeyboard keyboard = getKeyboard(); - if (keyboard instanceof LatinKeyboard - && ((LatinKeyboard) keyboard).isAlphaKeyboard() + LatinKeyboard keyboard = getLatinKeyboard(); + if (keyboard.isAlphaKeyboard() && keyboard.isShifted() && !TextUtils.isEmpty(label) && label.length() < 3 && Character.isLowerCase(label.charAt(0))) { @@ -121,13 +128,10 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } public boolean setShiftLocked(boolean shiftLocked) { - BaseKeyboard keyboard = getKeyboard(); - if (keyboard instanceof LatinKeyboard) { - ((LatinKeyboard)keyboard).setShiftLocked(shiftLocked); - invalidateAllKeys(); - return true; - } - return false; + LatinKeyboard keyboard = getLatinKeyboard(); + keyboard.setShiftLocked(shiftLocked); + invalidateAllKeys(); + return true; } /** @@ -209,7 +213,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { @Override public boolean onTouchEvent(MotionEvent me) { - LatinKeyboard keyboard = (LatinKeyboard) getKeyboard(); + LatinKeyboard keyboard = getLatinKeyboard(); if (DEBUG_LINE) { mLastX = (int) me.getX(); mLastY = (int) me.getY(); @@ -258,7 +262,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { private int mLastY; private Paint mPaint; - private void setKeyboardLocal(BaseKeyboard k) { + private void setKeyboardLocal(LatinKeyboard k) { if (DEBUG_AUTO_PLAY) { findKeys(); if (mHandler2 == null) { @@ -319,7 +323,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { } private void findKeys() { - List keys = getKeyboard().getKeys(); + List keys = getLatinKeyboard().getKeys(); // Get the keys on this keyboard for (int i = 0; i < keys.size(); i++) { int code = keys.get(i).codes[0]; -- cgit v1.2.3-83-g751a From 29ff343f77365e8a11a9b26a0e16a9dc5b7d72d7 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Mon, 25 Oct 2010 18:34:19 +0900 Subject: Remove LatinKeyboardBaseView.isShifted() and setShifted() for refactoring Change-Id: I9a1106b679a9ffb3ae959d90377eef096e5af842 --- .../inputmethod/latin/KeyboardSwitcher.java | 5 ++- .../com/android/inputmethod/latin/LatinIME.java | 44 ++++++++++++++++------ .../inputmethod/latin/LatinKeyboardBaseView.java | 35 +++-------------- 3 files changed, 42 insertions(+), 42 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 3a54904d3..a5a262ec7 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -392,7 +392,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha public void setShifted(boolean shifted) { if (mInputView != null) { - mInputView.setShifted(shifted); + LatinKeyboard latinKeyboard = mInputView.getLatinKeyboard(); + if (latinKeyboard != null && latinKeyboard.setShifted(shifted)) { + mInputView.invalidateAllKeys(); + } } } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 0a39ab8de..07df7eda8 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -993,7 +993,8 @@ public class LatinIME extends InputMethodService LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); // Enable shift key and DPAD to do selections if (inputView != null && inputView.isShown() - && inputView.isShifted()) { + && inputView.getLatinKeyboard() != null + && inputView.getLatinKeyboard().isShifted()) { event = new KeyEvent(event.getDownTime(), event.getEventTime(), event.getAction(), event.getKeyCode(), event.getRepeatCount(), event.getDeviceId(), event.getScanCode(), @@ -1372,7 +1373,10 @@ public class LatinIME extends InputMethodService mCapsLock = false; switcher.setShifted(false); } else if (inputView != null) { - switcher.setShifted(!inputView.isShifted()); + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard != null) { + switcher.setShifted(!latinKeyboard.isShifted()); + } } } else { switcher.toggleShift(); @@ -1425,7 +1429,8 @@ public class LatinIME extends InputMethodService mWord.reset(); } } - if (mKeyboardSwitcher.getInputView().isShifted()) { + LatinKeyboard latinKeyboard = mKeyboardSwitcher.getInputView().getLatinKeyboard(); + if (latinKeyboard != null && latinKeyboard.isShifted()) { if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT || keyCodes[0] > Character.MAX_CODE_POINT) { return; @@ -1444,7 +1449,7 @@ public class LatinIME extends InputMethodService } } if (mPredicting) { - if (mKeyboardSwitcher.getInputView().isShifted() + if (latinKeyboard != null && latinKeyboard.isShifted() && mKeyboardSwitcher.isAlphabetMode() && mComposing.length() == 0) { mWord.setFirstCharCapitalized(true); @@ -1739,7 +1744,8 @@ public class LatinIME extends InputMethodService final List nBest = new ArrayList(); boolean capitalizeFirstWord = preferCapitalization() || (mKeyboardSwitcher.isAlphabetMode() - && mKeyboardSwitcher.getInputView().isShifted()); + && mKeyboardSwitcher.getInputView().getLatinKeyboard() != null + && mKeyboardSwitcher.getInputView().getLatinKeyboard().isShifted()); for (String c : mVoiceResults.candidates) { if (capitalizeFirstWord) { c = Character.toUpperCase(c.charAt(0)) + c.substring(1, c.length()); @@ -1791,7 +1797,10 @@ public class LatinIME extends InputMethodService private void updateSuggestions() { LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); - inputView.getLatinKeyboard().setPreferredLetters(null); + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard != null) { + latinKeyboard.setPreferredLetters(null); + } // Check if we have a suggestion engine attached. if ((mSuggest == null || !isPredictionOn()) && !mVoiceInputHighlighted) { @@ -1813,7 +1822,10 @@ public class LatinIME extends InputMethodService private void showCorrections(WordAlternatives alternatives) { List stringList = alternatives.getAlternatives(); - mKeyboardSwitcher.getInputView().getLatinKeyboard().setPreferredLetters(null); + LatinKeyboard latinKeyboard = mKeyboardSwitcher.getInputView().getLatinKeyboard(); + if (latinKeyboard != null) { + latinKeyboard.setPreferredLetters(null); + } showSuggestions(stringList, alternatives.getOriginalWord(), false, false); } @@ -1829,8 +1841,10 @@ public class LatinIME extends InputMethodService int[] nextLettersFrequencies = mSuggest.getNextLettersFrequencies(); - mKeyboardSwitcher.getInputView().getLatinKeyboard().setPreferredLetters( - nextLettersFrequencies); + LatinKeyboard latinKeyboard = mKeyboardSwitcher.getInputView().getLatinKeyboard(); + if (latinKeyboard != null) { + latinKeyboard.setPreferredLetters(nextLettersFrequencies); + } boolean correctionAvailable = !mInputTypeNoAutoCorrect && mSuggest.hasMinimalCorrection(); //|| mCorrectionMode == mSuggest.CORRECTION_FULL; @@ -2002,11 +2016,12 @@ public class LatinIME extends InputMethodService */ private void pickSuggestion(CharSequence suggestion, boolean correcting) { LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); if (mCapsLock) { suggestion = suggestion.toString().toUpperCase(); } else if (preferCapitalization() || (mKeyboardSwitcher.isAlphabetMode() - && inputView.isShifted())) { + && latinKeyboard != null && latinKeyboard.isShifted())) { suggestion = suggestion.toString().toUpperCase().charAt(0) + suggestion.subSequence(1, suggestion.length()).toString(); } @@ -2018,7 +2033,9 @@ public class LatinIME extends InputMethodService saveWordInHistory(suggestion); mPredicting = false; mCommittedLength = suggestion.length(); - inputView.getLatinKeyboard().setPreferredLetters(null); + if (latinKeyboard != null) { + latinKeyboard.setPreferredLetters(null); + } // If we just corrected a word, then don't show punctuations if (!correcting) { setNextSuggestions(); @@ -2321,7 +2338,10 @@ public class LatinIME extends InputMethodService public void onRelease(int primaryCode) { // Reset any drag flags in the keyboard - mKeyboardSwitcher.getInputView().getLatinKeyboard().keyReleased(); + LatinKeyboard latinKeyboard = mKeyboardSwitcher.getInputView().getLatinKeyboard(); + if (latinKeyboard != null) { + latinKeyboard.keyReleased(); + } //vibrate(); final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 2bf70bf82..b2635ad9c 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -638,34 +638,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return mHasDistinctMultitouch; } - /** - * Sets the state of the shift key of the keyboard, if any. - * @param shifted whether or not to enable the state of the shift key - * @return true if the shift key state changed, false if there was no change - */ - public boolean setShifted(boolean shifted) { - if (mKeyboard != null) { - if (mKeyboard.setShifted(shifted)) { - // The whole keyboard probably needs to be redrawn - invalidateAllKeys(); - return true; - } - } - return false; - } - - /** - * Returns the state of the shift key of the keyboard, if any. - * @return true if the shift is in a pressed state, false otherwise. If there is - * no shift key on the keyboard or there is no keyboard attached, it returns false. - */ - public boolean isShifted() { - if (mKeyboard != null) { - return mKeyboard.isShifted(); - } - return false; - } - /** * Enables or disables the key feedback popup. This is a popup that shows a magnified * version of the depressed key. By default the preview is enabled. @@ -1247,7 +1219,12 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx mMiniKeyboardOriginX = adjustedX + container.getPaddingLeft() - mWindowOffset[0]; mMiniKeyboardOriginY = y + container.getPaddingTop() - mWindowOffset[1]; mMiniKeyboard.setPopupOffset(adjustedX, y); - mMiniKeyboard.setShifted(isShifted()); + // TODO: change the below line to use getLatinKeyboard() instead of getKeyboard() + BaseKeyboard baseMiniKeyboard = mMiniKeyboard.getKeyboard(); + if (baseMiniKeyboard != null && baseMiniKeyboard.setShifted(mKeyboard == null + ? false : mKeyboard.isShifted())) { + mMiniKeyboard.invalidateAllKeys(); + } // Mini keyboard needs no pop-up key preview displayed. mMiniKeyboard.setPreviewEnabled(false); mMiniKeyboardPopup.setContentView(container); -- cgit v1.2.3-83-g751a From eec7bb9386795a740ebbfce39792694373c1c869 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Mon, 25 Oct 2010 23:30:54 +0900 Subject: Get rid of mCapsLock in LatinIME.java Change-Id: I9c6387ee387d53460d23a12225829da344674579 --- .../com/android/inputmethod/latin/LatinIME.java | 80 +++++++++++++--------- 1 file changed, 48 insertions(+), 32 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 07df7eda8..0d2e50b10 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -195,8 +195,6 @@ public class LatinIME extends InputMethodService private boolean mReCorrectionEnabled; private boolean mBigramSuggestionEnabled; private boolean mAutoCorrectOn; - // TODO move this state variable outside LatinIME - private boolean mCapsLock; private boolean mPasswordText; private boolean mVibrateOn; private boolean mSoundOn; @@ -586,7 +584,6 @@ public class LatinIME extends InputMethodService mPredictionOn = false; mCompletionOn = false; mCompletions = null; - mCapsLock = false; mEnteredText = null; switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) { @@ -991,10 +988,11 @@ public class LatinIME extends InputMethodService return true; } LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView == null) break; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) break; // Enable shift key and DPAD to do selections - if (inputView != null && inputView.isShown() - && inputView.getLatinKeyboard() != null - && inputView.getLatinKeyboard().isShifted()) { + if (inputView.isShown() && latinKeyboard.isShifted()) { event = new KeyEvent(event.getDownTime(), event.getEventTime(), event.getAction(), event.getKeyCode(), event.getRepeatCount(), event.getDeviceId(), event.getScanCode(), @@ -1054,9 +1052,13 @@ public class LatinIME extends InputMethodService public void updateShiftKeyState(EditorInfo attr) { InputConnection ic = getCurrentInputConnection(); + LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView == null) return; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) return; if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode()) { - mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || mCapsLock - || getCursorCapsMode(ic, attr) != 0); + mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() + || latinKeyboard.isShiftLocked() || getCursorCapsMode(ic, attr) != 0); } } @@ -1369,14 +1371,13 @@ public class LatinIME extends InputMethodService KeyboardSwitcher switcher = mKeyboardSwitcher; if (switcher.isAlphabetMode()) { LatinKeyboardView inputView = switcher.getInputView(); - if (mCapsLock || forceNormal) { - mCapsLock = false; + if (inputView == null) return; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) return; + if (latinKeyboard.isShiftLocked() || forceNormal) { switcher.setShifted(false); - } else if (inputView != null) { - LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); - if (latinKeyboard != null) { - switcher.setShifted(!latinKeyboard.isShifted()); - } + } else { + switcher.setShifted(!latinKeyboard.isShifted()); } } else { switcher.toggleShift(); @@ -1387,13 +1388,15 @@ public class LatinIME extends InputMethodService mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE); KeyboardSwitcher switcher = mKeyboardSwitcher; if (switcher.isAlphabetMode()) { - if (mCapsLock) { - mCapsLock = false; + LatinKeyboardView inputView = switcher.getInputView(); + if (inputView == null) return; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) return; + if (latinKeyboard.isShiftLocked()) { // LatinKeyboard.setShifted(false) also disable shift locked state. // Note: Caps lock LED is off when Key.on is false. switcher.setShifted(false); } else { - mCapsLock = true; // LatinKeyboard.setShiftLocked(true) enable shift state too. // Note: Caps lock LED is on when Key.on is true. switcher.setShiftLocked(true); @@ -2016,12 +2019,13 @@ public class LatinIME extends InputMethodService */ private void pickSuggestion(CharSequence suggestion, boolean correcting) { LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView == null) return; LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); - if (mCapsLock) { + if (latinKeyboard == null) return; + if (latinKeyboard.isShiftLocked()) { suggestion = suggestion.toString().toUpperCase(); } else if (preferCapitalization() - || (mKeyboardSwitcher.isAlphabetMode() - && latinKeyboard != null && latinKeyboard.isShifted())) { + || (mKeyboardSwitcher.isAlphabetMode() && latinKeyboard.isShifted())) { suggestion = suggestion.toString().toUpperCase().charAt(0) + suggestion.subSequence(1, suggestion.length()).toString(); } @@ -2322,11 +2326,16 @@ public class LatinIME extends InputMethodService vibrate(); playKeyClick(primaryCode); final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); + LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView == null) return; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) return; if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { mShiftKeyState.onPress(); // Not in caps lock mode, shift key is in effect on pressed. - if (mKeyboardSwitcher.isAlphabetMode() && !mCapsLock) + if (mKeyboardSwitcher.isAlphabetMode() && !latinKeyboard.isShiftLocked()) { handleShift(); + } } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { mSymbolKeyState.onPress(); changeKeyboardMode(); @@ -2338,22 +2347,26 @@ public class LatinIME extends InputMethodService public void onRelease(int primaryCode) { // Reset any drag flags in the keyboard - LatinKeyboard latinKeyboard = mKeyboardSwitcher.getInputView().getLatinKeyboard(); - if (latinKeyboard != null) { - latinKeyboard.keyReleased(); - } + LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView == null) return; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) return; + latinKeyboard.keyReleased(); //vibrate(); final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { - if (mShiftKeyState.isMomentary()) + if (mShiftKeyState.isMomentary()) { resetShift(); + } // In caps lock mode, shift key is in effect on released. - if (mKeyboardSwitcher.isAlphabetMode() && mCapsLock) + if (mKeyboardSwitcher.isAlphabetMode() && latinKeyboard.isShiftLocked()) { handleShift(); + } mShiftKeyState.onRelease(); } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { - if (mSymbolKeyState.isMomentary()) + if (mSymbolKeyState.isMomentary()) { changeKeyboardMode(); + } mSymbolKeyState.onRelease(); } } @@ -2656,8 +2669,12 @@ public class LatinIME extends InputMethodService private void changeKeyboardMode() { mKeyboardSwitcher.toggleSymbols(); - if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) { - mKeyboardSwitcher.setShiftLocked(mCapsLock); + LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); + if (inputView == null) return; + LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); + if (latinKeyboard == null) return; + if (latinKeyboard.isShiftLocked() && mKeyboardSwitcher.isAlphabetMode()) { + mKeyboardSwitcher.setShiftLocked(true); } updateShiftKeyState(getCurrentInputEditorInfo()); @@ -2677,7 +2694,6 @@ public class LatinIME extends InputMethodService final Printer p = new PrintWriterPrinter(fout); p.println("LatinIME state :"); p.println(" Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode()); - p.println(" mCapsLock=" + mCapsLock); p.println(" mComposing=" + mComposing.toString()); p.println(" mPredictionOn=" + mPredictionOn); p.println(" mCorrectionMode=" + mCorrectionMode); -- cgit v1.2.3-83-g751a From 276845c7a9ea90fd34289d060873c8e3a7ed342c Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Tue, 26 Oct 2010 19:04:48 +0900 Subject: Follow-up change to revise Caps Lock sequence. bug: 3122877 Change-Id: I44c539d7c041443f3ad027de4b75a67adf6b2c87 --- java/res/values/config.xml | 2 +- .../inputmethod/latin/KeyboardSwitcher.java | 15 ++++++------- .../com/android/inputmethod/latin/LatinIME.java | 25 +++++++++++++++------- .../inputmethod/latin/ModifierKeyState.java | 21 ++++++++++++++++-- 4 files changed, 44 insertions(+), 19 deletions(-) (limited to 'java/src') diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 410d34b00..af145a629 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -28,7 +28,7 @@ 400 50 400 - 1000 + 1200 800 diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index a5a262ec7..dcbdba13d 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -391,18 +391,17 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } public void setShifted(boolean shifted) { - if (mInputView != null) { - LatinKeyboard latinKeyboard = mInputView.getLatinKeyboard(); - if (latinKeyboard != null && latinKeyboard.setShifted(shifted)) { - mInputView.invalidateAllKeys(); - } + if (mInputView == null) return; + LatinKeyboard latinKeyboard = mInputView.getLatinKeyboard(); + if (latinKeyboard == null) return; + if (latinKeyboard.setShifted(shifted)) { + mInputView.invalidateAllKeys(); } } public void setShiftLocked(boolean shiftLocked) { - if (mInputView != null) { - mInputView.setShiftLocked(shiftLocked); - } + if (mInputView == null) return; + mInputView.setShiftLocked(shiftLocked); } public void toggleShift() { diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 0d2e50b10..6d8803148 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -151,7 +151,6 @@ public class LatinIME extends InputMethodService private static final int POS_METHOD = 0; private static final int POS_SETTINGS = 1; - //private LatinKeyboardView mInputView; private LinearLayout mCandidateViewContainer; private CandidateView mCandidateView; private Suggest mSuggest; @@ -1056,7 +1055,8 @@ public class LatinIME extends InputMethodService if (inputView == null) return; LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); if (latinKeyboard == null) return; - if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode()) { + if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode() + && !mShiftKeyState.isIgnoring()) { mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || latinKeyboard.isShiftLocked() || getCursorCapsMode(ic, attr) != 0); } @@ -2331,9 +2331,12 @@ public class LatinIME extends InputMethodService LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); if (latinKeyboard == null) return; if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_SHIFT) { - mShiftKeyState.onPress(); - // Not in caps lock mode, shift key is in effect on pressed. - if (mKeyboardSwitcher.isAlphabetMode() && !latinKeyboard.isShiftLocked()) { + // In alphabet mode, we call handleShift() to go into the shifted mode in this + // method, onPress(), only when we are in the small letter mode. + if (mKeyboardSwitcher.isAlphabetMode() && latinKeyboard.isShifted()) { + mShiftKeyState.onPressOnShifted(); + } else { + mShiftKeyState.onPress(); handleShift(); } } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { @@ -2345,6 +2348,8 @@ public class LatinIME extends InputMethodService } } + // TODO: Bug - onRelease() could be dropped if the user slides finger out of the key. It's OK + // for general keys, but we need to obtain onRelease() for the shift key even in such case. public void onRelease(int primaryCode) { // Reset any drag flags in the keyboard LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); @@ -2358,9 +2363,13 @@ public class LatinIME extends InputMethodService if (mShiftKeyState.isMomentary()) { resetShift(); } - // In caps lock mode, shift key is in effect on released. - if (mKeyboardSwitcher.isAlphabetMode() && latinKeyboard.isShiftLocked()) { - handleShift(); + if (mKeyboardSwitcher.isAlphabetMode()) { + // In alphabet mode, we call handleShift() to go into the small letter mode in this + // method, onRelease(), only when we are in the shifted modes -- temporary shifted + // mode or caps lock mode. + if (latinKeyboard.isShifted() && mShiftKeyState.isPressingOnShifted()) { + handleShift(); + } } mShiftKeyState.onRelease(); } else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) { diff --git a/java/src/com/android/inputmethod/latin/ModifierKeyState.java b/java/src/com/android/inputmethod/latin/ModifierKeyState.java index 097e87abe..75820e7d3 100644 --- a/java/src/com/android/inputmethod/latin/ModifierKeyState.java +++ b/java/src/com/android/inputmethod/latin/ModifierKeyState.java @@ -19,7 +19,9 @@ package com.android.inputmethod.latin; class ModifierKeyState { private static final int RELEASING = 0; private static final int PRESSING = 1; - private static final int MOMENTARY = 2; + private static final int PRESSING_ON_SHIFTED = 2; // both temporary shifted & shift locked + private static final int MOMENTARY = 3; + private static final int IGNORING = 4; private int mState = RELEASING; @@ -27,16 +29,31 @@ class ModifierKeyState { mState = PRESSING; } + public void onPressOnShifted() { + mState = PRESSING_ON_SHIFTED; + } + public void onRelease() { mState = RELEASING; } public void onOtherKeyPressed() { - if (mState == PRESSING) + if (mState == PRESSING) { mState = MOMENTARY; + } else if (mState == PRESSING_ON_SHIFTED) { + mState = IGNORING; + } } public boolean isMomentary() { return mState == MOMENTARY; } + + public boolean isPressingOnShifted() { + return mState == PRESSING_ON_SHIFTED; + } + + public boolean isIgnoring() { + return mState == IGNORING; + } } -- cgit v1.2.3-83-g751a From 8252de1a60cffd859ac1d44cd6c061f78e59a078 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Wed, 27 Oct 2010 14:10:36 +0900 Subject: Remove auto capitalization by Shift+puncs bug: 3133312 Change-Id: I12a05d9028ab2fad07e1819407d63cf8ffd4d30c --- java/src/com/android/inputmethod/latin/LatinIME.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6d8803148..a0d797c42 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2022,13 +2022,6 @@ public class LatinIME extends InputMethodService if (inputView == null) return; LatinKeyboard latinKeyboard = inputView.getLatinKeyboard(); if (latinKeyboard == null) return; - if (latinKeyboard.isShiftLocked()) { - suggestion = suggestion.toString().toUpperCase(); - } else if (preferCapitalization() - || (mKeyboardSwitcher.isAlphabetMode() && latinKeyboard.isShifted())) { - suggestion = suggestion.toString().toUpperCase().charAt(0) - + suggestion.subSequence(1, suggestion.length()).toString(); - } InputConnection ic = getCurrentInputConnection(); if (ic != null) { rememberReplacedWord(suggestion); -- cgit v1.2.3-83-g751a From fd0bd57deb53c4cce32810a61133fa44b45dbb7b Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Wed, 27 Oct 2010 18:05:27 +0900 Subject: Change suggestion update delay from 100ms to 180ms to avoid flashy suggestion strip with quick multi-finger typing. bug: 3122641 Change-Id: I385f9eb2e392487d7b4c252553d1f8d7c21da2e4 --- java/src/com/android/inputmethod/latin/LatinIME.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index a0d797c42..3663442d4 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -137,6 +137,9 @@ public class LatinIME extends InputMethodService private static final int MSG_VOICE_RESULTS = 3; private static final int MSG_UPDATE_OLD_SUGGESTIONS = 4; + private static final int DELAY_UPDATE_SUGGESTIONS = 180; + private static final int DELAY_UPDATE_OLD_SUGGESTIONS = 300; + // How many continuous deletes at which to start deleting at a higher speed. private static final int DELETE_ACCELERATE_AT = 20; // Key events coming any faster than this are long-presses. @@ -1581,12 +1584,14 @@ public class LatinIME extends InputMethodService private void postUpdateSuggestions() { mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS); - mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_SUGGESTIONS), 100); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_SUGGESTIONS), + DELAY_UPDATE_SUGGESTIONS); } private void postUpdateOldSuggestions() { mHandler.removeMessages(MSG_UPDATE_OLD_SUGGESTIONS); - mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_OLD_SUGGESTIONS), 300); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_OLD_SUGGESTIONS), + DELAY_UPDATE_OLD_SUGGESTIONS); } private boolean isPredictionOn() { -- cgit v1.2.3-83-g751a From 9dce586eaa8a99fac05da398694d6e26b2a6dfa8 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 29 Oct 2010 03:15:02 +0900 Subject: Bugfix: IME gives haptic feedback when button wasn't pressed bug: 3142416 Change-Id: If7630b89d6c2a8ec38e191c263c03f8f11d3c498 --- java/src/com/android/inputmethod/latin/PointerTracker.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index 448e27910..f6fd5bd7a 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -272,11 +272,12 @@ public class PointerTracker { mIsRepeatableKey = false; checkMultiTap(eventTime, keyIndex); if (mListener != null) { - int primaryCode = isValidKeyIndex(keyIndex) ? mKeys[keyIndex].codes[0] : 0; - mListener.onPress(primaryCode); - // This onPress call may have changed keyboard layout and have updated mKeyIndex. - // If that's the case, mKeyIndex has been updated in setKeyboard(). - keyIndex = mKeyState.getKeyIndex(); + if (isValidKeyIndex(keyIndex)) { + mListener.onPress(mKeys[keyIndex].codes[0]); + // This onPress call may have changed keyboard layout and have updated mKeyIndex. + // If that's the case, mKeyIndex has been updated in setKeyboard(). + keyIndex = mKeyState.getKeyIndex(); + } } if (isValidKeyIndex(keyIndex)) { if (mKeys[keyIndex].repeatable) { -- cgit v1.2.3-83-g751a From 74103ee1b92349eee7b13f3958f494655300b925 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 29 Oct 2010 18:05:07 +0900 Subject: Increased the size of GRID in Keyboard Bug: 3122894 - Changed width 10 -> 32 - Changed height 5 -> 16 Change-Id: I07354cf5c942974cc25a5e043f41e0f13a09351b --- java/res/values/config.xml | 2 ++ .../android/inputmethod/latin/BaseKeyboard.java | 25 ++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'java/src') diff --git a/java/res/values/config.xml b/java/res/values/config.xml index af145a629..456d9ad4d 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -27,6 +27,8 @@ 100 400 50 + 32 + 16 400 1200 800 diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index cb41ad047..266300eb3 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -109,9 +109,9 @@ public class BaseKeyboard { // Variables for pre-computing nearest keys. - private static final int GRID_WIDTH = 10; - private static final int GRID_HEIGHT = 5; - private static final int GRID_SIZE = GRID_WIDTH * GRID_HEIGHT; + private final int GRID_WIDTH; + private final int GRID_HEIGHT; + private final int GRID_SIZE; private int mCellWidth; private int mCellHeight; private int[][] mGridNeighbors; @@ -466,6 +466,11 @@ public class BaseKeyboard { * @param height sets height of keyboard */ public BaseKeyboard(Context context, int xmlLayoutResId, int modeId, int width, int height) { + Resources res = context.getResources(); + GRID_WIDTH = res.getInteger(R.integer.config_keyboard_grid_width); + GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height); + GRID_SIZE = GRID_WIDTH * GRID_HEIGHT; + mDisplayWidth = width; mDisplayHeight = height; @@ -485,17 +490,9 @@ public class BaseKeyboard { * @param modeId keyboard mode identifier */ public BaseKeyboard(Context context, int xmlLayoutResId, int modeId) { - DisplayMetrics dm = context.getResources().getDisplayMetrics(); - mDisplayWidth = dm.widthPixels; - mDisplayHeight = dm.heightPixels; - //Log.v(TAG, "keyboard's display metrics:" + dm); - - mDefaultHorizontalGap = 0; - setKeyWidth(mDisplayWidth / 10); - mDefaultVerticalGap = 0; - mDefaultHeight = mDefaultWidth; - mKeyboardMode = modeId; - loadKeyboard(context, xmlLayoutResId); + this(context, xmlLayoutResId, modeId, + context.getResources().getDisplayMetrics().widthPixels, + context.getResources().getDisplayMetrics().heightPixels); } /** -- cgit v1.2.3-83-g751a From 69db35c493aa3a6a9f17094bf2180a52ffb2358e Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Fri, 29 Oct 2010 18:59:37 +0900 Subject: Make the buttons work for edge pixels of the keyboard Follow-up change to If7630b89 bug: 3142416 Change-Id: I2660e3d688eb0490363e460d5b4944c89b8ca35c --- java/src/com/android/inputmethod/latin/LatinKeyboard.java | 4 +++- java/src/com/android/inputmethod/latin/ProximityKeyDetector.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java index 096f3e702..45a4a9508 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java @@ -797,7 +797,9 @@ public class LatinKeyboard extends Keyboard { if (mCurrentlyInSpace) { return new int[] { mSpaceKeyIndex }; } else { - return super.getNearestKeys(x, y); + // Avoid dead pixels at edges of the keyboard + return super.getNearestKeys(Math.max(0, Math.min(x, getMinWidth() - 1)), + Math.max(0, Math.min(y, getHeight() - 1))); } } diff --git a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java index d17bedb56..325ce674c 100644 --- a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java +++ b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java @@ -83,4 +83,4 @@ class ProximityKeyDetector extends KeyDetector { } return primaryIndex; } -} \ No newline at end of file +} -- cgit v1.2.3-83-g751a From 200ece79070750ba702a071908d990f8d1c41f02 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Mon, 1 Nov 2010 20:25:07 +0900 Subject: Capitalization for "Quick Fixes" words doesn't work bug: 3151706 Change-Id: I7770a1d26edb1ea72ee93396181953a724dcc4bf --- .../src/com/android/inputmethod/latin/Suggest.java | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 01782339f..29c3eea5f 100755 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -337,8 +337,25 @@ public class Suggest implements Dictionary.WordCallback { String suggestedWord = mSuggestions.get(i).toString().toLowerCase(); CharSequence autoText = AutoText.get(suggestedWord, 0, suggestedWord.length(), view); - // Is there an AutoText correction? + // Is there an AutoText (also known as Quick Fixes) correction? boolean canAdd = autoText != null; + // Capitalize as needed + final int autoTextLength = autoText != null ? autoText.length() : 0; + if (autoTextLength > 0 && (mIsAllUpperCase || mIsFirstCharCapitalized)) { + int poolSize = mStringPool.size(); + StringBuilder sb = poolSize > 0 ? (StringBuilder) mStringPool.remove( + poolSize - 1) : new StringBuilder(getApproxMaxWordLength()); + sb.setLength(0); + if (mIsAllUpperCase) { + sb.append(autoText.toString().toUpperCase()); + } else if (mIsFirstCharCapitalized) { + sb.append(Character.toUpperCase(autoText.charAt(0))); + if (autoTextLength > 1) { + sb.append(autoText.subSequence(1, autoTextLength)); + } + } + autoText = sb.toString(); + } // Is that correction already the current prediction (or original word)? canAdd &= !TextUtils.equals(autoText, mSuggestions.get(i)); // Is that correction already the next predicted word? @@ -461,8 +478,7 @@ public class Suggest implements Dictionary.WordCallback { return true; } - System.arraycopy(priorities, pos, priorities, pos + 1, - prefMaxSuggestions - pos - 1); + System.arraycopy(priorities, pos, priorities, pos + 1, prefMaxSuggestions - pos - 1); priorities[pos] = freq; int poolSize = mStringPool.size(); StringBuilder sb = poolSize > 0 ? (StringBuilder) mStringPool.remove(poolSize - 1) -- cgit v1.2.3-83-g751a From 17fcd719de9a0ddcf9fd712481b28038419eec4e Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Tue, 2 Nov 2010 18:55:20 +0900 Subject: Make sure there are no modes with settings key on tablet. Follow-up change to I73b8a502 bug: 3095814 Change-Id: I79bb05c61dc73b036331e17d02c791f08a0168fc --- .../inputmethod/latin/KeyboardSwitcher.java | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index dcbdba13d..a79cc2b22 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -162,8 +162,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha private static final int SETTINGS_KEY_MODE_AUTO = R.string.settings_key_mode_auto; private static final int SETTINGS_KEY_MODE_ALWAYS_SHOW = R.string.settings_key_mode_always_show; - private static final int SETTINGS_KEY_MODE_ALWAYS_HIDE = - R.string.settings_key_mode_always_hide; + // NOTE: No need to have SETTINGS_KEY_MODE_ALWAYS_HIDE here because it's not being referred to + // in the source code now. + // Default is SETTINGS_KEY_MODE_AUTO. + private static final int DEFAULT_SETTINGS_KEY_MODE = SETTINGS_KEY_MODE_AUTO; private int mLastDisplayWidth; private LanguageSwitcher mLanguageSwitcher; @@ -546,18 +548,18 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha Resources resources = mInputMethodService.getResources(); final boolean showSettingsKeyOption = resources.getBoolean( R.bool.config_enable_show_settings_key_option); - final int defaultSettingsKeyMode = showSettingsKeyOption - ? SETTINGS_KEY_MODE_AUTO : SETTINGS_KEY_MODE_ALWAYS_HIDE; - final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY, - resources.getString(defaultSettingsKeyMode)); - // We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or - // 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system - if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW)) - || (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO)) - && LatinIMEUtil.hasMultipleEnabledIMEs(mInputMethodService))) { - mHasSettingsKey = true; - } else { - mHasSettingsKey = false; + if (showSettingsKeyOption) { + final String settingsKeyMode = prefs.getString(LatinIMESettings.PREF_SETTINGS_KEY, + resources.getString(DEFAULT_SETTINGS_KEY_MODE)); + // We show the settings key when 1) SETTINGS_KEY_MODE_ALWAYS_SHOW or + // 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system + if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW)) + || (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO)) + && LatinIMEUtil.hasMultipleEnabledIMEs(mInputMethodService))) { + mHasSettingsKey = true; + return; + } } + mHasSettingsKey = false; } } -- cgit v1.2.3-83-g751a From 47f795dc8709f95b35888fbcca80c0c18dbe63ed Mon Sep 17 00:00:00 2001 From: Leon Scroggins Date: Tue, 2 Nov 2010 14:34:45 -0400 Subject: Treat the new web fields like their corresponding variations. Bug:2692655 Bug:2460543 Change-Id: I86e814902447ecd5c8b00e399a0143d3dc2ad2cf --- .../src/com/android/inputmethod/latin/LatinIME.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'java/src') diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 3663442d4..5edbc2861 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -548,6 +548,17 @@ public class LatinIME extends InputMethodService return mCandidateViewContainer; } + private static boolean isPasswordVariation(int variation) { + return variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD + || variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD + || variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD; + } + + private static boolean isEmailVariation(int variation) { + return variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS + || variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; + } + @Override public void onStartInputView(EditorInfo attribute, boolean restarting) { LatinKeyboardView inputView = mKeyboardSwitcher.getInputView(); @@ -570,8 +581,7 @@ public class LatinIME extends InputMethodService // the switch statement) whether we want to enable the voice button. mPasswordText = false; int variation = attribute.inputType & EditorInfo.TYPE_MASK_VARIATION; - if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD || - variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) { + if (isPasswordVariation(variation)) { mPasswordText = true; } @@ -605,17 +615,16 @@ public class LatinIME extends InputMethodService //startPrediction(); mPredictionOn = true; // Make sure that passwords are not displayed in candidate view - if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD || - variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD ) { + if (isPasswordVariation(variation)) { mPredictionOn = false; } - if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS + if (isEmailVariation(variation) || variation == EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME) { mAutoSpace = false; } else { mAutoSpace = true; } - if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS) { + if (isEmailVariation(variation)) { mPredictionOn = false; mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_EMAIL, attribute.imeOptions, enableVoiceButton); -- cgit v1.2.3-83-g751a From 68864723cf8d8e48385bfcaf30237fba25a8895a Mon Sep 17 00:00:00 2001 From: Tadashi Takaoka Date: Fri, 5 Nov 2010 18:30:22 +0900 Subject: Rename LatinKeyboardBaseView class to KeyboardBaseView Change-Id: I496ecbfa7d398583d01f821398f49f75d17311d8 --- java/res/layout/input_stone_popup.xml | 4 +- java/res/layout/keyboard_popup.xml | 4 +- java/res/values/attrs.xml | 2 +- java/res/values/styles.xml | 2 +- .../inputmethod/latin/BaseKeyboardView.java | 1480 ++++++++++++++++++++ .../com/android/inputmethod/latin/KeyDetector.java | 2 +- .../com/android/inputmethod/latin/LatinIME.java | 8 +- .../inputmethod/latin/LatinKeyboardBaseView.java | 1480 -------------------- .../inputmethod/latin/LatinKeyboardView.java | 6 +- .../inputmethod/latin/MiniKeyboardKeyDetector.java | 4 +- .../android/inputmethod/latin/PointerTracker.java | 6 +- .../inputmethod/latin/ProximityKeyDetector.java | 6 +- 12 files changed, 1502 insertions(+), 1502 deletions(-) create mode 100644 java/src/com/android/inputmethod/latin/BaseKeyboardView.java delete mode 100644 java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java (limited to 'java/src') diff --git a/java/res/layout/input_stone_popup.xml b/java/res/layout/input_stone_popup.xml index f159625f7..3a7b5b9ab 100644 --- a/java/res/layout/input_stone_popup.xml +++ b/java/res/layout/input_stone_popup.xml @@ -25,9 +25,9 @@ android:orientation="horizontal" android:background="@drawable/keyboard_popup_panel_background" > - - - + diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 0372b07cf..d2acafdfa 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -15,7 +15,7 @@ --> -