am 44ecfdb6: am 09f530e2: Show key preview instantaneously
Merge commit '44ecfdb60b7473030fcf478412fb9cfd01ea2d01' * commit '44ecfdb60b7473030fcf478412fb9cfd01ea2d01': Show key preview instantaneouslymain
commit
2380f99973
|
@ -178,7 +178,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
/** Listener for {@link OnKeyboardActionListener}. */
|
/** Listener for {@link OnKeyboardActionListener}. */
|
||||||
private OnKeyboardActionListener mKeyboardActionListener;
|
private OnKeyboardActionListener mKeyboardActionListener;
|
||||||
|
|
||||||
private static final int DELAY_BEFORE_PREVIEW = 0;
|
|
||||||
private static final int DELAY_AFTER_PREVIEW = 70;
|
private static final int DELAY_AFTER_PREVIEW = 70;
|
||||||
private static final int DEBOUNCE_TIME = 70;
|
private static final int DEBOUNCE_TIME = 70;
|
||||||
|
|
||||||
|
@ -245,19 +244,15 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
UIHandler mHandler = new UIHandler();
|
UIHandler mHandler = new UIHandler();
|
||||||
|
|
||||||
class UIHandler extends Handler {
|
class UIHandler extends Handler {
|
||||||
private static final int MSG_POPUP_PREVIEW = 1;
|
private static final int MSG_DISMISS_PREVIEW = 0;
|
||||||
private static final int MSG_DISMISS_PREVIEW = 2;
|
private static final int MSG_REPEAT_KEY = 1;
|
||||||
private static final int MSG_REPEAT_KEY = 3;
|
private static final int MSG_LOGPRESS_KEY = 2;
|
||||||
private static final int MSG_LOGPRESS_KEY = 4;
|
|
||||||
|
|
||||||
private boolean mInKeyRepeat;
|
private boolean mInKeyRepeat;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
case MSG_POPUP_PREVIEW:
|
|
||||||
showKey(msg.arg1);
|
|
||||||
break;
|
|
||||||
case MSG_DISMISS_PREVIEW:
|
case MSG_DISMISS_PREVIEW:
|
||||||
mPreviewText.setVisibility(INVISIBLE);
|
mPreviewText.setVisibility(INVISIBLE);
|
||||||
break;
|
break;
|
||||||
|
@ -271,15 +266,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void popupPreview(int keyIndex, long delay) {
|
|
||||||
removeMessages(MSG_POPUP_PREVIEW);
|
|
||||||
sendMessageDelayed(obtainMessage(MSG_POPUP_PREVIEW, keyIndex, 0), delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancelPopupPreview() {
|
|
||||||
removeMessages(MSG_POPUP_PREVIEW);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dismissPreview(long delay) {
|
public void dismissPreview(long delay) {
|
||||||
sendMessageDelayed(obtainMessage(MSG_DISMISS_PREVIEW), delay);
|
sendMessageDelayed(obtainMessage(MSG_DISMISS_PREVIEW), delay);
|
||||||
}
|
}
|
||||||
|
@ -318,7 +304,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
|
|
||||||
public void cancelAllMessages() {
|
public void cancelAllMessages() {
|
||||||
cancelKeyTimers();
|
cancelKeyTimers();
|
||||||
cancelPopupPreview();
|
|
||||||
cancelDismissPreview();
|
cancelDismissPreview();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -613,7 +598,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
}
|
}
|
||||||
// Remove any pending messages, except dismissing preview
|
// Remove any pending messages, except dismissing preview
|
||||||
mHandler.cancelKeyTimers();
|
mHandler.cancelKeyTimers();
|
||||||
mHandler.cancelPopupPreview();
|
|
||||||
mKeyboard = keyboard;
|
mKeyboard = keyboard;
|
||||||
LatinImeLogger.onSetKeyboard(mKeyboard);
|
LatinImeLogger.onSetKeyboard(mKeyboard);
|
||||||
List<Key> keys = mKeyboard.getKeys();
|
List<Key> keys = mKeyboard.getKeys();
|
||||||
|
@ -985,17 +969,11 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
// If key changed and preview is on ...
|
// If key changed and preview is on ...
|
||||||
if (oldKeyIndex != mCurrentKeyIndex && mShowPreview) {
|
if (oldKeyIndex != mCurrentKeyIndex && mShowPreview) {
|
||||||
if (keyIndex == NOT_A_KEY) {
|
if (keyIndex == NOT_A_KEY) {
|
||||||
mHandler.cancelPopupPreview();
|
|
||||||
if (previewPopup.isShowing()) {
|
if (previewPopup.isShowing()) {
|
||||||
mHandler.dismissPreview(DELAY_AFTER_PREVIEW);
|
mHandler.dismissPreview(DELAY_AFTER_PREVIEW);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (previewPopup.isShowing() && mPreviewText.getVisibility() == VISIBLE) {
|
showKey(keyIndex);
|
||||||
// Show right away, if it's already visible and finger is moving around
|
|
||||||
showKey(keyIndex);
|
|
||||||
} else {
|
|
||||||
mHandler.popupPreview(keyIndex, DELAY_BEFORE_PREVIEW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1372,7 +1350,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
int keyIndex = mProximityKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null);
|
int keyIndex = mProximityKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null);
|
||||||
boolean wasInKeyRepeat = mHandler.isInKeyRepeat();
|
boolean wasInKeyRepeat = mHandler.isInKeyRepeat();
|
||||||
mHandler.cancelKeyTimers();
|
mHandler.cancelKeyTimers();
|
||||||
mHandler.cancelPopupPreview();
|
|
||||||
if (mDebouncer.isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) {
|
if (mDebouncer.isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) {
|
||||||
mDebouncer.updateTimeDebouncing(eventTime);
|
mDebouncer.updateTimeDebouncing(eventTime);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1395,7 +1372,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
|
||||||
|
|
||||||
private void onCancelEvent(int touchX, int touchY, long eventTime) {
|
private void onCancelEvent(int touchX, int touchY, long eventTime) {
|
||||||
mHandler.cancelKeyTimers();
|
mHandler.cancelKeyTimers();
|
||||||
mHandler.cancelPopupPreview();
|
|
||||||
dismissPopupKeyboard();
|
dismissPopupKeyboard();
|
||||||
mAbortKey = true;
|
mAbortKey = true;
|
||||||
showPreview(NOT_A_KEY);
|
showPreview(NOT_A_KEY);
|
||||||
|
|
Loading…
Reference in New Issue