am d9449ccf: Move MoreKeysPanel.Controller implementation to MainKeyboardView
* commit 'd9449ccf3ce9e5eabb022aed6a45bba680bce115': Move MoreKeysPanel.Controller implementation to MainKeyboardViewmain
commit
6ede30353f
|
@ -67,9 +67,6 @@
|
||||||
<!-- Amount to offset the touch Y coordinate by, for bias correction. -->
|
<!-- Amount to offset the touch Y coordinate by, for bias correction. -->
|
||||||
<attr name="verticalCorrection" format="dimension" />
|
<attr name="verticalCorrection" format="dimension" />
|
||||||
|
|
||||||
<!-- Layout resource for more keys panel -->
|
|
||||||
<attr name="moreKeysLayout" format="reference" />
|
|
||||||
|
|
||||||
<attr name="backgroundDimAlpha" format="integer" />
|
<attr name="backgroundDimAlpha" format="integer" />
|
||||||
|
|
||||||
<!-- Attributes for PreviewPlacerView -->
|
<!-- Attributes for PreviewPlacerView -->
|
||||||
|
@ -126,6 +123,8 @@
|
||||||
<attr name="longPressShiftKeyTimeout" format="integer" />
|
<attr name="longPressShiftKeyTimeout" format="integer" />
|
||||||
<!-- Ignore special key timeout while typing in millisecond. -->
|
<!-- Ignore special key timeout while typing in millisecond. -->
|
||||||
<attr name="ignoreAltCodeKeyTimeout" format="integer" />
|
<attr name="ignoreAltCodeKeyTimeout" format="integer" />
|
||||||
|
<!-- Layout resource for more keys keyboard -->
|
||||||
|
<attr name="moreKeysKeyboardLayout" format="reference" />
|
||||||
<!-- More keys keyboard will shown at touched point. -->
|
<!-- More keys keyboard will shown at touched point. -->
|
||||||
<attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" />
|
<attr name="showMoreKeysKeyboardAtTouchedPoint" format="boolean" />
|
||||||
<!-- Static threshold for gesture after fast typing (msec) -->
|
<!-- Static threshold for gesture after fast typing (msec) -->
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
<item name="keyPreviewHeight">@dimen/key_preview_height</item>
|
<item name="keyPreviewHeight">@dimen/key_preview_height</item>
|
||||||
<item name="keyPreviewTextRatio">@fraction/key_preview_text_ratio</item>
|
<item name="keyPreviewTextRatio">@fraction/key_preview_text_ratio</item>
|
||||||
<item name="keyPreviewLingerTimeout">@integer/config_key_preview_linger_timeout</item>
|
<item name="keyPreviewLingerTimeout">@integer/config_key_preview_linger_timeout</item>
|
||||||
<item name="moreKeysLayout">@layout/more_keys_keyboard</item>
|
|
||||||
<item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
|
<item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
|
||||||
<item name="keyTextShadowColor">@color/key_text_shadow_color_default</item>
|
<item name="keyTextShadowColor">@color/key_text_shadow_color_default</item>
|
||||||
<item name="keyTextShadowRadius">2.75</item>
|
<item name="keyTextShadowRadius">2.75</item>
|
||||||
|
@ -89,6 +88,7 @@
|
||||||
<item name="longPressKeyTimeout">@integer/config_long_press_key_timeout</item>
|
<item name="longPressKeyTimeout">@integer/config_long_press_key_timeout</item>
|
||||||
<item name="longPressShiftKeyTimeout">@integer/config_long_press_shift_key_timeout</item>
|
<item name="longPressShiftKeyTimeout">@integer/config_long_press_shift_key_timeout</item>
|
||||||
<item name="ignoreAltCodeKeyTimeout">@integer/config_ignore_alt_code_key_timeout</item>
|
<item name="ignoreAltCodeKeyTimeout">@integer/config_ignore_alt_code_key_timeout</item>
|
||||||
|
<item name="moreKeysKeyboardLayout">@layout/more_keys_keyboard</item>
|
||||||
<item name="showMoreKeysKeyboardAtTouchedPoint">@bool/config_show_more_keys_keyboard_at_touched_point</item>
|
<item name="showMoreKeysKeyboardAtTouchedPoint">@bool/config_show_more_keys_keyboard_at_touched_point</item>
|
||||||
<item name="languageOnSpacebarFinalAlpha">@integer/config_language_on_spacebar_final_alpha</item>
|
<item name="languageOnSpacebarFinalAlpha">@integer/config_language_on_spacebar_final_alpha</item>
|
||||||
<item name="languageOnSpacebarFadeoutAnimator">@anim/language_on_spacebar_fadeout</item>
|
<item name="languageOnSpacebarFadeoutAnimator">@anim/language_on_spacebar_fadeout</item>
|
||||||
|
|
|
@ -60,7 +60,6 @@ import java.util.HashSet;
|
||||||
* A view that renders a virtual {@link Keyboard}.
|
* A view that renders a virtual {@link Keyboard}.
|
||||||
*
|
*
|
||||||
* @attr ref R.styleable#KeyboardView_keyBackground
|
* @attr ref R.styleable#KeyboardView_keyBackground
|
||||||
* @attr ref R.styleable#KeyboardView_moreKeysLayout
|
|
||||||
* @attr ref R.styleable#KeyboardView_keyPreviewLayout
|
* @attr ref R.styleable#KeyboardView_keyPreviewLayout
|
||||||
* @attr ref R.styleable#KeyboardView_keyPreviewOffset
|
* @attr ref R.styleable#KeyboardView_keyPreviewOffset
|
||||||
* @attr ref R.styleable#KeyboardView_keyPreviewHeight
|
* @attr ref R.styleable#KeyboardView_keyPreviewHeight
|
||||||
|
@ -103,8 +102,8 @@ import java.util.HashSet;
|
||||||
* @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintActivatedColor
|
* @attr ref R.styleable#Keyboard_Key_keyShiftedLetterHintActivatedColor
|
||||||
* @attr ref R.styleable#Keyboard_Key_keyPreviewTextColor
|
* @attr ref R.styleable#Keyboard_Key_keyPreviewTextColor
|
||||||
*/
|
*/
|
||||||
public class KeyboardView extends View implements PointerTracker.DrawingProxy,
|
// TODO: Move PointerTracker.DrawingProxy to MainKeyboardView
|
||||||
MoreKeysPanel.Controller {
|
public class KeyboardView extends View implements PointerTracker.DrawingProxy {
|
||||||
private static final String TAG = KeyboardView.class.getSimpleName();
|
private static final String TAG = KeyboardView.class.getSimpleName();
|
||||||
|
|
||||||
// XML attributes
|
// XML attributes
|
||||||
|
@ -115,7 +114,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy,
|
||||||
private final float mKeyShiftedLetterHintPadding;
|
private final float mKeyShiftedLetterHintPadding;
|
||||||
private final float mKeyTextShadowRadius;
|
private final float mKeyTextShadowRadius;
|
||||||
protected final float mVerticalCorrection;
|
protected final float mVerticalCorrection;
|
||||||
protected final int mMoreKeysLayout;
|
|
||||||
protected final Drawable mKeyBackground;
|
protected final Drawable mKeyBackground;
|
||||||
protected final Rect mKeyBackgroundPadding = new Rect();
|
protected final Rect mKeyBackgroundPadding = new Rect();
|
||||||
private final int mBackgroundDimAlpha;
|
private final int mBackgroundDimAlpha;
|
||||||
|
@ -136,13 +134,10 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy,
|
||||||
protected final KeyDrawParams mKeyDrawParams = new KeyDrawParams();
|
protected final KeyDrawParams mKeyDrawParams = new KeyDrawParams();
|
||||||
|
|
||||||
// Preview placer view
|
// Preview placer view
|
||||||
private final PreviewPlacerView mPreviewPlacerView;
|
// TODO: Move PreviewPlacerView to MainKeyboardView
|
||||||
|
protected final PreviewPlacerView mPreviewPlacerView;
|
||||||
private final int[] mOriginCoords = CoordinateUtils.newInstance();
|
private final int[] mOriginCoords = CoordinateUtils.newInstance();
|
||||||
|
|
||||||
// More keys panel (used by both more keys keyboard and more suggestions view)
|
|
||||||
// TODO: Consider extending to support multiple more keys panels
|
|
||||||
protected MoreKeysPanel mMoreKeysPanel;
|
|
||||||
|
|
||||||
// Key preview
|
// Key preview
|
||||||
private static final int PREVIEW_ALPHA = 240;
|
private static final int PREVIEW_ALPHA = 240;
|
||||||
private final int mKeyPreviewLayoutId;
|
private final int mKeyPreviewLayoutId;
|
||||||
|
@ -287,8 +282,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy,
|
||||||
}
|
}
|
||||||
mVerticalCorrection = keyboardViewAttr.getDimension(
|
mVerticalCorrection = keyboardViewAttr.getDimension(
|
||||||
R.styleable.KeyboardView_verticalCorrection, 0);
|
R.styleable.KeyboardView_verticalCorrection, 0);
|
||||||
mMoreKeysLayout = keyboardViewAttr.getResourceId(
|
|
||||||
R.styleable.KeyboardView_moreKeysLayout, 0);
|
|
||||||
mBackgroundDimAlpha = keyboardViewAttr.getInt(
|
mBackgroundDimAlpha = keyboardViewAttr.getInt(
|
||||||
R.styleable.KeyboardView_backgroundDimAlpha, 0);
|
R.styleable.KeyboardView_backgroundDimAlpha, 0);
|
||||||
mGestureFloatingPreviewTextLingerTimeout = keyboardViewAttr.getInt(
|
mGestureFloatingPreviewTextLingerTimeout = keyboardViewAttr.getInt(
|
||||||
|
@ -1027,42 +1020,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy,
|
||||||
public void closing() {
|
public void closing() {
|
||||||
dismissAllKeyPreviews();
|
dismissAllKeyPreviews();
|
||||||
cancelAllMessages();
|
cancelAllMessages();
|
||||||
onCancelMoreKeysPanel();
|
|
||||||
mInvalidateAllKeys = true;
|
mInvalidateAllKeys = true;
|
||||||
mKeyboard = null;
|
mKeyboard = null;
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShowMoreKeysPanel(final MoreKeysPanel panel) {
|
|
||||||
if (isShowingMoreKeysPanel()) {
|
|
||||||
onDismissMoreKeysPanel();
|
|
||||||
}
|
|
||||||
mMoreKeysPanel = panel;
|
|
||||||
mPreviewPlacerView.addView(mMoreKeysPanel.getContainerView());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isShowingMoreKeysPanel() {
|
|
||||||
return (mMoreKeysPanel != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancelMoreKeysPanel() {
|
|
||||||
if (isShowingMoreKeysPanel()) {
|
|
||||||
mMoreKeysPanel.dismissMoreKeysPanel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDismissMoreKeysPanel() {
|
|
||||||
if (isShowingMoreKeysPanel()) {
|
|
||||||
mPreviewPlacerView.removeView(mMoreKeysPanel.getContainerView());
|
|
||||||
mMoreKeysPanel = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDetachedFromWindow() {
|
protected void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
|
|
|
@ -85,6 +85,7 @@ import java.util.WeakHashMap;
|
||||||
* @attr ref R.styleable#MainKeyboardView_longPressKeyTimeout
|
* @attr ref R.styleable#MainKeyboardView_longPressKeyTimeout
|
||||||
* @attr ref R.styleable#MainKeyboardView_longPressShiftKeyTimeout
|
* @attr ref R.styleable#MainKeyboardView_longPressShiftKeyTimeout
|
||||||
* @attr ref R.styleable#MainKeyboardView_ignoreAltCodeKeyTimeout
|
* @attr ref R.styleable#MainKeyboardView_ignoreAltCodeKeyTimeout
|
||||||
|
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout
|
||||||
* @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
|
* @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
|
||||||
* @attr ref R.styleable#MainKeyboardView_gestureStaticTimeThresholdAfterFastTyping
|
* @attr ref R.styleable#MainKeyboardView_gestureStaticTimeThresholdAfterFastTyping
|
||||||
* @attr ref R.styleable#MainKeyboardView_gestureDetectFastMoveSpeedThreshold
|
* @attr ref R.styleable#MainKeyboardView_gestureDetectFastMoveSpeedThreshold
|
||||||
|
@ -99,7 +100,7 @@ import java.util.WeakHashMap;
|
||||||
* @attr ref R.styleable#MainKeyboardView_suppressKeyPreviewAfterBatchInputDuration
|
* @attr ref R.styleable#MainKeyboardView_suppressKeyPreviewAfterBatchInputDuration
|
||||||
*/
|
*/
|
||||||
public final class MainKeyboardView extends KeyboardView implements PointerTracker.KeyEventHandler,
|
public final class MainKeyboardView extends KeyboardView implements PointerTracker.KeyEventHandler,
|
||||||
TouchScreenRegulator.ProcessMotionEvent {
|
MoreKeysPanel.Controller, TouchScreenRegulator.ProcessMotionEvent {
|
||||||
private static final String TAG = MainKeyboardView.class.getSimpleName();
|
private static final String TAG = MainKeyboardView.class.getSimpleName();
|
||||||
|
|
||||||
// TODO: Kill process when the usability study mode was changed.
|
// TODO: Kill process when the usability study mode was changed.
|
||||||
|
@ -137,11 +138,15 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
// More keys keyboard
|
// More keys keyboard
|
||||||
private final WeakHashMap<Key, MoreKeysPanel> mMoreKeysPanelCache =
|
private final WeakHashMap<Key, MoreKeysPanel> mMoreKeysPanelCache =
|
||||||
new WeakHashMap<Key, MoreKeysPanel>();
|
new WeakHashMap<Key, MoreKeysPanel>();
|
||||||
|
private final int mMoreKeysLayout;
|
||||||
private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint;
|
private final boolean mConfigShowMoreKeysKeyboardAtTouchedPoint;
|
||||||
|
// More keys panel (used by both more keys keyboard and more suggestions view)
|
||||||
|
// TODO: Consider extending to support multiple more keys panels
|
||||||
|
private MoreKeysPanel mMoreKeysPanel;
|
||||||
|
|
||||||
private final TouchScreenRegulator mTouchScreenRegulator;
|
private final TouchScreenRegulator mTouchScreenRegulator;
|
||||||
|
|
||||||
protected KeyDetector mKeyDetector;
|
private KeyDetector mKeyDetector;
|
||||||
private final boolean mHasDistinctMultitouch;
|
private final boolean mHasDistinctMultitouch;
|
||||||
private int mOldPointerCount = 1;
|
private int mOldPointerCount = 1;
|
||||||
private Key mOldKey;
|
private Key mOldKey;
|
||||||
|
@ -402,38 +407,41 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
res, R.array.phantom_sudden_move_event_device_list));
|
res, R.array.phantom_sudden_move_event_device_list));
|
||||||
PointerTracker.init(needsPhantomSuddenMoveEventHack);
|
PointerTracker.init(needsPhantomSuddenMoveEventHack);
|
||||||
|
|
||||||
final TypedArray a = context.obtainStyledAttributes(
|
final TypedArray mainKeyboardViewAttr = context.obtainStyledAttributes(
|
||||||
attrs, R.styleable.MainKeyboardView, defStyle, R.style.MainKeyboardView);
|
attrs, R.styleable.MainKeyboardView, defStyle, R.style.MainKeyboardView);
|
||||||
mAutoCorrectionSpacebarLedEnabled = a.getBoolean(
|
mAutoCorrectionSpacebarLedEnabled = mainKeyboardViewAttr.getBoolean(
|
||||||
R.styleable.MainKeyboardView_autoCorrectionSpacebarLedEnabled, false);
|
R.styleable.MainKeyboardView_autoCorrectionSpacebarLedEnabled, false);
|
||||||
mAutoCorrectionSpacebarLedIcon = a.getDrawable(
|
mAutoCorrectionSpacebarLedIcon = mainKeyboardViewAttr.getDrawable(
|
||||||
R.styleable.MainKeyboardView_autoCorrectionSpacebarLedIcon);
|
R.styleable.MainKeyboardView_autoCorrectionSpacebarLedIcon);
|
||||||
mSpacebarTextRatio = a.getFraction(
|
mSpacebarTextRatio = mainKeyboardViewAttr.getFraction(
|
||||||
R.styleable.MainKeyboardView_spacebarTextRatio, 1, 1, 1.0f);
|
R.styleable.MainKeyboardView_spacebarTextRatio, 1, 1, 1.0f);
|
||||||
mSpacebarTextColor = a.getColor(R.styleable.MainKeyboardView_spacebarTextColor, 0);
|
mSpacebarTextColor = mainKeyboardViewAttr.getColor(
|
||||||
mSpacebarTextShadowColor = a.getColor(
|
R.styleable.MainKeyboardView_spacebarTextColor, 0);
|
||||||
|
mSpacebarTextShadowColor = mainKeyboardViewAttr.getColor(
|
||||||
R.styleable.MainKeyboardView_spacebarTextShadowColor, 0);
|
R.styleable.MainKeyboardView_spacebarTextShadowColor, 0);
|
||||||
mLanguageOnSpacebarFinalAlpha = a.getInt(
|
mLanguageOnSpacebarFinalAlpha = mainKeyboardViewAttr.getInt(
|
||||||
R.styleable.MainKeyboardView_languageOnSpacebarFinalAlpha,
|
R.styleable.MainKeyboardView_languageOnSpacebarFinalAlpha,
|
||||||
Constants.Color.ALPHA_OPAQUE);
|
Constants.Color.ALPHA_OPAQUE);
|
||||||
final int languageOnSpacebarFadeoutAnimatorResId = a.getResourceId(
|
final int languageOnSpacebarFadeoutAnimatorResId = mainKeyboardViewAttr.getResourceId(
|
||||||
R.styleable.MainKeyboardView_languageOnSpacebarFadeoutAnimator, 0);
|
R.styleable.MainKeyboardView_languageOnSpacebarFadeoutAnimator, 0);
|
||||||
final int altCodeKeyWhileTypingFadeoutAnimatorResId = a.getResourceId(
|
final int altCodeKeyWhileTypingFadeoutAnimatorResId = mainKeyboardViewAttr.getResourceId(
|
||||||
R.styleable.MainKeyboardView_altCodeKeyWhileTypingFadeoutAnimator, 0);
|
R.styleable.MainKeyboardView_altCodeKeyWhileTypingFadeoutAnimator, 0);
|
||||||
final int altCodeKeyWhileTypingFadeinAnimatorResId = a.getResourceId(
|
final int altCodeKeyWhileTypingFadeinAnimatorResId = mainKeyboardViewAttr.getResourceId(
|
||||||
R.styleable.MainKeyboardView_altCodeKeyWhileTypingFadeinAnimator, 0);
|
R.styleable.MainKeyboardView_altCodeKeyWhileTypingFadeinAnimator, 0);
|
||||||
|
|
||||||
final float keyHysteresisDistance = a.getDimension(
|
final float keyHysteresisDistance = mainKeyboardViewAttr.getDimension(
|
||||||
R.styleable.MainKeyboardView_keyHysteresisDistance, 0);
|
R.styleable.MainKeyboardView_keyHysteresisDistance, 0);
|
||||||
final float keyHysteresisDistanceForSlidingModifier = a.getDimension(
|
final float keyHysteresisDistanceForSlidingModifier = mainKeyboardViewAttr.getDimension(
|
||||||
R.styleable.MainKeyboardView_keyHysteresisDistanceForSlidingModifier, 0);
|
R.styleable.MainKeyboardView_keyHysteresisDistanceForSlidingModifier, 0);
|
||||||
mKeyDetector = new KeyDetector(
|
mKeyDetector = new KeyDetector(
|
||||||
keyHysteresisDistance, keyHysteresisDistanceForSlidingModifier);
|
keyHysteresisDistance, keyHysteresisDistanceForSlidingModifier);
|
||||||
mKeyTimerHandler = new KeyTimerHandler(this, a);
|
mKeyTimerHandler = new KeyTimerHandler(this, mainKeyboardViewAttr);
|
||||||
mConfigShowMoreKeysKeyboardAtTouchedPoint = a.getBoolean(
|
mMoreKeysLayout = mainKeyboardViewAttr.getResourceId(
|
||||||
|
R.styleable.MainKeyboardView_moreKeysKeyboardLayout, 0);
|
||||||
|
mConfigShowMoreKeysKeyboardAtTouchedPoint = mainKeyboardViewAttr.getBoolean(
|
||||||
R.styleable.MainKeyboardView_showMoreKeysKeyboardAtTouchedPoint, false);
|
R.styleable.MainKeyboardView_showMoreKeysKeyboardAtTouchedPoint, false);
|
||||||
PointerTracker.setParameters(a);
|
PointerTracker.setParameters(mainKeyboardViewAttr);
|
||||||
a.recycle();
|
mainKeyboardViewAttr.recycle();
|
||||||
|
|
||||||
mLanguageOnSpacebarFadeoutAnimator = loadObjectAnimator(
|
mLanguageOnSpacebarFadeoutAnimator = loadObjectAnimator(
|
||||||
languageOnSpacebarFadeoutAnimatorResId, this);
|
languageOnSpacebarFadeoutAnimatorResId, this);
|
||||||
|
@ -591,8 +599,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
return onLongPress(parentKey, tracker);
|
return onLongPress(parentKey, tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This default implementation returns a more keys panel.
|
private MoreKeysPanel onCreateMoreKeysPanel(final Key parentKey) {
|
||||||
protected MoreKeysPanel onCreateMoreKeysPanel(final Key parentKey) {
|
|
||||||
if (parentKey.mMoreKeys == null) {
|
if (parentKey.mMoreKeys == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -613,14 +620,13 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a key is long pressed. By default this will open more keys keyboard associated
|
* Called when a key is long pressed.
|
||||||
* with this key.
|
|
||||||
* @param parentKey the key that was long pressed
|
* @param parentKey the key that was long pressed
|
||||||
* @param tracker the pointer tracker which pressed the parent key
|
* @param tracker the pointer tracker which pressed the parent key
|
||||||
* @return true if the long press is handled, false otherwise. Subclasses should call the
|
* @return true if the long press is handled, false otherwise. Subclasses should call the
|
||||||
* method on the base class if the subclass doesn't wish to handle the call.
|
* method on the base class if the subclass doesn't wish to handle the call.
|
||||||
*/
|
*/
|
||||||
protected boolean onLongPress(final Key parentKey, final PointerTracker tracker) {
|
private boolean onLongPress(final Key parentKey, final PointerTracker tracker) {
|
||||||
if (ProductionFlag.IS_EXPERIMENTAL) {
|
if (ProductionFlag.IS_EXPERIMENTAL) {
|
||||||
ResearchLogger.mainKeyboardView_onLongPress();
|
ResearchLogger.mainKeyboardView_onLongPress();
|
||||||
}
|
}
|
||||||
|
@ -697,6 +703,38 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
return PointerTracker.isAnyInSlidingKeyInput();
|
return PointerTracker.isAnyInSlidingKeyInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShowMoreKeysPanel(final MoreKeysPanel panel) {
|
||||||
|
if (isShowingMoreKeysPanel()) {
|
||||||
|
onDismissMoreKeysPanel();
|
||||||
|
}
|
||||||
|
mMoreKeysPanel = panel;
|
||||||
|
mPreviewPlacerView.addView(mMoreKeysPanel.getContainerView());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isShowingMoreKeysPanel() {
|
||||||
|
return (mMoreKeysPanel != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancelMoreKeysPanel() {
|
||||||
|
if (isShowingMoreKeysPanel()) {
|
||||||
|
mMoreKeysPanel.dismissMoreKeysPanel();
|
||||||
|
}
|
||||||
|
PointerTracker.dismissAllMoreKeysPanels();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onDismissMoreKeysPanel() {
|
||||||
|
dimEntireKeyboard(false /* dimmed */);
|
||||||
|
if (isShowingMoreKeysPanel()) {
|
||||||
|
mPreviewPlacerView.removeView(mMoreKeysPanel.getContainerView());
|
||||||
|
mMoreKeysPanel = null;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPointerCount() {
|
public int getPointerCount() {
|
||||||
return mOldPointerCount;
|
return mOldPointerCount;
|
||||||
}
|
}
|
||||||
|
@ -853,18 +891,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
mMoreKeysPanelCache.clear();
|
mMoreKeysPanelCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCancelMoreKeysPanel() {
|
|
||||||
super.onCancelMoreKeysPanel();
|
|
||||||
PointerTracker.dismissAllMoreKeysPanels();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onDismissMoreKeysPanel() {
|
|
||||||
dimEntireKeyboard(false /* dimmed */);
|
|
||||||
return super.onDismissMoreKeysPanel();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receives hover events from the input framework.
|
* Receives hover events from the input framework.
|
||||||
*
|
*
|
||||||
|
|
|
@ -52,7 +52,7 @@ import android.widget.TextView;
|
||||||
import com.android.inputmethod.keyboard.Keyboard;
|
import com.android.inputmethod.keyboard.Keyboard;
|
||||||
import com.android.inputmethod.keyboard.KeyboardActionListener;
|
import com.android.inputmethod.keyboard.KeyboardActionListener;
|
||||||
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
import com.android.inputmethod.keyboard.KeyboardSwitcher;
|
||||||
import com.android.inputmethod.keyboard.KeyboardView;
|
import com.android.inputmethod.keyboard.MainKeyboardView;
|
||||||
import com.android.inputmethod.keyboard.MoreKeysPanel;
|
import com.android.inputmethod.keyboard.MoreKeysPanel;
|
||||||
import com.android.inputmethod.keyboard.ViewLayoutUtils;
|
import com.android.inputmethod.keyboard.ViewLayoutUtils;
|
||||||
import com.android.inputmethod.latin.AutoCorrection;
|
import com.android.inputmethod.latin.AutoCorrection;
|
||||||
|
@ -81,7 +81,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
static final boolean DBG = LatinImeLogger.sDBG;
|
static final boolean DBG = LatinImeLogger.sDBG;
|
||||||
|
|
||||||
private final ViewGroup mSuggestionsStrip;
|
private final ViewGroup mSuggestionsStrip;
|
||||||
KeyboardView mKeyboardView;
|
MainKeyboardView mMainKeyboardView;
|
||||||
|
|
||||||
private final View mMoreSuggestionsContainer;
|
private final View mMoreSuggestionsContainer;
|
||||||
private final MoreSuggestionsView mMoreSuggestionsView;
|
private final MoreSuggestionsView mMoreSuggestionsView;
|
||||||
|
@ -610,7 +610,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
*/
|
*/
|
||||||
public void setListener(final Listener listener, final View inputView) {
|
public void setListener(final Listener listener, final View inputView) {
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mKeyboardView = (KeyboardView)inputView.findViewById(R.id.keyboard_view);
|
mMainKeyboardView = (MainKeyboardView)inputView.findViewById(R.id.keyboard_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSuggestions(final SuggestedWords suggestedWords) {
|
public void setSuggestions(final SuggestedWords suggestedWords) {
|
||||||
|
@ -676,13 +676,13 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
new MoreKeysPanel.Controller() {
|
new MoreKeysPanel.Controller() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onDismissMoreKeysPanel() {
|
public boolean onDismissMoreKeysPanel() {
|
||||||
mKeyboardView.dimEntireKeyboard(false /* dimmed */);
|
mMainKeyboardView.dimEntireKeyboard(false /* dimmed */);
|
||||||
return mKeyboardView.onDismissMoreKeysPanel();
|
return mMainKeyboardView.onDismissMoreKeysPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowMoreKeysPanel(MoreKeysPanel panel) {
|
public void onShowMoreKeysPanel(MoreKeysPanel panel) {
|
||||||
mKeyboardView.onShowMoreKeysPanel(panel);
|
mMainKeyboardView.onShowMoreKeysPanel(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -728,7 +728,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
||||||
mMoreSuggestionsMode = MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING;
|
mMoreSuggestionsMode = MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING;
|
||||||
mOriginX = mLastX;
|
mOriginX = mLastX;
|
||||||
mOriginY = mLastY;
|
mOriginY = mLastY;
|
||||||
mKeyboardView.dimEntireKeyboard(true /* dimmed */);
|
mMainKeyboardView.dimEntireKeyboard(true /* dimmed */);
|
||||||
for (int i = 0; i < params.mSuggestionsCountInStrip; i++) {
|
for (int i = 0; i < params.mSuggestionsCountInStrip; i++) {
|
||||||
mWords.get(i).setPressed(false);
|
mWords.get(i).setPressed(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue