am 9a73a79c: Merge "Fix not intercepting touch event while in modal mode"
* commit '9a73a79cbe345ad637782fff6947d5ddced6aaf4': Fix not intercepting touch event while in modal modemain
commit
19b4151690
|
@ -40,6 +40,8 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView {
|
||||||
public abstract void onSuggestionSelected(final SuggestedWordInfo info);
|
public abstract void onSuggestionSelected(final SuggestedWordInfo info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean mIsInModalMode;
|
||||||
|
|
||||||
public MoreSuggestionsView(final Context context, final AttributeSet attrs) {
|
public MoreSuggestionsView(final Context context, final AttributeSet attrs) {
|
||||||
this(context, attrs, R.attr.moreKeysKeyboardViewStyle);
|
this(context, attrs, R.attr.moreKeysKeyboardViewStyle);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +55,7 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView {
|
||||||
@Override
|
@Override
|
||||||
public void setKeyboard(final Keyboard keyboard) {
|
public void setKeyboard(final Keyboard keyboard) {
|
||||||
super.setKeyboard(keyboard);
|
super.setKeyboard(keyboard);
|
||||||
|
mIsInModalMode = false;
|
||||||
// With accessibility mode off, {@link #mAccessibilityDelegate} is set to null at the
|
// With accessibility mode off, {@link #mAccessibilityDelegate} is set to null at the
|
||||||
// above {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call.
|
// above {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call.
|
||||||
// With accessibility mode on, {@link #mAccessibilityDelegate} is set to a
|
// With accessibility mode on, {@link #mAccessibilityDelegate} is set to a
|
||||||
|
@ -74,12 +77,17 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView {
|
||||||
updateKeyDrawParams(keyHeight);
|
updateKeyDrawParams(keyHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adjustVerticalCorrectionForModalMode() {
|
public void setModalMode() {
|
||||||
|
mIsInModalMode = true;
|
||||||
// Set vertical correction to zero (Reset more keys keyboard sliding allowance
|
// Set vertical correction to zero (Reset more keys keyboard sliding allowance
|
||||||
// {@link R#dimen.config_more_keys_keyboard_slide_allowance}).
|
// {@link R#dimen.config_more_keys_keyboard_slide_allowance}).
|
||||||
mKeyDetector.setKeyboard(getKeyboard(), -getPaddingLeft(), -getPaddingTop());
|
mKeyDetector.setKeyboard(getKeyboard(), -getPaddingLeft(), -getPaddingTop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInModalMode() {
|
||||||
|
return mIsInModalMode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onKeyInput(final Key key, final int x, final int y) {
|
protected void onKeyInput(final Key key, final int x, final int y) {
|
||||||
if (!(key instanceof MoreSuggestionKey)) {
|
if (!(key instanceof MoreSuggestionKey)) {
|
||||||
|
|
|
@ -393,6 +393,9 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(final MotionEvent me) {
|
public boolean onInterceptTouchEvent(final MotionEvent me) {
|
||||||
|
if (mMoreSuggestionsView.isInModalMode()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!mMoreSuggestionsView.isShowingInParent()) {
|
if (!mMoreSuggestionsView.isShowingInParent()) {
|
||||||
mLastX = (int)me.getX();
|
mLastX = (int)me.getX();
|
||||||
mLastY = (int)me.getY();
|
mLastY = (int)me.getY();
|
||||||
|
@ -416,7 +419,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
|
|
||||||
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
|
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {
|
||||||
// Decided to be in the modal input mode.
|
// Decided to be in the modal input mode.
|
||||||
mMoreSuggestionsView.adjustVerticalCorrectionForModalMode();
|
mMoreSuggestionsView.setModalMode();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue