aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/drawable-hdpi/more_suggestions_divider.pngbin0 -> 1034 bytes
-rw-r--r--java/res/drawable-hdpi/suggestions_strip_divider.png (renamed from java/res/drawable-hdpi/keyboard_suggest_strip_divider.png)bin1012 -> 1012 bytes
-rw-r--r--java/res/drawable-mdpi/more_suggestions_divider.pngbin0 -> 2940 bytes
-rw-r--r--java/res/drawable-mdpi/suggestions_strip_divider.png (renamed from java/res/drawable-mdpi/keyboard_suggest_strip_divider.png)bin2812 -> 2812 bytes
-rw-r--r--java/res/drawable-xhdpi/more_suggestions_divider.pngbin0 -> 1053 bytes
-rw-r--r--java/res/drawable-xhdpi/suggestions_strip_divider.pngbin0 -> 1066 bytes
-rw-r--r--java/res/layout/suggestion_divider.xml2
-rw-r--r--java/res/xml-sw600dp/kbd_rows_symbols_shift.xml8
-rw-r--r--java/res/xml-sw768dp/kbd_rows_symbols_shift.xml10
-rw-r--r--java/res/xml/kbd_currency_dollar_key_styles.xml38
-rw-r--r--java/res/xml/kbd_currency_euro_key_styles.xml39
-rw-r--r--java/res/xml/kbd_currency_key_styles.xml60
-rw-r--r--java/res/xml/kbd_rows_symbols_shift.xml8
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java7
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java27
-rw-r--r--java/src/com/android/inputmethod/latin/MoreSuggestions.java55
-rw-r--r--java/src/com/android/inputmethod/latin/MoreSuggestionsView.java29
-rw-r--r--java/src/com/android/inputmethod/latin/SubtypeSwitcher.java11
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestionsView.java4
19 files changed, 237 insertions, 61 deletions
diff --git a/java/res/drawable-hdpi/more_suggestions_divider.png b/java/res/drawable-hdpi/more_suggestions_divider.png
new file mode 100644
index 000000000..a5912f95c
--- /dev/null
+++ b/java/res/drawable-hdpi/more_suggestions_divider.png
Binary files differ
diff --git a/java/res/drawable-hdpi/keyboard_suggest_strip_divider.png b/java/res/drawable-hdpi/suggestions_strip_divider.png
index 7ca3e6131..7ca3e6131 100644
--- a/java/res/drawable-hdpi/keyboard_suggest_strip_divider.png
+++ b/java/res/drawable-hdpi/suggestions_strip_divider.png
Binary files differ
diff --git a/java/res/drawable-mdpi/more_suggestions_divider.png b/java/res/drawable-mdpi/more_suggestions_divider.png
new file mode 100644
index 000000000..a46284f21
--- /dev/null
+++ b/java/res/drawable-mdpi/more_suggestions_divider.png
Binary files differ
diff --git a/java/res/drawable-mdpi/keyboard_suggest_strip_divider.png b/java/res/drawable-mdpi/suggestions_strip_divider.png
index 363936362..363936362 100644
--- a/java/res/drawable-mdpi/keyboard_suggest_strip_divider.png
+++ b/java/res/drawable-mdpi/suggestions_strip_divider.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/more_suggestions_divider.png b/java/res/drawable-xhdpi/more_suggestions_divider.png
new file mode 100644
index 000000000..178594bf0
--- /dev/null
+++ b/java/res/drawable-xhdpi/more_suggestions_divider.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/suggestions_strip_divider.png b/java/res/drawable-xhdpi/suggestions_strip_divider.png
new file mode 100644
index 000000000..157513e14
--- /dev/null
+++ b/java/res/drawable-xhdpi/suggestions_strip_divider.png
Binary files differ
diff --git a/java/res/layout/suggestion_divider.xml b/java/res/layout/suggestion_divider.xml
index e38a725b1..a8b78c082 100644
--- a/java/res/layout/suggestion_divider.xml
+++ b/java/res/layout/suggestion_divider.xml
@@ -22,6 +22,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:src="@drawable/keyboard_suggest_strip_divider"
+ android:src="@drawable/suggestions_strip_divider"
android:padding="0dp"
android:gravity="center" />
diff --git a/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml b/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
index 3d62eff7e..73fdf2d3c 100644
--- a/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
+++ b/java/res/xml-sw600dp/kbd_rows_symbols_shift.xml
@@ -23,6 +23,8 @@
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_key_styles" />
<Row
latin:keyWidth="9.0%p"
>
@@ -61,11 +63,11 @@
latin:keyLabel="£"
latin:keyXPos="4.5%p" />
<Key
- latin:keyLabel="¢" />
+ latin:keyStyle="moreCurrency1KeyStyle" />
<Key
- latin:keyLabel="€" />
+ latin:keyStyle="moreCurrency2KeyStyle" />
<Key
- latin:keyLabel="¥" />
+ latin:keyStyle="moreCurrency3KeyStyle" />
<Key
latin:keyLabel="^"
latin:moreKeys="↑,↓,←,→" />
diff --git a/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml b/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
index 30f72ac46..ec78d579f 100644
--- a/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
+++ b/java/res/xml-sw768dp/kbd_rows_symbols_shift.xml
@@ -23,6 +23,8 @@
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_key_styles" />
<Row
latin:keyWidth="8.282%p"
>
@@ -66,13 +68,13 @@
latin:keyLabelOption="alignLeft"
latin:keyWidth="11.172%p" />
<Key
- latin:keyLabel="£" />
+ latin:keyStyle="moreCurrency1KeyStyle" />
<Key
- latin:keyLabel="¢" />
+ latin:keyStyle="moreCurrency2KeyStyle" />
<Key
- latin:keyLabel="€" />
+ latin:keyStyle="moreCurrency3KeyStyle" />
<Key
- latin:keyLabel="¥" />
+ latin:keyStyle="moreCurrency4KeyStyle" />
<Key
latin:keyLabel="^"
latin:moreKeys="↑,↓,←,→" />
diff --git a/java/res/xml/kbd_currency_dollar_key_styles.xml b/java/res/xml/kbd_currency_dollar_key_styles.xml
new file mode 100644
index 000000000..d5dca2afa
--- /dev/null
+++ b/java/res/xml/kbd_currency_dollar_key_styles.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+
+<merge xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ <key-style
+ latin:styleName="currencyKeyStyle"
+ latin:keyLabel="$"
+ latin:moreKeys="@string/more_keys_for_currency_dollar" />
+ <key-style
+ latin:styleName="moreCurrency1KeyStyle"
+ latin:keyLabel="£" />
+ <key-style
+ latin:styleName="moreCurrency2KeyStyle"
+ latin:keyLabel="¢" />
+ <key-style
+ latin:styleName="moreCurrency3KeyStyle"
+ latin:keyLabel="€" />
+ <key-style
+ latin:styleName="moreCurrency4KeyStyle"
+ latin:keyLabel="¥" />
+</merge>
diff --git a/java/res/xml/kbd_currency_euro_key_styles.xml b/java/res/xml/kbd_currency_euro_key_styles.xml
new file mode 100644
index 000000000..6edddf074
--- /dev/null
+++ b/java/res/xml/kbd_currency_euro_key_styles.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+
+<merge xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin">
+ <key-style
+ latin:styleName="currencyKeyStyle"
+ latin:keyLabel="€"
+ latin:moreKeys="@string/more_keys_for_currency_euro" />
+ <key-style
+ latin:styleName="moreCurrency1KeyStyle"
+ latin:keyLabel="£" />
+ <key-style
+ latin:styleName="moreCurrency2KeyStyle"
+ latin:keyLabel="¥" />
+ <key-style
+ latin:styleName="moreCurrency3KeyStyle"
+ latin:keyLabel="$"
+ latin:moreKeys="¢" />
+ <key-style
+ latin:styleName="moreCurrency4KeyStyle"
+ latin:keyLabel="¢" />
+</merge>
diff --git a/java/res/xml/kbd_currency_key_styles.xml b/java/res/xml/kbd_currency_key_styles.xml
index bcdfe5639..225888337 100644
--- a/java/res/xml/kbd_currency_key_styles.xml
+++ b/java/res/xml/kbd_currency_key_styles.xml
@@ -25,9 +25,8 @@
<case
latin:passwordInput="true"
>
- <key-style
- latin:styleName="currencyKeyStyle"
- latin:keyLabel="$" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_dollar_key_styles" />
</case>
<!-- Countries using Euro currency, 23 countries as for January 2011. -->
1. Andorra (ca_AD, ca_ES)
@@ -54,31 +53,28 @@
22. Spain (es_ES, ca_ES)
23. Vatican City (it_VA)
-->
+ <!-- Though Denmark and Turkey don't using Euro as their currencies, but having Euro sign on
+ the symbol keyboard might be useful. Especially Danish krone (kr) and Turkish lira
+ (TL) can be represented by usual alphabet letters. -->
<!-- Note: Some locales may not have country code, and it it supposed to indicate the
country where the language originally/mainly spoken. -->
<case
- latin:localeCode="de|es|el|fi|fr|it|nl|sk|sl|pt_PT"
+ latin:localeCode="da|de|es|el|fi|fr|it|nl|sk|sl|pt_PT|tr"
>
- <key-style
- latin:styleName="currencyKeyStyle"
- latin:keyLabel="€"
- latin:moreKeys="@string/more_keys_for_currency_euro" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_euro_key_styles" />
</case>
<case
latin:languageCode="ca|et|lb|mt|sla"
>
- <key-style
- latin:styleName="currencyKeyStyle"
- latin:keyLabel="€"
- latin:moreKeys="@string/more_keys_for_currency_euro" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_euro_key_styles" />
</case>
<case
latin:countryCode="AD|AT|BE|CY|EE|FI|FR|DE|GR|IE|IT|XK|LU|MT|MO|ME|NL|PT|SM|SK|SI|ES|VA"
>
- <key-style
- latin:styleName="currencyKeyStyle"
- latin:keyLabel="€"
- latin:moreKeys="@string/more_keys_for_currency_euro" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_euro_key_styles" />
</case>
<case
latin:languageCode="iw"
@@ -87,6 +83,19 @@
latin:styleName="currencyKeyStyle"
latin:keyLabel="₪"
latin:moreKeys="@string/more_keys_for_currency_general" />
+ <key-style
+ latin:styleName="moreCurrency1KeyStyle"
+ latin:keyLabel="£" />
+ <key-style
+ latin:styleName="moreCurrency2KeyStyle"
+ latin:keyLabel="€" />
+ <key-style
+ latin:styleName="moreCurrency3KeyStyle"
+ latin:keyLabel="$"
+ latin:moreKeys="¢" />
+ <key-style
+ latin:styleName="moreCurrency4KeyStyle"
+ latin:keyLabel="¢" />
</case>
<!-- United Kingdom -->
<case
@@ -96,12 +105,23 @@
latin:styleName="currencyKeyStyle"
latin:keyLabel="£"
latin:moreKeys="@string/more_keys_for_currency_pound" />
- </case>
- <default>
<key-style
- latin:styleName="currencyKeyStyle"
+ latin:styleName="moreCurrency1KeyStyle"
+ latin:keyLabel="€" />
+ <key-style
+ latin:styleName="moreCurrency2KeyStyle"
+ latin:keyLabel="¥" />
+ <key-style
+ latin:styleName="moreCurrency3KeyStyle"
latin:keyLabel="$"
- latin:moreKeys="@string/more_keys_for_currency_dollar" />
+ latin:moreKeys="¢" />
+ <key-style
+ latin:styleName="moreCurrency4KeyStyle"
+ latin:keyLabel="¢" />
+ </case>
+ <default>
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_dollar_key_styles" />
</default>
</switch>
</merge>
diff --git a/java/res/xml/kbd_rows_symbols_shift.xml b/java/res/xml/kbd_rows_symbols_shift.xml
index 66c14fea3..58ae72c6d 100644
--- a/java/res/xml/kbd_rows_symbols_shift.xml
+++ b/java/res/xml/kbd_rows_symbols_shift.xml
@@ -23,6 +23,8 @@
>
<include
latin:keyboardLayout="@xml/kbd_key_styles" />
+ <include
+ latin:keyboardLayout="@xml/kbd_currency_key_styles" />
<Row
latin:keyWidth="10%p"
>
@@ -56,11 +58,11 @@
<Key
latin:keyStyle="nonSpecialBackgroundTabKeyStyle" />
<Key
- latin:keyLabel="£" />
+ latin:keyStyle="moreCurrency1KeyStyle" />
<Key
- latin:keyLabel="¢" />
+ latin:keyStyle="moreCurrency2KeyStyle" />
<Key
- latin:keyLabel="€" />
+ latin:keyStyle="moreCurrency3KeyStyle" />
<Key
latin:keyLabel="°"
latin:moreKeys="′,″" />
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 735caaebb..4ccb27e4c 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -573,6 +573,13 @@ public class Key {
super(res, params, row, parser, keyStyles);
}
+ /**
+ * This constructor is being used only for divider in more keys keyboard.
+ */
+ public Spacer(KeyboardParams params, Drawable icon, int x, int y, int width, int height) {
+ super(params, null, null, icon, Keyboard.CODE_DUMMY, null, x, y, width, height, 0);
+ }
+
@Override
public boolean isSpacer() {
return true;
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 08af5c5e3..b467a32a2 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -35,7 +35,6 @@ import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.text.InputType;
import android.text.TextUtils;
-import android.util.DisplayMetrics;
import android.util.Log;
import android.util.PrintWriterPrinter;
import android.util.Printer;
@@ -1011,8 +1010,12 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
- if (event.getRepeatCount() == 0 && mKeyboardSwitcher.getKeyboardView() != null) {
- if (mKeyboardSwitcher.getKeyboardView().handleBack()) {
+ if (event.getRepeatCount() == 0) {
+ if (mSuggestionsView != null && mSuggestionsView.handleBack()) {
+ return true;
+ }
+ final LatinKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
+ if (keyboardView != null && keyboardView.handleBack()) {
return true;
}
}
@@ -1872,14 +1875,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return;
}
- final boolean selectedATypedWordAndItsInUserUnigramDic =
- !selectedANotTypedWord && mUserUnigramDictionary.isValidWord(suggestion);
- final boolean isValidWord = AutoCorrection.isValidWord(
- mSuggest.getUnigramDictionaries(), suggestion, true);
- final boolean needsToAddToUserUnigramDictionary = selectedATypedWordAndItsInUserUnigramDic
- || !isValidWord;
- if (needsToAddToUserUnigramDictionary) {
- mUserUnigramDictionary.addWord(suggestion.toString(), frequencyDelta);
+ if (null != mSuggest && null != mUserUnigramDictionary) {
+ final boolean selectedATypedWordAndItsInUserUnigramDic =
+ !selectedANotTypedWord && mUserUnigramDictionary.isValidWord(suggestion);
+ final boolean isValidWord = AutoCorrection.isValidWord(
+ mSuggest.getUnigramDictionaries(), suggestion, true);
+ final boolean needsToAddToUserUnigramDictionary =
+ selectedATypedWordAndItsInUserUnigramDic || !isValidWord;
+ if (needsToAddToUserUnigramDictionary) {
+ mUserUnigramDictionary.addWord(suggestion.toString(), frequencyDelta);
+ }
}
if (mUserBigramDictionary != null) {
diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/MoreSuggestions.java
index 10d5b5c48..24011c41e 100644
--- a/java/src/com/android/inputmethod/latin/MoreSuggestions.java
+++ b/java/src/com/android/inputmethod/latin/MoreSuggestions.java
@@ -16,7 +16,9 @@
package com.android.inputmethod.latin;
+import android.content.res.Resources;
import android.graphics.Paint;
+import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import com.android.inputmethod.keyboard.Key;
@@ -49,14 +51,21 @@ public class MoreSuggestions extends Keyboard {
private final int[] mNumColumnsInRow = new int[SuggestionsView.MAX_SUGGESTIONS];
private static final int MAX_COLUMNS_IN_ROW = 3;
private int mNumRows;
+ public Drawable mDivider;
+ public int mDividerWidth;
public int layout(SuggestedWords suggestions, int fromPos, int maxWidth, int minWidth,
int maxRow, KeyboardView view) {
clearKeys();
final Paint paint = new Paint();
paint.setAntiAlias(true);
- final int padding = (int) view.getContext().getResources()
- .getDimension(R.dimen.more_suggestions_key_horizontal_padding);
+ final Resources res = view.getContext().getResources();
+ mDivider = res.getDrawable(R.drawable.more_suggestions_divider);
+ // TODO: Drawable itself should has an alpha value.
+ mDivider.setAlpha(128);
+ mDividerWidth = mDivider.getIntrinsicWidth();
+ final int padding = (int) res.getDimension(
+ R.dimen.more_suggestions_key_horizontal_padding);
int row = 0;
int pos = fromPos, rowStartPos = fromPos;
@@ -66,8 +75,10 @@ public class MoreSuggestions extends Keyboard {
// TODO: Should take care of text x-scaling.
mWidths[pos] = (int)view.getDefaultLabelWidth(word, paint) + padding;
final int numColumn = pos - rowStartPos + 1;
+ final int columnWidth =
+ (maxWidth - mDividerWidth * (numColumn - 1)) / numColumn;
if (numColumn > MAX_COLUMNS_IN_ROW
- || !fitInWidth(rowStartPos, pos + 1, maxWidth / numColumn)) {
+ || !fitInWidth(rowStartPos, pos + 1, columnWidth)) {
if ((row + 1) >= maxRow) {
break;
}
@@ -98,13 +109,14 @@ public class MoreSuggestions extends Keyboard {
int maxRowWidth = 0;
int pos = startPos;
for (int row = 0; row < mNumRows; row++) {
- final int numColumn = mNumColumnsInRow[row];
+ final int numColumnInRow = mNumColumnsInRow[row];
int maxKeyWidth = 0;
while (pos < endPos && mRowNumbers[pos] == row) {
maxKeyWidth = Math.max(maxKeyWidth, mWidths[pos]);
pos++;
}
- maxRowWidth = Math.max(maxRowWidth, maxKeyWidth * numColumn);
+ maxRowWidth = Math.max(maxRowWidth,
+ maxKeyWidth * numColumnInRow + mDividerWidth * (numColumnInRow - 1));
}
return maxRowWidth;
}
@@ -115,15 +127,19 @@ public class MoreSuggestions extends Keyboard {
{ 2, 0, 1},
};
- private int getColumnNumber(int pos) {
+ public int getNumColumnInRow(int pos) {
+ return mNumColumnsInRow[mRowNumbers[pos]];
+ }
+
+ public int getColumnNumber(int pos) {
final int columnOrder = mColumnOrders[pos];
- final int numColumn = mNumColumnsInRow[mRowNumbers[pos]];
+ final int numColumn = getNumColumnInRow(pos);
return COLUMN_ORDER_TO_NUMBER[numColumn - 1][columnOrder];
}
public int getX(int pos) {
final int columnNumber = getColumnNumber(pos);
- return columnNumber * getWidth(pos);
+ return columnNumber * (getWidth(pos) + mDividerWidth);
}
public int getY(int pos) {
@@ -132,9 +148,8 @@ public class MoreSuggestions extends Keyboard {
}
public int getWidth(int pos) {
- final int row = mRowNumbers[pos];
- final int numColumn = mNumColumnsInRow[row];
- return mWidth / numColumn;
+ final int numColumnInRow = getNumColumnInRow(pos);
+ return (mWidth - mDividerWidth * (numColumnInRow - 1)) / numColumnInRow;
}
public int getFlags(int pos) {
@@ -146,11 +161,11 @@ public class MoreSuggestions extends Keyboard {
if (row == mNumRows - 1)
rowFlags |= Keyboard.EDGE_TOP;
- final int numColumn = mNumColumnsInRow[row];
+ final int numColumnInRow = mNumColumnsInRow[row];
final int column = getColumnNumber(pos);
if (column == 0)
rowFlags |= Keyboard.EDGE_LEFT;
- if (column == numColumn - 1)
+ if (column == numColumnInRow - 1)
rowFlags |= Keyboard.EDGE_RIGHT;
return rowFlags;
@@ -190,13 +205,23 @@ public class MoreSuggestions extends Keyboard {
public MoreSuggestions build() {
final MoreSuggestionsParam params = mParams;
for (int pos = mFromPos; pos < mToPos; pos++) {
+ final int x = params.getX(pos);
+ final int y = params.getY(pos);
+ final int width = params.getWidth(pos);
final String word = mSuggestions.getWord(pos).toString();
final String info = getDebugInfo(mSuggestions, pos);
final int index = pos + SUGGESTION_CODE_BASE;
final Key key = new Key(
- params, word, info, null, index, null, params.getX(pos), params.getY(pos),
- params.getWidth(pos), params.mDefaultRowHeight, params.getFlags(pos));
+ params, word, info, null, index, null, x, y, width,
+ params.mDefaultRowHeight, params.getFlags(pos));
params.onAddKey(key);
+ final int columnNumber = params.getColumnNumber(pos);
+ final int numColumnInRow = params.getNumColumnInRow(pos);
+ if (columnNumber < numColumnInRow - 1) {
+ final Key.Spacer spacer = new Key.Spacer(params, params.mDivider, x + width, y,
+ params.mDividerWidth, params.mDefaultRowHeight);
+ params.onAddKey(spacer);
+ }
}
return new MoreSuggestions(params);
}
diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java
index f595510a3..695e60ffd 100644
--- a/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/MoreSuggestionsView.java
@@ -67,7 +67,10 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel {
@Override
public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) {
- mListener.onCustomRequest(primaryCode - MoreSuggestions.SUGGESTION_CODE_BASE);
+ final int index = primaryCode - MoreSuggestions.SUGGESTION_CODE_BASE;
+ if (index >= 0 && index < SuggestionsView.MAX_SUGGESTIONS) {
+ mListener.onCustomRequest(index);
+ }
}
@Override
@@ -142,6 +145,13 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel {
// Nothing to do with.
}
+ private final View.OnTouchListener mMotionEventDelegate = new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent me) {
+ return MoreSuggestionsView.this.dispatchTouchEvent(me);
+ }
+ };
+
@Override
public void showMoreKeysPanel(View parentView, Controller controller, int pointX, int pointY,
PopupWindow window, KeyboardActionListener listener) {
@@ -160,6 +170,10 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel {
- (container.getMeasuredHeight() - container.getPaddingBottom())
+ parentView.getPaddingTop() + mCoordinates[1];
+ container.setOnTouchListener(mMotionEventDelegate);
+ window.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
+ window.setFocusable(true);
+ window.setOutsideTouchable(true);
window.setContentView(container);
window.setWidth(container.getMeasuredWidth());
window.setHeight(container.getMeasuredHeight());
@@ -215,6 +229,19 @@ public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel {
};
@Override
+ public boolean dispatchTouchEvent(MotionEvent me) {
+ final int x = (int)me.getX();
+ final int y = (int)me.getY();
+ final boolean inside = (x >= 0 && x < getWidth() && y >= 0 && y < getHeight());
+ if (inside) {
+ return super.dispatchTouchEvent(me);
+ } else {
+ dismissMoreKeysPanel();
+ return true;
+ }
+ }
+
+ @Override
public boolean onTouchEvent(MotionEvent me) {
final int action = me.getAction();
final long eventTime = me.getEventTime();
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index f9dda6a40..8a4862094 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -258,7 +258,6 @@ public class SubtypeSwitcher {
triggerVoiceIME();
}
} else {
- Log.w(TAG, "Unknown subtype mode: " + newMode);
if (VOICE_MODE.equals(oldMode) && mVoiceInputWrapper != null) {
// We need to reset the voice input to release the resources and to reset its status
// as it is not the current input mode.
@@ -271,8 +270,14 @@ public class SubtypeSwitcher {
packageName, 0).versionCode;
} catch (NameNotFoundException e) {
}
- throw new RuntimeException("Unknown subtype mode: " + version + ", " + packageName
- + ", " + mVoiceInputWrapper);
+ Log.w(TAG, "Unknown subtype mode: " + newMode + "," + version + ", " + packageName
+ + ", " + mVoiceInputWrapper + ". IME is already changed to other IME.");
+ if (newSubtype != null) {
+ Log.w(TAG, "Subtype mode:" + newSubtype.getMode());
+ Log.w(TAG, "Subtype locale:" + newSubtype.getLocale());
+ Log.w(TAG, "Subtype extra value:" + newSubtype.getExtraValue());
+ Log.w(TAG, "Subtype is auxiliary:" + newSubtype.isAuxiliary());
+ }
}
}
diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java
index 6879f7660..380e73bc0 100644
--- a/java/src/com/android/inputmethod/latin/SuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java
@@ -728,6 +728,10 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
return false;
}
+ public boolean handleBack() {
+ return dismissMoreSuggestions();
+ }
+
@Override
public boolean onLongClick(View view) {
final SuggestionsViewParams params = mParams;