Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 336eaf30 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Cleanup Editor.java."

parents fe6dc65a c5a43202
Loading
Loading
Loading
Loading
+17 −25
Original line number Original line Diff line number Diff line
@@ -162,15 +162,15 @@ public class Editor {
    boolean mAllowUndo = true;
    boolean mAllowUndo = true;


    // Cursor Controllers.
    // Cursor Controllers.
    InsertionPointCursorController mInsertionPointCursorController;
    private InsertionPointCursorController mInsertionPointCursorController;
    SelectionModifierCursorController mSelectionModifierCursorController;
    SelectionModifierCursorController mSelectionModifierCursorController;
    // Action mode used when text is selected or when actions on an insertion cursor are triggered.
    // Action mode used when text is selected or when actions on an insertion cursor are triggered.
    ActionMode mTextActionMode;
    ActionMode mTextActionMode;
    boolean mInsertionControllerEnabled;
    private boolean mInsertionControllerEnabled;
    boolean mSelectionControllerEnabled;
    private boolean mSelectionControllerEnabled;


    // Used to highlight a word when it is corrected by the IME
    // Used to highlight a word when it is corrected by the IME
    CorrectionHighlighter mCorrectionHighlighter;
    private CorrectionHighlighter mCorrectionHighlighter;


    InputContentType mInputContentType;
    InputContentType mInputContentType;
    InputMethodState mInputMethodState;
    InputMethodState mInputMethodState;
@@ -184,7 +184,7 @@ public class Editor {
        }
        }
        boolean needsRecord() { return isDirty || !renderNode.isValid(); }
        boolean needsRecord() { return isDirty || !renderNode.isValid(); }
    }
    }
    TextRenderNode[] mTextRenderNodes;
    private TextRenderNode[] mTextRenderNodes;


    boolean mFrozenWithFocus;
    boolean mFrozenWithFocus;
    boolean mSelectionMoved;
    boolean mSelectionMoved;
@@ -195,10 +195,9 @@ public class Editor {


    boolean mDiscardNextActionUp;
    boolean mDiscardNextActionUp;
    boolean mIgnoreActionUpEvent;
    boolean mIgnoreActionUpEvent;
    private boolean mIgnoreNextMouseActionUpOrDown;


    long mShowCursor;
    long mShowCursor;
    Blink mBlink;
    private Blink mBlink;


    boolean mCursorVisible = true;
    boolean mCursorVisible = true;
    boolean mSelectAllOnFocus;
    boolean mSelectAllOnFocus;
@@ -206,7 +205,7 @@ public class Editor {


    CharSequence mError;
    CharSequence mError;
    boolean mErrorWasChanged;
    boolean mErrorWasChanged;
    ErrorPopup mErrorPopup;
    private ErrorPopup mErrorPopup;


    /**
    /**
     * This flag is set if the TextView tries to display an error before it
     * This flag is set if the TextView tries to display an error before it
@@ -214,7 +213,7 @@ public class Editor {
     * It causes the error to be shown later, when onAttachedToWindow()
     * It causes the error to be shown later, when onAttachedToWindow()
     * is called.
     * is called.
     */
     */
    boolean mShowErrorAfterAttach;
    private boolean mShowErrorAfterAttach;


    boolean mInBatchEditControllers;
    boolean mInBatchEditControllers;
    boolean mShowSoftInputOnFocus = true;
    boolean mShowSoftInputOnFocus = true;
@@ -223,9 +222,9 @@ public class Editor {


    boolean mIsBeingLongClicked;
    boolean mIsBeingLongClicked;


    SuggestionsPopupWindow mSuggestionsPopupWindow;
    private SuggestionsPopupWindow mSuggestionsPopupWindow;
    SuggestionRangeSpan mSuggestionRangeSpan;
    SuggestionRangeSpan mSuggestionRangeSpan;
    Runnable mShowSuggestionRunnable;
    private Runnable mShowSuggestionRunnable;


    final Drawable[] mCursorDrawable = new Drawable[2];
    final Drawable[] mCursorDrawable = new Drawable[2];
    int mCursorCount; // Current number of used mCursorDrawable: 0 (resource=0), 1 or 2 (split)
    int mCursorCount; // Current number of used mCursorDrawable: 0 (resource=0), 1 or 2 (split)
@@ -237,7 +236,7 @@ public class Editor {
    // Global listener that detects changes in the global position of the TextView
    // Global listener that detects changes in the global position of the TextView
    private PositionListener mPositionListener;
    private PositionListener mPositionListener;


    float mLastDownPositionX, mLastDownPositionY;
    private float mLastDownPositionX, mLastDownPositionY;
    private float mContextMenuAnchorX, mContextMenuAnchorY;
    private float mContextMenuAnchorX, mContextMenuAnchorY;
    Callback mCustomSelectionActionModeCallback;
    Callback mCustomSelectionActionModeCallback;
    Callback mCustomInsertionActionModeCallback;
    Callback mCustomInsertionActionModeCallback;
@@ -264,7 +263,7 @@ public class Editor {
    // - SelectionSpans, for which we need to call updateSelection if an IME is attached
    // - SelectionSpans, for which we need to call updateSelection if an IME is attached
    private SpanController mSpanController;
    private SpanController mSpanController;


    WordIterator mWordIterator;
    private WordIterator mWordIterator;
    SpellChecker mSpellChecker;
    SpellChecker mSpellChecker;


    // This word iterator is set with text and used to determine word boundaries
    // This word iterator is set with text and used to determine word boundaries
@@ -279,7 +278,7 @@ public class Editor {


    final ProcessTextIntentActionsHandler mProcessTextIntentActionsHandler;
    final ProcessTextIntentActionsHandler mProcessTextIntentActionsHandler;


    final CursorAnchorInfoNotifier mCursorAnchorInfoNotifier = new CursorAnchorInfoNotifier();
    private final CursorAnchorInfoNotifier mCursorAnchorInfoNotifier = new CursorAnchorInfoNotifier();


    private final Runnable mShowFloatingToolbar = new Runnable() {
    private final Runnable mShowFloatingToolbar = new Runnable() {
        @Override
        @Override
@@ -931,9 +930,6 @@ public class Editor {
        mWordIteratorWithText = null;
        mWordIteratorWithText = null;
    }
    }


    /**
     * @hide
     */
    public WordIterator getWordIterator() {
    public WordIterator getWordIterator() {
        if (mWordIterator == null) {
        if (mWordIterator == null) {
            mWordIterator = new WordIterator(mTextView.getTextServicesLocale());
            mWordIterator = new WordIterator(mTextView.getTextServicesLocale());
@@ -1285,7 +1281,6 @@ public class Editor {
                mBlink.uncancel();
                mBlink.uncancel();
                makeBlink();
                makeBlink();
            }
            }
            final InputMethodManager imm = InputMethodManager.peekInstance();
            if (mTextView.hasSelection() && !extractedTextModeWillBeStarted()) {
            if (mTextView.hasSelection() && !extractedTextModeWillBeStarted()) {
                refreshTextActionMode();
                refreshTextActionMode();
            }
            }
@@ -2017,7 +2012,7 @@ public class Editor {
        return selectionStarted;
        return selectionStarted;
    }
    }


    boolean extractedTextModeWillBeStarted() {
    private boolean extractedTextModeWillBeStarted() {
        if (!(mTextView.isInExtractedMode())) {
        if (!(mTextView.isInExtractedMode())) {
            final InputMethodManager imm = InputMethodManager.peekInstance();
            final InputMethodManager imm = InputMethodManager.peekInstance();
            return  imm != null && imm.isFullscreenMode();
            return  imm != null && imm.isFullscreenMode();
@@ -2170,7 +2165,7 @@ public class Editor {
        return mSelectionControllerEnabled;
        return mSelectionControllerEnabled;
    }
    }


    InsertionPointCursorController getInsertionController() {
    private InsertionPointCursorController getInsertionController() {
        if (!mInsertionControllerEnabled) {
        if (!mInsertionControllerEnabled) {
            return null;
            return null;
        }
        }
@@ -2185,7 +2180,7 @@ public class Editor {
        return mInsertionPointCursorController;
        return mInsertionPointCursorController;
    }
    }


    SelectionModifierCursorController getSelectionController() {
    private SelectionModifierCursorController getSelectionController() {
        if (!mSelectionControllerEnabled) {
        if (!mSelectionControllerEnabled) {
            return null;
            return null;
        }
        }
@@ -2200,9 +2195,6 @@ public class Editor {
        return mSelectionModifierCursorController;
        return mSelectionModifierCursorController;
    }
    }


    /**
     * @hide
     */
    @VisibleForTesting
    @VisibleForTesting
    public Drawable[] getCursorDrawable() {
    public Drawable[] getCursorDrawable() {
        return mCursorDrawable;
        return mCursorDrawable;
@@ -2677,7 +2669,7 @@ public class Editor {
     * pop-up should be displayed.
     * pop-up should be displayed.
     * Also monitors {@link Selection} to call back to the attached input method.
     * Also monitors {@link Selection} to call back to the attached input method.
     */
     */
    class SpanController implements SpanWatcher {
    private class SpanController implements SpanWatcher {


        private static final int DISPLAY_TIMEOUT_MS = 3000; // 3 secs
        private static final int DISPLAY_TIMEOUT_MS = 3000; // 3 secs