Projects >> platform_frameworks_base >>ec1cae6daa179a9e86723ecbcfad441fc3c0dd70

Chunk
Conflicting content
    private int mLastDownPositionX, mLastDownPositionY;
    Drawable mSelectHandleRight;
    Drawable mSelectHandleCenter;

<<<<<<< HEAD
    private Callback mCustomSelectionActionModeCallback;

    private final int mSquaredTouchSlopDistance;
=======
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
    // Set when this TextView gained focus with some text selected. Will start selection mode.
    private boolean mCreatedWithASelection = false;
Solution content
    Drawable mSelectHandleRight;
    Drawable mSelectHandleCenter;

    private int mLastDownPositionX, mLastDownPositionY;
    private Callback mCustomSelectionActionModeCallback;

    private final int mSquaredTouchSlopDistance;
    // Set when this TextView gained focus with some text selected. Will start selection mode.
    private boolean mCreatedWithASelection = false;
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute
Chunk
Conflicting content
        // This has to be checked here since:
        // - onFocusChanged cannot start it when focus is given to a view with selected text (after
        //   a screen rotation) since layout is not yet initialized at that point.
<<<<<<< HEAD
        if (mCreatedWithASelection) {
            startSelectionActionMode();
            mCreatedWithASelection = false;
        }

        // Phone specific code (there is no ExtractEditText on tablets).
        // ExtractEditText does not call onFocus when it is displayed, and mHasSelectionOnFocus can
        // not be set. Do the test here instead.
        if (this instanceof ExtractEditText && hasSelection()) {
            startSelectionActionMode();
=======
        // - ExtractEditText does not call onFocus when it is displayed. Fixing this issue would
        //   allow to test for hasSelection in onFocusChanged, which would trigger a
        //   startTextSelectionMode here. TODO
        if (mCreatedWithASelection ||
           (this instanceof ExtractEditText && selectionController != null && hasSelection())) {
            startTextSelectionMode();
            mCreatedWithASelection = false;
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
        }

        mPreDrawState = PREDRAW_DONE;
Solution content
        // This has to be checked here since:
        // - onFocusChanged cannot start it when focus is given to a view with selected text (after
        //   a screen rotation) since layout is not yet initialized at that point.
        if (mCreatedWithASelection) {
            startSelectionActionMode();
            mCreatedWithASelection = false;
        }

        // Phone specific code (there is no ExtractEditText on tablets).
        // ExtractEditText does not call onFocus when it is displayed, and mHasSelectionOnFocus can
        // not be set. Do the test here instead.
        if (this instanceof ExtractEditText && hasSelection()) {
            startSelectionActionMode();
        }

        mPreDrawState = PREDRAW_DONE;
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
If statement
Method invocation
Chunk
Conflicting content
                }

                if (mSelectAllOnFocus) {
<<<<<<< HEAD
                    selectAll();
=======
                    Selection.setSelection((Spannable) mText, 0, mText.length());
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
                }

                mTouchFocusSelected = true;
Solution content
                mTouchFocusSelected = true;
                    selectAll();
                }

                }

                if (mSelectAllOnFocus) {
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
                terminateSelectionActionMode();
                Selection.setSelection((Spannable) mText, selStart, selEnd);
            } else {
<<<<<<< HEAD
                terminateSelectionActionMode();
=======
                stopTextSelectionMode();
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
            }

            // No need to create the controller
Solution content
                terminateSelectionActionMode();
                Selection.setSelection((Spannable) mText, selStart, selEnd);
            } else {
                terminateSelectionActionMode();
            }

            // No need to create the controller
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
=======
    private void onTapUpEvent(int prevStart, int prevEnd) {
        final int start = getSelectionStart();
        final int end = getSelectionEnd();

        if (start == end) {
            boolean tapInsideSelectAllOnFocus = mSelectAllOnFocus && prevStart == 0 &&
                  prevEnd == mText.length();
            if (start >= prevStart && start < prevEnd && !tapInsideSelectAllOnFocus) {
                // Restore previous selection
                Selection.setSelection((Spannable)mText, prevStart, prevEnd);

                // Tapping inside the selection displays the cut/copy/paste context menu
                showContextMenu();
            } else {
                // Tapping outside stops selection mode, if any
                stopTextSelectionMode();

                boolean selectAllGotFocus = mSelectAllOnFocus && mTouchFocusSelected;
                if (hasInsertionController() && !selectAllGotFocus) {
                    getInsertionController().show();
                }
            }
        }
    }

>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
    class CommitSelectionReceiver extends ResultReceiver {
        private final int mPrevStart, mPrevEnd;
Solution content
        }
    }

    class CommitSelectionReceiver extends ResultReceiver {
        private final int mPrevStart, mPrevEnd;
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
=======
                    startTextSelectionMode();
                    startSelectionActionMode();

                boolean selectAllGotFocus = mSelectAllOnFocus && mTouchFocusSelected;
                if (hasSelection() && !selectAllGotFocus) {
<<<<<<< HEAD
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
                }
            }
        }
Solution content
                boolean selectAllGotFocus = mSelectAllOnFocus && mTouchFocusSelected;
                if (hasSelection() && !selectAllGotFocus) {
                    startSelectionActionMode();
                }
            }
        }
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        final int maxOffset = extractRangeEndFromLong(lastTouchOffsets);

        int selectionStart, selectionEnd;
<<<<<<< HEAD
=======

        long wordLimits = getWordLimitsAt(minOffset);
        if (wordLimits >= 0) {
            selectionStart = extractRangeStartFromLong(wordLimits);
        } else {
            selectionStart = Math.max(minOffset - 5, 0);
        }
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc

        // If a URLSpan (web address, email, phone...) is found at that position, select it.
        URLSpan[] urlSpans = ((Spanned) mText).getSpans(minOffset, maxOffset, URLSpan.class);
Solution content
        final int maxOffset = extractRangeEndFromLong(lastTouchOffsets);

        int selectionStart, selectionEnd;

        // If a URLSpan (web address, email, phone...) is found at that position, select it.
        URLSpan[] urlSpans = ((Spanned) mText).getSpans(minOffset, maxOffset, URLSpan.class);
File
TextView.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
            return true;
        }

<<<<<<< HEAD
        // Start a new selection
        if (startSelectionActionMode()) {
            performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
            mDiscardNextActionUp = true;
            return true;
        }

        return false;
    }

    /**
     * When selection mode is already started, this method simply updates the selected part of text
     * to the text under the finger.
     */
    private void updateSelectedRegion() {
        // Start a new selection at current position, keep selectionAction mode on
        selectCurrentWord();
        // Updates handles' positions
        getSelectionController().show();
    }

    private boolean touchPositionIsInSelection() {
        int selectionStart = getSelectionStart();
        int selectionEnd = getSelectionEnd();
=======
            if (!canSelectText() || !requestFocus()) {
                return;
            }
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc

        if (selectionStart == selectionEnd) {
            return false;
Solution content
    /**
    }
            return true;
        }

        // Start a new selection
        if (startSelectionActionMode()) {
            performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
            mDiscardNextActionUp = true;
            return true;
        }

        return false;
     * When selection mode is already started, this method simply updates the selected part of text
     * to the text under the finger.
     */
    private void updateSelectedRegion() {
        // Start a new selection at current position, keep selectionAction mode on
        selectCurrentWord();
        // Updates handles' positions
        getSelectionController().show();
    }

    private boolean touchPositionIsInSelection() {
        int selectionStart = getSelectionStart();
        int selectionEnd = getSelectionEnd();

        if (selectionStart == selectionEnd) {
            return false;
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
        if (!hasSelection()) {
            // If selection mode is started after a device rotation, there is already a selection.
            selectCurrentWord();
<<<<<<< HEAD
=======
            getSelectionController().show();
            final InputMethodManager imm = (InputMethodManager)
                    getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(this, 0, null);
            mIsInTextSelectionMode = true;
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
        }

        ActionMode.Callback actionModeCallback = new SelectionActionModeCallback();
Solution content
        if (!hasSelection()) {
            // If selection mode is started after a device rotation, there is already a selection.
            selectCurrentWord();
        }

        ActionMode.Callback actionModeCallback = new SelectionActionModeCallback();
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Cast expression
Method invocation
Variable
Chunk
Conflicting content
    /**

        return selectionStarted;
    }
<<<<<<< HEAD

    /**
     * Same as {@link #stopSelectionActionMode()}, except that there is no cursor controller
     * fade out animation. Needed since the drawable and their alpha values are shared by all
     * TextViews. Switching from one TextView to another would fade the cursor controllers in the
     * new one otherwise.
     */
    private void terminateSelectionActionMode() {
        stopSelectionActionMode();

        // No need to create the controller, nothing to cancel in that case.
        if (mSelectionModifierCursorController != null) {
            mSelectionModifierCursorController.cancelFadeOutAnimation();
        }
    }

    private void stopSelectionActionMode() {
        if (mSelectionActionMode != null) {
            // This will hide the mSelectionModifierCursorController
            mSelectionActionMode.finish();
        }
    }
=======
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc

     * Paste clipboard content between min and max positions.
Solution content
        return selectionStarted;
    }

    /**
     * Same as {@link #stopSelectionActionMode()}, except that there is no cursor controller
     * fade out animation. Needed since the drawable and their alpha values are shared by all
     * TextViews. Switching from one TextView to another would fade the cursor controllers in the
     * new one otherwise.
     */
    private void terminateSelectionActionMode() {
        stopSelectionActionMode();

        // No need to create the controller, nothing to cancel in that case.
        if (mSelectionModifierCursorController != null) {
            mSelectionModifierCursorController.cancelFadeOutAnimation();
        }
    }

    private void stopSelectionActionMode() {
        if (mSelectionActionMode != null) {
            // This will hide the mSelectionModifierCursorController
            mSelectionActionMode.finish();
        }
    }

    /**
     * Paste clipboard content between min and max positions.
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
        // Whether selection anchors are active
        private boolean mIsShowing;

<<<<<<< HEAD
        // Double tap detection
        private long mPreviousTapUpTime = 0;
        private int mPreviousTapPositionX;
        private int mPreviousTapPositionY;

=======
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
        SelectionModifierCursorController() {
            resetTouchOffsets();
        }
Solution content
        // Whether selection anchors are active
        private boolean mIsShowing;

        // Double tap detection
        private long mPreviousTapUpTime = 0;
        private int mPreviousTapPositionX;
        private int mPreviousTapPositionY;

        SelectionModifierCursorController() {
            resetTouchOffsets();
        }
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
            // The handles have been created since the controller isShowing().
            mStartHandle.positionAtCursor(selectionStart, true);
            mEndHandle.positionAtCursor(selectionEnd, true);
<<<<<<< HEAD
        }

        public int getCurrentOffset(HandleView handle) {
            return mStartHandle == handle ? getSelectionStart() : getSelectionEnd();
=======
>>>>>>> 2f7e9d403a8ef6660d3acf8c41f57ce339c9f7cc
        }

        public boolean onTouchEvent(MotionEvent event) {
Solution content
            // The handles have been created since the controller isShowing().
            mStartHandle.positionAtCursor(selectionStart, true);
            mEndHandle.positionAtCursor(selectionEnd, true);
        }

        public int getCurrentOffset(HandleView handle) {
            return mStartHandle == handle ? getSelectionStart() : getSelectionEnd();
        }

        public boolean onTouchEvent(MotionEvent event) {
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Method signature
Return statement
Variable