aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/MoreSuggestions.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-09-05 03:56:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-05 03:56:37 -0700
commit3f8351e18614c71ac217057ae5ec2baeb3e559fa (patch)
treec6f1d8ae2aefc022f455e849d91b8ffad08f3ea0 /java/src/com/android/inputmethod/latin/MoreSuggestions.java
parent6a9f0db202749724373fcd525564e84e1cea3ce9 (diff)
parent9676038b6e9fb66760588d7f9c9c642cc493dd71 (diff)
downloadlatinime-3f8351e18614c71ac217057ae5ec2baeb3e559fa.tar.gz
latinime-3f8351e18614c71ac217057ae5ec2baeb3e559fa.tar.xz
latinime-3f8351e18614c71ac217057ae5ec2baeb3e559fa.zip
Merge "Introduce maxMoreSuggestionsRow and minMoreSuggetionsWidth attributes to SuggestionsView"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/MoreSuggestions.java')
-rw-r--r--java/src/com/android/inputmethod/latin/MoreSuggestions.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/MoreSuggestions.java
index a9e75b7b3..10d5b5c48 100644
--- a/java/src/com/android/inputmethod/latin/MoreSuggestions.java
+++ b/java/src/com/android/inputmethod/latin/MoreSuggestions.java
@@ -50,8 +50,8 @@ public class MoreSuggestions extends Keyboard {
private static final int MAX_COLUMNS_IN_ROW = 3;
private int mNumRows;
- public int layout(SuggestedWords suggestions, int fromPos, int maxWidth, int maxHeight,
- KeyboardView view) {
+ public int layout(SuggestedWords suggestions, int fromPos, int maxWidth, int minWidth,
+ int maxRow, KeyboardView view) {
clearKeys();
final Paint paint = new Paint();
paint.setAntiAlias(true);
@@ -68,7 +68,7 @@ public class MoreSuggestions extends Keyboard {
final int numColumn = pos - rowStartPos + 1;
if (numColumn > MAX_COLUMNS_IN_ROW
|| !fitInWidth(rowStartPos, pos + 1, maxWidth / numColumn)) {
- if ((row + 1) * mDefaultRowHeight > maxHeight) {
+ if ((row + 1) >= maxRow) {
break;
}
mNumColumnsInRow[row] = pos - rowStartPos;
@@ -81,7 +81,7 @@ public class MoreSuggestions extends Keyboard {
}
mNumColumnsInRow[row] = pos - rowStartPos;
mNumRows = row + 1;
- mWidth = mOccupiedWidth = calcurateMaxRowWidth(fromPos, pos);
+ mWidth = mOccupiedWidth = Math.max(minWidth, calcurateMaxRowWidth(fromPos, pos));
mHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight + mVerticalGap;
return pos - fromPos;
}
@@ -163,13 +163,14 @@ public class MoreSuggestions extends Keyboard {
}
public Builder layout(SuggestedWords suggestions, int fromPos, int maxWidth,
- int maxHeight) {
+ int minWidth, int maxRow) {
final Keyboard keyboard = KeyboardSwitcher.getInstance().getLatinKeyboard();
final int xmlId = R.xml.kbd_suggestions_pane_template;
load(keyboard.mId.cloneWithNewXml(mResources.getResourceEntryName(xmlId), xmlId));
mParams.mVerticalGap = mParams.mTopPadding = keyboard.mVerticalGap / 2;
- final int count = mParams.layout(suggestions, fromPos, maxWidth, maxHeight, mPaneView);
+ final int count = mParams.layout(suggestions, fromPos, maxWidth, minWidth, maxRow,
+ mPaneView);
mFromPos = fromPos;
mToPos = fromPos + count;
mSuggestions = suggestions;