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