am 259778c3: am eebe37e8: Merge "Disable suggestion selection preview popup" into gingerbread
Merge commit '259778c3a18246b3117c2874b87f1adaf2d9fb81' * commit '259778c3a18246b3117c2874b87f1adaf2d9fb81': Disable suggestion selection preview popupmain
commit
2e7ce8ec50
|
@ -149,9 +149,22 @@ public class CandidateView extends View {
|
||||||
mDescent = (int) mPaint.descent();
|
mDescent = (int) mPaint.descent();
|
||||||
mMinTouchableWidth = (int)res.getDimension(R.dimen.candidate_min_touchable_width);
|
mMinTouchableWidth = (int)res.getDimension(R.dimen.candidate_min_touchable_width);
|
||||||
|
|
||||||
|
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
|
// Slightly reluctant to scroll to be able to easily choose the suggestion
|
||||||
final int touchSlopSquare = mMinTouchableWidth * mMinTouchableWidth;
|
mTouchSlopSquare = touchSlop * touchSlop;
|
||||||
mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLongPress(MotionEvent me) {
|
public void onLongPress(MotionEvent me) {
|
||||||
if (mSuggestions.size() > 0) {
|
if (mSuggestions.size() > 0) {
|
||||||
|
@ -175,7 +188,7 @@ public class CandidateView extends View {
|
||||||
final int deltaX = (int) (e2.getX() - e1.getX());
|
final int deltaX = (int) (e2.getX() - e1.getX());
|
||||||
final int deltaY = (int) (e2.getY() - e1.getY());
|
final int deltaY = (int) (e2.getY() - e1.getY());
|
||||||
final int distance = (deltaX * deltaX) + (deltaY * deltaY);
|
final int distance = (deltaX * deltaX) + (deltaY * deltaY);
|
||||||
if (distance < touchSlopSquare) {
|
if (distance < mTouchSlopSquare) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
mScrolled = true;
|
mScrolled = true;
|
||||||
|
@ -197,11 +210,6 @@ public class CandidateView extends View {
|
||||||
invalidate();
|
invalidate();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
setWillNotDraw(false);
|
|
||||||
setHorizontalScrollBarEnabled(false);
|
|
||||||
setVerticalScrollBarEnabled(false);
|
|
||||||
scrollTo(0, getScrollY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -282,7 +290,6 @@ public class CandidateView extends View {
|
||||||
mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height);
|
mSelectionHighlight.setBounds(0, bgPadding.top, wordWidth, height);
|
||||||
mSelectionHighlight.draw(canvas);
|
mSelectionHighlight.draw(canvas);
|
||||||
canvas.translate(-x, 0);
|
canvas.translate(-x, 0);
|
||||||
showPreview(i, null);
|
|
||||||
}
|
}
|
||||||
mSelectedString = suggestion;
|
mSelectedString = suggestion;
|
||||||
mSelectedIndex = i;
|
mSelectedIndex = i;
|
||||||
|
@ -443,7 +450,6 @@ public class CandidateView extends View {
|
||||||
mSelectedIndex = -1;
|
mSelectedIndex = -1;
|
||||||
removeHighlight();
|
removeHighlight();
|
||||||
requestLayout();
|
requestLayout();
|
||||||
mHandler.dismissPreview(mDelayAfterPreview);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -501,6 +507,7 @@ public class CandidateView extends View {
|
||||||
if (word.length() < 2) return;
|
if (word.length() < 2) return;
|
||||||
if (mService.addWordToDictionary(word.toString())) {
|
if (mService.addWordToDictionary(word.toString())) {
|
||||||
showPreview(0, getContext().getResources().getString(R.string.added_word, word));
|
showPreview(0, getContext().getResources().getString(R.string.added_word, word));
|
||||||
|
mHandler.dismissPreview(mDelayAfterPreview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue