Loading core/java/android/widget/Editor.java +5 −19 Original line number Diff line number Diff line Loading @@ -226,8 +226,6 @@ public class Editor { final UndoInputFilter mUndoInputFilter = new UndoInputFilter(this); boolean mAllowUndo = true; private int mLastInputSource = InputDevice.SOURCE_UNKNOWN; private final MetricsLogger mMetricsLogger = new MetricsLogger(); // Cursor Controllers. Loading Loading @@ -1735,8 +1733,6 @@ public class Editor { public void onTouchEvent(MotionEvent event) { final boolean filterOutEvent = shouldFilterOutTouchEvent(event); mLastInputSource = event.getSource(); mLastButtonState = event.getButtonState(); if (filterOutEvent) { if (event.getActionMasked() == MotionEvent.ACTION_UP) { Loading Loading @@ -1789,7 +1785,7 @@ public class Editor { } private void showFloatingToolbar() { if (mTextActionMode != null && showUIForTouchScreen()) { if (mTextActionMode != null && mTextView.showUIForTouchScreen()) { // Delay "show" so it doesn't interfere with click confirmations // or double-clicks that could "dismiss" the floating toolbar. int delay = ViewConfiguration.getDoubleTapTimeout(); Loading Loading @@ -1870,7 +1866,7 @@ public class Editor { ? getSelectionController() : getInsertionController(); if (cursorController != null && !cursorController.isActive() && !cursorController.isCursorBeingModified() && showUIForTouchScreen()) { && mTextView.showUIForTouchScreen()) { cursorController.show(); } } Loading Loading @@ -2521,7 +2517,7 @@ public class Editor { return false; } if (!showUIForTouchScreen()) { if (!mTextView.showUIForTouchScreen()) { return false; } Loading Loading @@ -2677,7 +2673,7 @@ public class Editor { mTextView.postDelayed(mShowSuggestionRunnable, ViewConfiguration.getDoubleTapTimeout()); } else if (hasInsertionController()) { if (shouldInsertCursor && showUIForTouchScreen()) { if (shouldInsertCursor && mTextView.showUIForTouchScreen()) { getInsertionController().show(); } else { getInsertionController().hide(); Loading Loading @@ -5408,7 +5404,7 @@ public class Editor { final boolean shouldShow = checkForTransforms() /*check not rotated and compute scale*/ && !tooLargeTextForMagnifier() && obtainMagnifierShowCoordinates(event, showPosInView) && showUIForTouchScreen(); && mTextView.showUIForTouchScreen(); if (shouldShow) { // Make the cursor visible and stop blinking. mRenderCursorRegardlessTiming = true; Loading Loading @@ -6354,16 +6350,6 @@ public class Editor { } } /** * Returns true when need to show UIs, e.g. floating toolbar, etc, for finger based interaction. * * @return true if UIs need to show for finger interaciton. false if UIs are not necessary. */ public boolean showUIForTouchScreen() { return (mLastInputSource & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN; } /** Controller for the insertion cursor. */ @VisibleForTesting public class InsertionPointCursorController implements CursorController { Loading core/java/android/widget/SelectionActionModeHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ public final class SelectionActionModeHelper { final SelectionModifierCursorController controller = mEditor.getSelectionController(); if (controller != null && (mTextView.isTextSelectable() || mTextView.isTextEditable())) { if (mEditor.showUIForTouchScreen()) { if (mTextView.showUIForTouchScreen()) { controller.show(); } else { controller.hide(); Loading core/java/android/widget/TextView.java +17 −0 Original line number Diff line number Diff line Loading @@ -972,6 +972,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ private int mDeviceProvisionedState = DEVICE_PROVISIONED_UNKNOWN; /** * The last input source on this TextView. */ private int mLastInputSource = InputDevice.SOURCE_UNKNOWN; /** * The TextView does not auto-size text (default). */ Loading Loading @@ -11565,6 +11570,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener MotionEvent.actionToString(event.getActionMasked()), event.getX(), event.getY()); } mLastInputSource = event.getSource(); final int action = event.getActionMasked(); if (mEditor != null) { if (!isFromPrimePointer(event, false)) { Loading Loading @@ -11653,6 +11659,17 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return superResult; } /** * Returns true when need to show UIs, e.g. floating toolbar, etc, for finger based interaction. * * @return true if UIs need to show for finger interaciton. false if UIs are not necessary. * @hide */ public final boolean showUIForTouchScreen() { return (mLastInputSource & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN; } /** * The fill dialog UI is a more conspicuous and efficient interface than dropdown UI. * If autofill suggestions are available when the user clicks on a field that supports filling Loading Loading
core/java/android/widget/Editor.java +5 −19 Original line number Diff line number Diff line Loading @@ -226,8 +226,6 @@ public class Editor { final UndoInputFilter mUndoInputFilter = new UndoInputFilter(this); boolean mAllowUndo = true; private int mLastInputSource = InputDevice.SOURCE_UNKNOWN; private final MetricsLogger mMetricsLogger = new MetricsLogger(); // Cursor Controllers. Loading Loading @@ -1735,8 +1733,6 @@ public class Editor { public void onTouchEvent(MotionEvent event) { final boolean filterOutEvent = shouldFilterOutTouchEvent(event); mLastInputSource = event.getSource(); mLastButtonState = event.getButtonState(); if (filterOutEvent) { if (event.getActionMasked() == MotionEvent.ACTION_UP) { Loading Loading @@ -1789,7 +1785,7 @@ public class Editor { } private void showFloatingToolbar() { if (mTextActionMode != null && showUIForTouchScreen()) { if (mTextActionMode != null && mTextView.showUIForTouchScreen()) { // Delay "show" so it doesn't interfere with click confirmations // or double-clicks that could "dismiss" the floating toolbar. int delay = ViewConfiguration.getDoubleTapTimeout(); Loading Loading @@ -1870,7 +1866,7 @@ public class Editor { ? getSelectionController() : getInsertionController(); if (cursorController != null && !cursorController.isActive() && !cursorController.isCursorBeingModified() && showUIForTouchScreen()) { && mTextView.showUIForTouchScreen()) { cursorController.show(); } } Loading Loading @@ -2521,7 +2517,7 @@ public class Editor { return false; } if (!showUIForTouchScreen()) { if (!mTextView.showUIForTouchScreen()) { return false; } Loading Loading @@ -2677,7 +2673,7 @@ public class Editor { mTextView.postDelayed(mShowSuggestionRunnable, ViewConfiguration.getDoubleTapTimeout()); } else if (hasInsertionController()) { if (shouldInsertCursor && showUIForTouchScreen()) { if (shouldInsertCursor && mTextView.showUIForTouchScreen()) { getInsertionController().show(); } else { getInsertionController().hide(); Loading Loading @@ -5408,7 +5404,7 @@ public class Editor { final boolean shouldShow = checkForTransforms() /*check not rotated and compute scale*/ && !tooLargeTextForMagnifier() && obtainMagnifierShowCoordinates(event, showPosInView) && showUIForTouchScreen(); && mTextView.showUIForTouchScreen(); if (shouldShow) { // Make the cursor visible and stop blinking. mRenderCursorRegardlessTiming = true; Loading Loading @@ -6354,16 +6350,6 @@ public class Editor { } } /** * Returns true when need to show UIs, e.g. floating toolbar, etc, for finger based interaction. * * @return true if UIs need to show for finger interaciton. false if UIs are not necessary. */ public boolean showUIForTouchScreen() { return (mLastInputSource & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN; } /** Controller for the insertion cursor. */ @VisibleForTesting public class InsertionPointCursorController implements CursorController { Loading
core/java/android/widget/SelectionActionModeHelper.java +1 −1 Original line number Diff line number Diff line Loading @@ -301,7 +301,7 @@ public final class SelectionActionModeHelper { final SelectionModifierCursorController controller = mEditor.getSelectionController(); if (controller != null && (mTextView.isTextSelectable() || mTextView.isTextEditable())) { if (mEditor.showUIForTouchScreen()) { if (mTextView.showUIForTouchScreen()) { controller.show(); } else { controller.hide(); Loading
core/java/android/widget/TextView.java +17 −0 Original line number Diff line number Diff line Loading @@ -972,6 +972,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ private int mDeviceProvisionedState = DEVICE_PROVISIONED_UNKNOWN; /** * The last input source on this TextView. */ private int mLastInputSource = InputDevice.SOURCE_UNKNOWN; /** * The TextView does not auto-size text (default). */ Loading Loading @@ -11565,6 +11570,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener MotionEvent.actionToString(event.getActionMasked()), event.getX(), event.getY()); } mLastInputSource = event.getSource(); final int action = event.getActionMasked(); if (mEditor != null) { if (!isFromPrimePointer(event, false)) { Loading Loading @@ -11653,6 +11659,17 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return superResult; } /** * Returns true when need to show UIs, e.g. floating toolbar, etc, for finger based interaction. * * @return true if UIs need to show for finger interaciton. false if UIs are not necessary. * @hide */ public final boolean showUIForTouchScreen() { return (mLastInputSource & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN; } /** * The fill dialog UI is a more conspicuous and efficient interface than dropdown UI. * If autofill suggestions are available when the user clicks on a field that supports filling Loading