am 27e48447
: Lingering gesture floating preview text a bit
* commit '27e48447a449d2eb534dfa2dc07060727e1a8fb0': Lingering gesture floating preview text a bit
This commit is contained in:
commit
d9f9c1189d
9 changed files with 129 additions and 52 deletions
|
@ -119,6 +119,7 @@
|
||||||
<enum name="boldItalic" value="3" />
|
<enum name="boldItalic" value="3" />
|
||||||
</attr>
|
</attr>
|
||||||
|
|
||||||
|
<!-- Attributes for PreviewPlacerView -->
|
||||||
<attr name="gestureFloatingPreviewTextSize" format="dimension" />
|
<attr name="gestureFloatingPreviewTextSize" format="dimension" />
|
||||||
<attr name="gestureFloatingPreviewTextColor" format="color" />
|
<attr name="gestureFloatingPreviewTextColor" format="color" />
|
||||||
<attr name="gestureFloatingPreviewTextOffset" format="dimension" />
|
<attr name="gestureFloatingPreviewTextOffset" format="dimension" />
|
||||||
|
@ -128,6 +129,8 @@
|
||||||
<attr name="gestureFloatingPreviewTextShadowBorder" format="dimension" />
|
<attr name="gestureFloatingPreviewTextShadowBorder" format="dimension" />
|
||||||
<attr name="gestureFloatingPreviewTextConnectorColor" format="color" />
|
<attr name="gestureFloatingPreviewTextConnectorColor" format="color" />
|
||||||
<attr name="gestureFloatingPreviewTextConnectorWidth" format="dimension" />
|
<attr name="gestureFloatingPreviewTextConnectorWidth" format="dimension" />
|
||||||
|
<!-- Delay after gesture input and gesture floating preview text dismissing in millisecond -->
|
||||||
|
<attr name="gestureFloatingPreviewTextLingerTimeout" format="integer" />
|
||||||
<attr name="gesturePreviewTrailColor" format="color" />
|
<attr name="gesturePreviewTrailColor" format="color" />
|
||||||
<attr name="gesturePreviewTrailWidth" format="dimension" />
|
<attr name="gesturePreviewTrailWidth" format="dimension" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
Configuration for KeyboardView
|
Configuration for KeyboardView
|
||||||
-->
|
-->
|
||||||
<integer name="config_key_preview_linger_timeout">70</integer>
|
<integer name="config_key_preview_linger_timeout">70</integer>
|
||||||
|
<integer name="config_gesture_floating_preview_text_linger_timeout">200</integer>
|
||||||
<!--
|
<!--
|
||||||
Configuration for MainKeyboardView
|
Configuration for MainKeyboardView
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
<item name="gestureFloatingPreviewTextShadowBorder">@dimen/gesture_floating_preview_text_shadow_border</item>
|
<item name="gestureFloatingPreviewTextShadowBorder">@dimen/gesture_floating_preview_text_shadow_border</item>
|
||||||
<item name="gestureFloatingPreviewTextConnectorColor">@android:color/white</item>
|
<item name="gestureFloatingPreviewTextConnectorColor">@android:color/white</item>
|
||||||
<item name="gestureFloatingPreviewTextConnectorWidth">@dimen/gesture_floating_preview_text_connector_width</item>
|
<item name="gestureFloatingPreviewTextConnectorWidth">@dimen/gesture_floating_preview_text_connector_width</item>
|
||||||
|
<item name="gestureFloatingPreviewTextLingerTimeout">@integer/config_gesture_floating_preview_text_linger_timeout</item>
|
||||||
<item name="gesturePreviewTrailColor">@android:color/holo_blue_light</item>
|
<item name="gesturePreviewTrailColor">@android:color/holo_blue_light</item>
|
||||||
<item name="gesturePreviewTrailWidth">@dimen/gesture_preview_trail_width</item>
|
<item name="gesturePreviewTrailWidth">@dimen/gesture_preview_trail_width</item>
|
||||||
<!-- Common attributes of MainKeyboardView -->
|
<!-- Common attributes of MainKeyboardView -->
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
// Implements {@link KeyboardState.SwitchActions}.
|
// Implements {@link KeyboardState.SwitchActions}.
|
||||||
@Override
|
@Override
|
||||||
public void startDoubleTapTimer() {
|
public void startDoubleTapTimer() {
|
||||||
final MainKeyboardView keyboardView = getKeyboardView();
|
final MainKeyboardView keyboardView = getMainKeyboardView();
|
||||||
if (keyboardView != null) {
|
if (keyboardView != null) {
|
||||||
final TimerProxy timer = keyboardView.getTimerProxy();
|
final TimerProxy timer = keyboardView.getTimerProxy();
|
||||||
timer.startDoubleTapTimer();
|
timer.startDoubleTapTimer();
|
||||||
|
@ -277,7 +277,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
// Implements {@link KeyboardState.SwitchActions}.
|
// Implements {@link KeyboardState.SwitchActions}.
|
||||||
@Override
|
@Override
|
||||||
public void cancelDoubleTapTimer() {
|
public void cancelDoubleTapTimer() {
|
||||||
final MainKeyboardView keyboardView = getKeyboardView();
|
final MainKeyboardView keyboardView = getMainKeyboardView();
|
||||||
if (keyboardView != null) {
|
if (keyboardView != null) {
|
||||||
final TimerProxy timer = keyboardView.getTimerProxy();
|
final TimerProxy timer = keyboardView.getTimerProxy();
|
||||||
timer.cancelDoubleTapTimer();
|
timer.cancelDoubleTapTimer();
|
||||||
|
@ -287,7 +287,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
// Implements {@link KeyboardState.SwitchActions}.
|
// Implements {@link KeyboardState.SwitchActions}.
|
||||||
@Override
|
@Override
|
||||||
public boolean isInDoubleTapTimeout() {
|
public boolean isInDoubleTapTimeout() {
|
||||||
final MainKeyboardView keyboardView = getKeyboardView();
|
final MainKeyboardView keyboardView = getMainKeyboardView();
|
||||||
return (keyboardView != null)
|
return (keyboardView != null)
|
||||||
? keyboardView.getTimerProxy().isInDoubleTapTimeout() : false;
|
? keyboardView.getTimerProxy().isInDoubleTapTimeout() : false;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
// Implements {@link KeyboardState.SwitchActions}.
|
// Implements {@link KeyboardState.SwitchActions}.
|
||||||
@Override
|
@Override
|
||||||
public void startLongPressTimer(int code) {
|
public void startLongPressTimer(int code) {
|
||||||
final MainKeyboardView keyboardView = getKeyboardView();
|
final MainKeyboardView keyboardView = getMainKeyboardView();
|
||||||
if (keyboardView != null) {
|
if (keyboardView != null) {
|
||||||
final TimerProxy timer = keyboardView.getTimerProxy();
|
final TimerProxy timer = keyboardView.getTimerProxy();
|
||||||
timer.startLongPressTimer(code);
|
timer.startLongPressTimer(code);
|
||||||
|
@ -305,7 +305,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
// Implements {@link KeyboardState.SwitchActions}.
|
// Implements {@link KeyboardState.SwitchActions}.
|
||||||
@Override
|
@Override
|
||||||
public void cancelLongPressTimer() {
|
public void cancelLongPressTimer() {
|
||||||
final MainKeyboardView keyboardView = getKeyboardView();
|
final MainKeyboardView keyboardView = getMainKeyboardView();
|
||||||
if (keyboardView != null) {
|
if (keyboardView != null) {
|
||||||
final TimerProxy timer = keyboardView.getTimerProxy();
|
final TimerProxy timer = keyboardView.getTimerProxy();
|
||||||
timer.cancelLongPressTimer();
|
timer.cancelLongPressTimer();
|
||||||
|
@ -345,7 +345,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
mState.onCodeInput(code, isSinglePointer(), mLatinIME.getCurrentAutoCapsState());
|
mState.onCodeInput(code, isSinglePointer(), mLatinIME.getCurrentAutoCapsState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainKeyboardView getKeyboardView() {
|
public MainKeyboardView getMainKeyboardView() {
|
||||||
return mKeyboardView;
|
return mKeyboardView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
private final DrawingHandler mDrawingHandler = new DrawingHandler(this);
|
private final DrawingHandler mDrawingHandler = new DrawingHandler(this);
|
||||||
|
|
||||||
public static class DrawingHandler extends StaticInnerHandlerWrapper<KeyboardView> {
|
public static class DrawingHandler extends StaticInnerHandlerWrapper<KeyboardView> {
|
||||||
private static final int MSG_DISMISS_KEY_PREVIEW = 1;
|
private static final int MSG_DISMISS_KEY_PREVIEW = 0;
|
||||||
|
|
||||||
public DrawingHandler(KeyboardView outerInstance) {
|
public DrawingHandler(KeyboardView outerInstance) {
|
||||||
super(outerInstance);
|
super(outerInstance);
|
||||||
|
@ -902,6 +902,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
|
|
||||||
public void cancelAllMessages() {
|
public void cancelAllMessages() {
|
||||||
mDrawingHandler.cancelAllMessages();
|
mDrawingHandler.cancelAllMessages();
|
||||||
|
if (mPreviewPlacerView != null) {
|
||||||
|
mPreviewPlacerView.cancelAllMessages();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by {@link PointerTracker} constructor to create a TextView.
|
// Called by {@link PointerTracker} constructor to create a TextView.
|
||||||
|
@ -943,6 +946,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
mPreviewPlacerView.setGestureFloatingPreviewText(gestureFloatingPreviewText);
|
mPreviewPlacerView.setGestureFloatingPreviewText(gestureFloatingPreviewText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dismissGestureFloatingPreviewText() {
|
||||||
|
locatePreviewPlacerView();
|
||||||
|
mPreviewPlacerView.dismissGestureFloatingPreviewText();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showGestureTrail(PointerTracker tracker) {
|
public void showGestureTrail(PointerTracker tracker) {
|
||||||
locatePreviewPlacerView();
|
locatePreviewPlacerView();
|
||||||
|
|
|
@ -122,10 +122,10 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
|
||||||
|
|
||||||
private static class KeyTimerHandler extends StaticInnerHandlerWrapper<MainKeyboardView>
|
private static class KeyTimerHandler extends StaticInnerHandlerWrapper<MainKeyboardView>
|
||||||
implements TimerProxy {
|
implements TimerProxy {
|
||||||
|
private static final int MSG_TYPING_STATE_EXPIRED = 0;
|
||||||
private static final int MSG_REPEAT_KEY = 1;
|
private static final int MSG_REPEAT_KEY = 1;
|
||||||
private static final int MSG_LONGPRESS_KEY = 2;
|
private static final int MSG_LONGPRESS_KEY = 2;
|
||||||
private static final int MSG_DOUBLE_TAP = 3;
|
private static final int MSG_DOUBLE_TAP = 3;
|
||||||
private static final int MSG_TYPING_STATE_EXPIRED = 4;
|
|
||||||
|
|
||||||
private final KeyTimerParams mParams;
|
private final KeyTimerParams mParams;
|
||||||
|
|
||||||
|
@ -139,6 +139,9 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
|
||||||
final MainKeyboardView keyboardView = getOuterInstance();
|
final MainKeyboardView keyboardView = getOuterInstance();
|
||||||
final PointerTracker tracker = (PointerTracker) msg.obj;
|
final PointerTracker tracker = (PointerTracker) msg.obj;
|
||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
|
case MSG_TYPING_STATE_EXPIRED:
|
||||||
|
startWhileTypingFadeinAnimation(keyboardView);
|
||||||
|
break;
|
||||||
case MSG_REPEAT_KEY:
|
case MSG_REPEAT_KEY:
|
||||||
final Key currentKey = tracker.getKey();
|
final Key currentKey = tracker.getKey();
|
||||||
if (currentKey != null && currentKey.mCode == msg.arg1) {
|
if (currentKey != null && currentKey.mCode == msg.arg1) {
|
||||||
|
@ -153,9 +156,6 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
|
||||||
KeyboardSwitcher.getInstance().onLongPressTimeout(msg.arg1);
|
KeyboardSwitcher.getInstance().onLongPressTimeout(msg.arg1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_TYPING_STATE_EXPIRED:
|
|
||||||
startWhileTypingFadeinAnimation(keyboardView);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,14 @@ import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Align;
|
import android.graphics.Paint.Align;
|
||||||
|
import android.os.Message;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.PointerTracker;
|
import com.android.inputmethod.keyboard.PointerTracker;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
|
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
|
||||||
|
|
||||||
public class PreviewPlacerView extends RelativeLayout {
|
public class PreviewPlacerView extends RelativeLayout {
|
||||||
private final Paint mGesturePaint;
|
private final Paint mGesturePaint;
|
||||||
|
@ -39,6 +41,7 @@ public class PreviewPlacerView extends RelativeLayout {
|
||||||
private final int mGestureFloatingPreviewTextShadingBorder;
|
private final int mGestureFloatingPreviewTextShadingBorder;
|
||||||
private final int mGestureFloatingPreviewTextConnectorColor;
|
private final int mGestureFloatingPreviewTextConnectorColor;
|
||||||
private final int mGestureFloatingPreviewTextConnectorWidth;
|
private final int mGestureFloatingPreviewTextConnectorWidth;
|
||||||
|
/* package */ final int mGestureFloatingPreviewTextLingerTimeout;
|
||||||
|
|
||||||
private int mXOrigin;
|
private int mXOrigin;
|
||||||
private int mYOrigin;
|
private int mYOrigin;
|
||||||
|
@ -49,6 +52,43 @@ public class PreviewPlacerView extends RelativeLayout {
|
||||||
private boolean mDrawsGesturePreviewTrail;
|
private boolean mDrawsGesturePreviewTrail;
|
||||||
private boolean mDrawsGestureFloatingPreviewText;
|
private boolean mDrawsGestureFloatingPreviewText;
|
||||||
|
|
||||||
|
private final DrawingHandler mDrawingHandler = new DrawingHandler(this);
|
||||||
|
|
||||||
|
private static class DrawingHandler extends StaticInnerHandlerWrapper<PreviewPlacerView> {
|
||||||
|
private static final int MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 0;
|
||||||
|
|
||||||
|
public DrawingHandler(PreviewPlacerView outerInstance) {
|
||||||
|
super(outerInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
final PreviewPlacerView placerView = getOuterInstance();
|
||||||
|
if (placerView == null) return;
|
||||||
|
switch (msg.what) {
|
||||||
|
case MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT:
|
||||||
|
placerView.setGestureFloatingPreviewText(null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelDismissGestureFloatingPreviewText() {
|
||||||
|
removeMessages(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dismissGestureFloatingPreviewText() {
|
||||||
|
cancelDismissGestureFloatingPreviewText();
|
||||||
|
final PreviewPlacerView placerView = getOuterInstance();
|
||||||
|
sendMessageDelayed(
|
||||||
|
obtainMessage(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT),
|
||||||
|
placerView.mGestureFloatingPreviewTextLingerTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelAllMessages() {
|
||||||
|
cancelDismissGestureFloatingPreviewText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PreviewPlacerView(Context context, TypedArray keyboardViewAttr) {
|
public PreviewPlacerView(Context context, TypedArray keyboardViewAttr) {
|
||||||
super(context);
|
super(context);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
|
@ -71,6 +111,8 @@ public class PreviewPlacerView extends RelativeLayout {
|
||||||
R.styleable.KeyboardView_gestureFloatingPreviewTextConnectorColor, 0);
|
R.styleable.KeyboardView_gestureFloatingPreviewTextConnectorColor, 0);
|
||||||
mGestureFloatingPreviewTextConnectorWidth = keyboardViewAttr.getDimensionPixelSize(
|
mGestureFloatingPreviewTextConnectorWidth = keyboardViewAttr.getDimensionPixelSize(
|
||||||
R.styleable.KeyboardView_gestureFloatingPreviewTextConnectorWidth, 0);
|
R.styleable.KeyboardView_gestureFloatingPreviewTextConnectorWidth, 0);
|
||||||
|
mGestureFloatingPreviewTextLingerTimeout = keyboardViewAttr.getInt(
|
||||||
|
R.styleable.KeyboardView_gestureFloatingPreviewTextLingerTimeout, 0);
|
||||||
final int gesturePreviewTrailColor = keyboardViewAttr.getColor(
|
final int gesturePreviewTrailColor = keyboardViewAttr.getColor(
|
||||||
R.styleable.KeyboardView_gesturePreviewTrailColor, 0);
|
R.styleable.KeyboardView_gesturePreviewTrailColor, 0);
|
||||||
final int gesturePreviewTrailWidth = keyboardViewAttr.getDimensionPixelSize(
|
final int gesturePreviewTrailWidth = keyboardViewAttr.getDimensionPixelSize(
|
||||||
|
@ -136,6 +178,14 @@ public class PreviewPlacerView extends RelativeLayout {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dismissGestureFloatingPreviewText() {
|
||||||
|
mDrawingHandler.dismissGestureFloatingPreviewText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cancelAllMessages() {
|
||||||
|
mDrawingHandler.cancelAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
private void drawGestureFloatingPreviewText(Canvas canvas, PointerTracker tracker,
|
private void drawGestureFloatingPreviewText(Canvas canvas, PointerTracker tracker,
|
||||||
String gestureFloatingPreviewText) {
|
String gestureFloatingPreviewText) {
|
||||||
if (TextUtils.isEmpty(gestureFloatingPreviewText)) {
|
if (TextUtils.isEmpty(gestureFloatingPreviewText)) {
|
||||||
|
|
|
@ -181,9 +181,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
public final UIHandler mHandler = new UIHandler(this);
|
public final UIHandler mHandler = new UIHandler(this);
|
||||||
|
|
||||||
public static class UIHandler extends StaticInnerHandlerWrapper<LatinIME> {
|
public static class UIHandler extends StaticInnerHandlerWrapper<LatinIME> {
|
||||||
private static final int MSG_UPDATE_SHIFT_STATE = 1;
|
private static final int MSG_UPDATE_SHIFT_STATE = 0;
|
||||||
private static final int MSG_PENDING_IMS_CALLBACK = 6;
|
private static final int MSG_PENDING_IMS_CALLBACK = 1;
|
||||||
private static final int MSG_UPDATE_SUGGESTION_STRIP = 7;
|
private static final int MSG_UPDATE_SUGGESTION_STRIP = 2;
|
||||||
|
|
||||||
private int mDelayUpdateSuggestions;
|
private int mDelayUpdateSuggestions;
|
||||||
private int mDelayUpdateShiftState;
|
private int mDelayUpdateShiftState;
|
||||||
|
@ -613,7 +613,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private void onStartInputViewInternal(EditorInfo editorInfo, boolean restarting) {
|
private void onStartInputViewInternal(EditorInfo editorInfo, boolean restarting) {
|
||||||
super.onStartInputView(editorInfo, restarting);
|
super.onStartInputView(editorInfo, restarting);
|
||||||
final KeyboardSwitcher switcher = mKeyboardSwitcher;
|
final KeyboardSwitcher switcher = mKeyboardSwitcher;
|
||||||
MainKeyboardView inputView = switcher.getKeyboardView();
|
final MainKeyboardView mainKeyboardView = switcher.getMainKeyboardView();
|
||||||
|
|
||||||
if (editorInfo == null) {
|
if (editorInfo == null) {
|
||||||
Log.e(TAG, "Null EditorInfo in onStartInputView()");
|
Log.e(TAG, "Null EditorInfo in onStartInputView()");
|
||||||
|
@ -656,7 +656,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
LatinImeLogger.onStartInputView(editorInfo);
|
LatinImeLogger.onStartInputView(editorInfo);
|
||||||
// In landscape mode, this method gets called without the input view being created.
|
// In landscape mode, this method gets called without the input view being created.
|
||||||
if (inputView == null) {
|
if (mainKeyboardView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +693,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!restarting) {
|
if (!restarting) {
|
||||||
inputView.closing();
|
mainKeyboardView.closing();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) {
|
if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) {
|
||||||
|
@ -719,7 +719,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mHandler.cancelUpdateSuggestionStrip();
|
mHandler.cancelUpdateSuggestionStrip();
|
||||||
mHandler.cancelDoubleSpacesTimer();
|
mHandler.cancelDoubleSpacesTimer();
|
||||||
|
|
||||||
inputView.setKeyPreviewPopupEnabled(mCurrentSettings.mKeyPreviewPopupOn,
|
mainKeyboardView.setKeyPreviewPopupEnabled(mCurrentSettings.mKeyPreviewPopupOn,
|
||||||
mCurrentSettings.mKeyPreviewPopupDismissDelay);
|
mCurrentSettings.mKeyPreviewPopupDismissDelay);
|
||||||
|
|
||||||
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
|
||||||
|
@ -738,8 +738,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
getCurrentInputConnection());
|
getCurrentInputConnection());
|
||||||
}
|
}
|
||||||
super.onWindowHidden();
|
super.onWindowHidden();
|
||||||
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (inputView != null) inputView.closing();
|
if (mainKeyboardView != null) {
|
||||||
|
mainKeyboardView.closing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFinishInputInternal() {
|
private void onFinishInputInternal() {
|
||||||
|
@ -750,15 +752,19 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
ResearchLogger.getInstance().latinIME_onFinishInputInternal();
|
ResearchLogger.getInstance().latinIME_onFinishInputInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (inputView != null) inputView.closing();
|
if (mainKeyboardView != null) {
|
||||||
|
mainKeyboardView.closing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFinishInputViewInternal(boolean finishingInput) {
|
private void onFinishInputViewInternal(boolean finishingInput) {
|
||||||
super.onFinishInputView(finishingInput);
|
super.onFinishInputView(finishingInput);
|
||||||
mKeyboardSwitcher.onFinishInputView();
|
mKeyboardSwitcher.onFinishInputView();
|
||||||
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (inputView != null) inputView.cancelAllMessages();
|
if (mainKeyboardView != null) {
|
||||||
|
mainKeyboardView.cancelAllMessages();
|
||||||
|
}
|
||||||
// Remove pending messages related to update suggestions
|
// Remove pending messages related to update suggestions
|
||||||
mHandler.cancelUpdateSuggestionStrip();
|
mHandler.cancelUpdateSuggestionStrip();
|
||||||
}
|
}
|
||||||
|
@ -925,8 +931,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private void setSuggestionStripShownInternal(boolean shown, boolean needsInputViewShown) {
|
private void setSuggestionStripShownInternal(boolean shown, boolean needsInputViewShown) {
|
||||||
// TODO: Modify this if we support suggestions with hard keyboard
|
// TODO: Modify this if we support suggestions with hard keyboard
|
||||||
if (onEvaluateInputViewShown() && mSuggestionsContainer != null) {
|
if (onEvaluateInputViewShown() && mSuggestionsContainer != null) {
|
||||||
final MainKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
final boolean inputViewShown = (keyboardView != null) ? keyboardView.isShown() : false;
|
final boolean inputViewShown = (mainKeyboardView != null)
|
||||||
|
? mainKeyboardView.isShown() : false;
|
||||||
final boolean shouldShowSuggestions = shown
|
final boolean shouldShowSuggestions = shown
|
||||||
&& (needsInputViewShown ? inputViewShown : true);
|
&& (needsInputViewShown ? inputViewShown : true);
|
||||||
if (isFullscreenMode()) {
|
if (isFullscreenMode()) {
|
||||||
|
@ -949,11 +956,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return currentHeight;
|
return currentHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
final KeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (keyboardView == null) {
|
if (mainKeyboardView == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
final int keyboardHeight = keyboardView.getHeight();
|
final int keyboardHeight = mainKeyboardView.getHeight();
|
||||||
final int suggestionsHeight = mSuggestionsContainer.getHeight();
|
final int suggestionsHeight = mSuggestionsContainer.getHeight();
|
||||||
final int displayHeight = mResources.getDisplayMetrics().heightPixels;
|
final int displayHeight = mResources.getDisplayMetrics().heightPixels;
|
||||||
final Rect rect = new Rect();
|
final Rect rect = new Rect();
|
||||||
|
@ -971,9 +978,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
@Override
|
@Override
|
||||||
public void onComputeInsets(InputMethodService.Insets outInsets) {
|
public void onComputeInsets(InputMethodService.Insets outInsets) {
|
||||||
super.onComputeInsets(outInsets);
|
super.onComputeInsets(outInsets);
|
||||||
final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (inputView == null || mSuggestionsContainer == null)
|
if (mainKeyboardView == null || mSuggestionsContainer == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
final int adjustedBackingHeight = getAdjustedBackingViewHeight();
|
final int adjustedBackingHeight = getAdjustedBackingViewHeight();
|
||||||
final boolean backingGone = (mKeyPreviewBackingView.getVisibility() == View.GONE);
|
final boolean backingGone = (mKeyPreviewBackingView.getVisibility() == View.GONE);
|
||||||
final int backingHeight = backingGone ? 0 : adjustedBackingHeight;
|
final int backingHeight = backingGone ? 0 : adjustedBackingHeight;
|
||||||
|
@ -986,13 +994,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
|
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
|
||||||
int touchY = extraHeight;
|
int touchY = extraHeight;
|
||||||
// Need to set touchable region only if input view is being shown
|
// Need to set touchable region only if input view is being shown
|
||||||
final MainKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
if (mainKeyboardView.isShown()) {
|
||||||
if (keyboardView != null && keyboardView.isShown()) {
|
|
||||||
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
|
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
|
||||||
touchY -= suggestionsHeight;
|
touchY -= suggestionsHeight;
|
||||||
}
|
}
|
||||||
final int touchWidth = inputView.getWidth();
|
final int touchWidth = mainKeyboardView.getWidth();
|
||||||
final int touchHeight = inputView.getHeight() + extraHeight
|
final int touchHeight = mainKeyboardView.getHeight() + extraHeight
|
||||||
// Extend touchable region below the keyboard.
|
// Extend touchable region below the keyboard.
|
||||||
+ EXTENDED_TOUCHABLE_REGION_HEIGHT;
|
+ EXTENDED_TOUCHABLE_REGION_HEIGHT;
|
||||||
outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
|
outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_REGION;
|
||||||
|
@ -1372,7 +1379,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
showSuggestionStrip(suggestedWords, null);
|
showSuggestionStrip(suggestedWords, null);
|
||||||
final String gestureFloatingPreviewText = (suggestedWords.size() > 0)
|
final String gestureFloatingPreviewText = (suggestedWords.size() > 0)
|
||||||
? suggestedWords.getWord(0) : null;
|
? suggestedWords.getWord(0) : null;
|
||||||
mKeyboardSwitcher.getKeyboardView()
|
mKeyboardSwitcher.getMainKeyboardView()
|
||||||
.showGestureFloatingPreviewText(gestureFloatingPreviewText);
|
.showGestureFloatingPreviewText(gestureFloatingPreviewText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,7 +1388,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mWordComposer.setBatchInputPointers(batchPointers);
|
mWordComposer.setBatchInputPointers(batchPointers);
|
||||||
final SuggestedWords suggestedWords = getSuggestedWords();
|
final SuggestedWords suggestedWords = getSuggestedWords();
|
||||||
showSuggestionStrip(suggestedWords, null);
|
showSuggestionStrip(suggestedWords, null);
|
||||||
mKeyboardSwitcher.getKeyboardView().showGestureFloatingPreviewText(null);
|
final String gestureFloatingPreviewText = (suggestedWords.size() > 0)
|
||||||
|
? suggestedWords.getWord(0) : null;
|
||||||
|
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
|
mainKeyboardView.showGestureFloatingPreviewText(gestureFloatingPreviewText);
|
||||||
|
mainKeyboardView.dismissGestureFloatingPreviewText();
|
||||||
if (suggestedWords == null || suggestedWords.size() == 0) {
|
if (suggestedWords == null || suggestedWords.size() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1586,7 +1597,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
keyY = y;
|
keyY = y;
|
||||||
} else {
|
} else {
|
||||||
final KeyDetector keyDetector =
|
final KeyDetector keyDetector =
|
||||||
mKeyboardSwitcher.getKeyboardView().getKeyDetector();
|
mKeyboardSwitcher.getMainKeyboardView().getKeyDetector();
|
||||||
keyX = keyDetector.getTouchX(x);
|
keyX = keyDetector.getTouchX(x);
|
||||||
keyY = keyDetector.getTouchY(y);
|
keyY = keyDetector.getTouchY(y);
|
||||||
}
|
}
|
||||||
|
@ -1688,9 +1699,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private void handleClose() {
|
private void handleClose() {
|
||||||
commitTyped(LastComposedWord.NOT_A_SEPARATOR);
|
commitTyped(LastComposedWord.NOT_A_SEPARATOR);
|
||||||
requestHideSelf(0);
|
requestHideSelf(0);
|
||||||
MainKeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (inputView != null) {
|
if (mainKeyboardView != null) {
|
||||||
inputView.closing();
|
mainKeyboardView.closing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2089,7 +2100,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// onConfigurationChanged before SoftInputWindow is shown.
|
// onConfigurationChanged before SoftInputWindow is shown.
|
||||||
initSuggest();
|
initSuggest();
|
||||||
loadSettings();
|
loadSettings();
|
||||||
if (mKeyboardSwitcher.getKeyboardView() != null) {
|
if (mKeyboardSwitcher.getMainKeyboardView() != null) {
|
||||||
// Reload keyboard because the current language has been changed.
|
// Reload keyboard because the current language has been changed.
|
||||||
mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mCurrentSettings);
|
mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mCurrentSettings);
|
||||||
updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability();
|
updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability();
|
||||||
|
@ -2101,11 +2112,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability() {
|
private void updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability() {
|
||||||
final MainKeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (keyboardView != null) {
|
if (mainKeyboardView != null) {
|
||||||
final boolean shouldHandleGesture = mCurrentSettings.mGestureInputEnabled
|
final boolean shouldHandleGesture = mCurrentSettings.mGestureInputEnabled
|
||||||
&& mIsMainDictionaryAvailable;
|
&& mIsMainDictionaryAvailable;
|
||||||
keyboardView.setGestureHandlingMode(shouldHandleGesture,
|
mainKeyboardView.setGestureHandlingMode(shouldHandleGesture,
|
||||||
mCurrentSettings.mGesturePreviewTrailEnabled,
|
mCurrentSettings.mGesturePreviewTrailEnabled,
|
||||||
mCurrentSettings.mGestureFloatingPreviewTextEnabled);
|
mCurrentSettings.mGestureFloatingPreviewTextEnabled);
|
||||||
}
|
}
|
||||||
|
@ -2114,7 +2125,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// TODO: Remove this method from {@link LatinIME} and move {@link FeedbackManager} to
|
// TODO: Remove this method from {@link LatinIME} and move {@link FeedbackManager} to
|
||||||
// {@link KeyboardSwitcher}. Called from KeyboardSwitcher
|
// {@link KeyboardSwitcher}. Called from KeyboardSwitcher
|
||||||
public void hapticAndAudioFeedback(final int primaryCode) {
|
public void hapticAndAudioFeedback(final int primaryCode) {
|
||||||
mFeedbackManager.hapticAndAudioFeedback(primaryCode, mKeyboardSwitcher.getKeyboardView());
|
mFeedbackManager.hapticAndAudioFeedback(
|
||||||
|
primaryCode, mKeyboardSwitcher.getMainKeyboardView());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback called by PointerTracker through the KeyboardActionListener. This is called when a
|
// Callback called by PointerTracker through the KeyboardActionListener. This is called when a
|
||||||
|
@ -2225,8 +2237,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showOptionDialog(AlertDialog dialog) {
|
public void showOptionDialog(AlertDialog dialog) {
|
||||||
final IBinder windowToken = mKeyboardSwitcher.getKeyboardView().getWindowToken();
|
final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken();
|
||||||
if (windowToken == null) return;
|
if (windowToken == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
dialog.setCanceledOnTouchOutside(true);
|
dialog.setCanceledOnTouchOutside(true);
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (mSplashDialog != null && mSplashDialog.isShowing()) {
|
if (mSplashDialog != null && mSplashDialog.isShowing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final IBinder windowToken = mKeyboardSwitcher.getKeyboardView().getWindowToken();
|
final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken();
|
||||||
if (windowToken == null) {
|
if (windowToken == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -540,11 +540,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (mKeyboardSwitcher == null) {
|
if (mKeyboardSwitcher == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final KeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||||
if (keyboardView == null) {
|
if (mainKeyboardView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
keyboardView.invalidateAllKeys();
|
mainKeyboardView.invalidateAllKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue