Fix a bug throwing IndexOutOfBoundsException when IME receives completions more than MAX_SUGGESTIONS in full-screen mode.

Change-Id: Ic76287c2f8aa91733769e789df1f2a0614100f65
main
Yuncheol Heo 2010-05-12 09:59:38 +09:00
parent 44357b74a3
commit 75e0abcfdb
1 changed files with 3 additions and 3 deletions

View File

@ -219,7 +219,7 @@ public class CandidateView extends View {
mDivider.getIntrinsicHeight());
}
int x = 0;
final int count = mSuggestions.size();
final int count = Math.min(mSuggestions.size(), MAX_SUGGESTIONS);
final int width = getWidth();
final Rect bgPadding = mBgPadding;
final Paint paint = mPaint;
@ -335,7 +335,7 @@ public class CandidateView extends View {
public void scrollPrev() {
int i = 0;
final int count = mSuggestions.size();
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()
@ -354,7 +354,7 @@ public class CandidateView extends View {
int i = 0;
int scrollX = getScrollX();
int targetX = scrollX;
final int count = mSuggestions.size();
final int count = Math.min(mSuggestions.size(), MAX_SUGGESTIONS);
int rightEdge = scrollX + getWidth();
while (i < count) {
if (mWordX[i] <= rightEdge &&