Make PointerTracker aware of that popup panel is showing
Bug: 5070598 Change-Id: I0604287b8c373e4763b4ccf88c0bd7235af907d5main
parent
f24eb69d3f
commit
9ec80d9d89
|
@ -865,6 +865,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
|||
requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dismissPopupPanel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void purgeKeyboardAndClosing() {
|
||||
mKeyboard = null;
|
||||
closing();
|
||||
|
|
|
@ -400,11 +400,10 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
|||
mPopupPanel = popupPanel;
|
||||
mPopupPanelPointerTrackerId = tracker.mPointerId;
|
||||
|
||||
tracker.onLongPressed();
|
||||
popupPanel.showPanel(this, parentKey, tracker, mPopupWindow);
|
||||
popupPanel.showPopupPanel(this, parentKey, tracker, mPopupWindow);
|
||||
final int translatedX = popupPanel.translateX(tracker.getLastX());
|
||||
final int translatedY = popupPanel.translateY(tracker.getLastY());
|
||||
tracker.onDownEvent(translatedX, translatedY, SystemClock.uptimeMillis(), popupPanel);
|
||||
tracker.onShowPopupPanel(translatedX, translatedY, SystemClock.uptimeMillis(), popupPanel);
|
||||
|
||||
invalidateAllKeys();
|
||||
return true;
|
||||
|
@ -546,11 +545,12 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
|||
@Override
|
||||
public void closing() {
|
||||
super.closing();
|
||||
dismissMiniKeyboard();
|
||||
dismissPopupPanel();
|
||||
mPopupPanelCache.clear();
|
||||
}
|
||||
|
||||
public boolean dismissMiniKeyboard() {
|
||||
@Override
|
||||
public boolean dismissPopupPanel() {
|
||||
if (mPopupWindow != null && mPopupWindow.isShowing()) {
|
||||
mPopupWindow.dismiss();
|
||||
mPopupPanel = null;
|
||||
|
@ -562,7 +562,7 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
|||
}
|
||||
|
||||
public boolean handleBack() {
|
||||
return dismissMiniKeyboard();
|
||||
return dismissPopupPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,6 +67,7 @@ public class PointerTracker {
|
|||
public void showKeyPreview(int keyIndex, PointerTracker tracker);
|
||||
public void cancelShowKeyPreview(PointerTracker tracker);
|
||||
public void dismissKeyPreview(PointerTracker tracker);
|
||||
public boolean dismissPopupPanel();
|
||||
}
|
||||
|
||||
public interface TimerProxy {
|
||||
|
@ -117,9 +118,12 @@ public class PointerTracker {
|
|||
// true if keyboard layout has been changed.
|
||||
private boolean mKeyboardLayoutHasBeenChanged;
|
||||
|
||||
// true if event is already translated to a key action (long press or mini-keyboard)
|
||||
// true if event is already translated to a key action.
|
||||
private boolean mKeyAlreadyProcessed;
|
||||
|
||||
// true if this pointer has been long-pressed and is showing a popup panel.
|
||||
private boolean mIsShowingPopupPanel;
|
||||
|
||||
// true if this pointer is repeatable key
|
||||
private boolean mIsRepeatableKey;
|
||||
|
||||
|
@ -579,6 +583,10 @@ public class PointerTracker {
|
|||
}
|
||||
final int keyIndex = onUpKey(keyX, keyY, eventTime);
|
||||
setReleasedKeyGraphics(keyIndex);
|
||||
if (mIsShowingPopupPanel) {
|
||||
mDrawingProxy.dismissPopupPanel();
|
||||
mIsShowingPopupPanel = false;
|
||||
}
|
||||
if (mKeyAlreadyProcessed)
|
||||
return;
|
||||
if (!mIsRepeatableKey) {
|
||||
|
@ -586,6 +594,12 @@ public class PointerTracker {
|
|||
}
|
||||
}
|
||||
|
||||
public void onShowPopupPanel(int x, int y, long eventTime, KeyEventHandler handler) {
|
||||
onLongPressed();
|
||||
onDownEvent(x, y, eventTime, handler);
|
||||
mIsShowingPopupPanel = true;
|
||||
}
|
||||
|
||||
public void onLongPressed() {
|
||||
mKeyAlreadyProcessed = true;
|
||||
setReleasedKeyGraphics(mKeyIndex);
|
||||
|
@ -612,6 +626,10 @@ public class PointerTracker {
|
|||
mDrawingProxy.cancelShowKeyPreview(this);
|
||||
setReleasedKeyGraphics(mKeyIndex);
|
||||
mIsInSlidingKeyInput = false;
|
||||
if (mIsShowingPopupPanel) {
|
||||
mDrawingProxy.dismissPopupPanel();
|
||||
mIsShowingPopupPanel = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void startRepeatKey(int keyIndex) {
|
||||
|
|
|
@ -59,19 +59,16 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
|
|||
public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) {
|
||||
mParentKeyboardView.getKeyboardActionListener()
|
||||
.onCodeInput(primaryCode, keyCodes, x, y);
|
||||
mParentKeyboardView.dismissMiniKeyboard();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextInput(CharSequence text) {
|
||||
mParentKeyboardView.getKeyboardActionListener().onTextInput(text);
|
||||
mParentKeyboardView.dismissMiniKeyboard();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelInput() {
|
||||
mParentKeyboardView.getKeyboardActionListener().onCancelInput();
|
||||
mParentKeyboardView.dismissMiniKeyboard();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +156,7 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void showPanel(LatinKeyboardBaseView parentKeyboardView, Key parentKey,
|
||||
public void showPopupPanel(LatinKeyboardBaseView parentKeyboardView, Key parentKey,
|
||||
PointerTracker tracker, PopupWindow window) {
|
||||
mParentKeyboardView = parentKeyboardView;
|
||||
final View container = (View)getParent();
|
||||
|
@ -191,6 +188,11 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
|
|||
mOriginY = y + container.getPaddingTop() - mCoordinates[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dismissPopupPanel() {
|
||||
return mParentKeyboardView.dismissPopupPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int translateX(int x) {
|
||||
return x - mOriginX;
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface PopupPanel extends PointerTracker.KeyEventHandler {
|
|||
* @param tracker the pointer tracker that pressesd the parent key
|
||||
* @param window PopupWindow to be used to show this popup panel
|
||||
*/
|
||||
public void showPanel(LatinKeyboardBaseView parentKeyboardView, Key parentKey,
|
||||
public void showPopupPanel(LatinKeyboardBaseView parentKeyboardView, Key parentKey,
|
||||
PointerTracker tracker, PopupWindow window);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue