Projects >> platform_frameworks_base >>9b346d5e74d05d9ab44aeb6ec40e8da64eb21bd0

Chunk
Conflicting content
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
<<<<<<< HEAD
import android.net.Uri;
=======
import android.inputmethodservice.ExtractEditText;
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
Solution content
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
            changed = bringTextIntoView();
        }

<<<<<<< HEAD
        if (mShouldStartSelectionActionMode) {
            startSelectionActionMode();
            mShouldStartSelectionActionMode = false;
=======
        // 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.
        // - 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 (selectionController != null && hasSelection()) {
            startTextSelectionMode();
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
        }

        mPreDrawState = PREDRAW_DONE;
Solution content
            changed = bringTextIntoView();
        }

        if (mShouldStartSelectionActionMode) {
            startSelectionActionMode();
            mShouldStartSelectionActionMode = false;
        }
        mPreDrawState = PREDRAW_DONE;
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Chunk
Conflicting content
            if (mError != null) {
                showError();
            }
<<<<<<< HEAD

            // We cannot start the selection mode immediately. The layout may be null here and is
            // needed by the cursor controller. Layout creation is deferred up to drawing. The
            // selection action mode will be started in onPreDraw().
            if (selStart != selEnd) {
                mShouldStartSelectionActionMode = true;
            }
=======
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
        } else {
            if (mError != null) {
                hideError();
Solution content
            if (mError != null) {
                showError();
            }

            // We cannot start the selection mode immediately. The layout may be null here and is
            // needed by the cursor controller. Layout creation is deferred up to drawing. The
            // selection action mode will be started in onPreDraw().
            if (selStart != selEnd) {
                mShouldStartSelectionActionMode = true;
            }
        } else {
            if (mError != null) {
                hideError();
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Chunk
Conflicting content
            onEndBatchEdit();
            hideInsertionPointCursorController();
<<<<<<< HEAD
            terminateSelectionActionMode();
=======
            if (this instanceof ExtractEditText) {
                // terminateTextSelectionMode would remove selection, which we want to keep when
                // ExtractEditText goes out of focus.
                mIsInTextSelectionMode = false;
            } else {
                terminateTextSelectionMode();
            }
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
        }

        startStopMarquee(focused);
Solution content
            onEndBatchEdit();

            hideInsertionPointCursorController();
            terminateSelectionActionMode();
        }

        startStopMarquee(focused);
File
TextView.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
    class CommitSelectionReceiver extends ResultReceiver {
        private final int mPrevStart, mPrevEnd;
<<<<<<< HEAD
        private final int mNewStart, mNewEnd;

        public CommitSelectionReceiver(int mPrevStart, int mPrevEnd, int mNewStart, int mNewEnd) {
=======
        
        public CommitSelectionReceiver(int prevStart, int prevEnd) {
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
            super(getHandler());
            mPrevStart = prevStart;
            mPrevEnd = prevEnd;
Solution content
    class CommitSelectionReceiver extends ResultReceiver {
        private final int mPrevStart, mPrevEnd;
        private final int mNewStart, mNewEnd;

        public CommitSelectionReceiver(int mPrevStart, int mPrevEnd, int mNewStart, int mNewEnd) {
            super(getHandler());
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method signature
Chunk
Conflicting content
            // If this tap was actually used to show the IMM, leave cursor or selection unchanged
            // by restoring its previous position.
            if (resultCode == InputMethodManager.RESULT_SHOWN) {
<<<<<<< HEAD
                start = mPrevStart;
                end = mPrevEnd;
            } else {
                if ((mPrevStart != mPrevEnd) && (start == end)) {
                    if ((start >= mPrevStart) && (start <= mPrevEnd)) {
                        // Tapping inside the selection does nothing
                        Selection.setSelection((Spannable) mText, mPrevStart, mPrevEnd);
                        return;
                    } else {
                        // Tapping outside stops selection mode, if any
                        stopSelectionActionMode();
                    }
                }

                if (mInsertionPointCursorController != null) {
=======
                final int len = mText.length();
                int start = Math.min(len, mPrevStart);
                int end = Math.min(len, mPrevEnd);
                Selection.setSelection((Spannable)mText, start, end);

                if (hasSelection()) {
                    startTextSelectionMode();
                } else if (mInsertionPointCursorController != null) {
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
                    mInsertionPointCursorController.show();
                }
            }
Solution content
            if (resultCode == InputMethodManager.RESULT_SHOWN) {
                start = mPrevStart;
                end = mPrevEnd;
            } else {
                if ((mPrevStart != mPrevEnd) && (start == end)) {
                    if ((start >= mPrevStart) && (start <= mPrevEnd)) {
                        // Tapping inside the selection does nothing
                        Selection.setSelection((Spannable) mText, mPrevStart, mPrevEnd);
                        return;
                    } else {
                        // Tapping outside stops selection mode, if any
                        stopSelectionActionMode();
                    }
                }

                if (mInsertionPointCursorController != null) {
                    mInsertionPointCursorController.show();
                }
            }
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute
If statement
Method invocation
Variable
Chunk
Conflicting content
            return superResult;
        }

<<<<<<< HEAD
        if ((mMovement != null || onCheckIsTextEditor()) &&
                mText instanceof Spannable && mLayout != null) {
            
            int oldSelStart = getSelectionStart();
            int oldSelEnd = getSelectionEnd();
=======
        if ((mMovement != null || onCheckIsTextEditor()) && mText instanceof Spannable && mLayout != null) {
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4

            if (mInsertionPointCursorController != null) {
                mInsertionPointCursorController.onTouchEvent(event);
Solution content
            return superResult;
        }

        if ((mMovement != null || onCheckIsTextEditor()) &&
                mText instanceof Spannable && mLayout != null) {
            
            int oldSelStart = getSelectionStart();
            int oldSelEnd = getSelectionEnd();

            if (mInsertionPointCursorController != null) {
                mInsertionPointCursorController.onTouchEvent(event);
File
TextView.java
Developer's decision
Version 1
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
            boolean handled = false;

<<<<<<< HEAD
=======
            // Save previous selection, in case this event is used to show the IME.
            int oldSelStart = getSelectionStart();
            int oldSelEnd = getSelectionEnd();
            
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
            if (mMovement != null) {
                handled |= mMovement.onTouchEvent(this, (Spannable) mText, event);
            }
Solution content
            boolean handled = false;

            if (mMovement != null) {
                handled |= mMovement.onTouchEvent(this, (Spannable) mText, event);
            }
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
                    InputMethodManager imm = (InputMethodManager)
                          getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

<<<<<<< HEAD
                    final int newSelStart = getSelectionStart();
                    final int newSelEnd = getSelectionEnd();

=======
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
                    CommitSelectionReceiver csr = null;
                    if (getSelectionStart() != oldSelStart || getSelectionEnd() != oldSelEnd ||
                            didTouchFocusSelect()) {
Solution content
                    InputMethodManager imm = (InputMethodManager)
                          getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

                    final int newSelStart = getSelectionStart();
                    final int newSelEnd = getSelectionEnd();

                    CommitSelectionReceiver csr = null;
                    if (newSelStart != oldSelStart || newSelEnd != oldSelEnd ||
                            didTouchFocusSelect()) {
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
    }
<<<<<<< HEAD

=======
    
    private String getWordForDictionary() {
        if (mLastTouchOffset < 0) {
            return null;
        }

        long wordLimits = getWordLimitsAt(mLastTouchOffset);
        if (wordLimits >= 0) {
            int start = (int) (wordLimits >>> 32);
            int end = (int) (wordLimits & 0x00000000FFFFFFFFL);
            return mTransformed.subSequence(start, end).toString();
        } else {
            return null;
        }
    }
    
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
    @Override
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        if (!isShown()) {
Solution content
        Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
    }

    @Override
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        if (!isShown()) {
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Chunk
Conflicting content
        return false;
    }

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

        if (selectionStart == selectionEnd) {
            return false;
        }

        if (selectionStart > selectionEnd) {
            int tmp = selectionStart;
            selectionStart = selectionEnd;
            selectionEnd = tmp;
            Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
        }

        SelectionModifierCursorController selectionModifierCursorController =
            ((SelectionModifierCursorController) mSelectionModifierCursorController);
        int minOffset = selectionModifierCursorController.getMinTouchOffset();
        int maxOffset = selectionModifierCursorController.getMaxTouchOffset();

        return ((minOffset >= selectionStart) && (maxOffset < selectionEnd));
=======
    private void startTextSelectionMode() {
        if (!mIsInTextSelectionMode) {
            if (mSelectionModifierCursorController == null) {
                Log.w(LOG_TAG, "TextView has no selection controller. Action mode cancelled.");
                return;
            }

            if (!requestFocus()) {
                return;
            }

            selectCurrentWord();
            mSelectionModifierCursorController.show();
            mIsInTextSelectionMode = true;
        }
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
    }

    /**
Solution content
        return false;
    }

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

        if (selectionStart == selectionEnd) {
            return false;
        }

        if (selectionStart > selectionEnd) {
            int tmp = selectionStart;
            selectionStart = selectionEnd;
            selectionEnd = tmp;
            Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
        }

        SelectionModifierCursorController selectionModifierCursorController =
            ((SelectionModifierCursorController) mSelectionModifierCursorController);
        int minOffset = selectionModifierCursorController.getMinTouchOffset();
        int maxOffset = selectionModifierCursorController.getMaxTouchOffset();

        return ((minOffset >= selectionStart) && (maxOffset < selectionEnd));
    }

    /**
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Cast expression
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
                return;
            }

<<<<<<< HEAD
            boolean oneLineSelection =
                mLayout.getLineForOffset(selectionStart) == mLayout.getLineForOffset(selectionEnd);
=======
            boolean oneLineSelection = mLayout.getLineForOffset(selectionStart) ==
                mLayout.getLineForOffset(selectionEnd);
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
            mStartHandle.positionAtCursor(selectionStart, oneLineSelection);
            mEndHandle.positionAtCursor(selectionEnd, true);
Solution content
                return;
            }

            boolean oneLineSelection =
                mLayout.getLineForOffset(selectionStart) == mLayout.getLineForOffset(selectionEnd);
            mStartHandle.positionAtCursor(selectionStart, oneLineSelection);
            mEndHandle.positionAtCursor(selectionEnd, true);
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    // Cursor Controllers. Null when disabled.
    private CursorController        mInsertionPointCursorController;
    private CursorController        mSelectionModifierCursorController;
<<<<<<< HEAD
    private boolean                 mShouldStartSelectionActionMode = false;
    private ActionMode              mSelectionActionMode;
=======
    private boolean                 mIsInTextSelectionMode = false;
    private int                     mLastTouchOffset = -1;
>>>>>>> 2ae3718b448cdc5e94b4686795301a01f54640e4
    // Created once and shared by different CursorController helper methods.
    // Only one cursor controller is active at any time which prevent race conditions.
    private static Rect             sCursorControllerTempRect = new Rect();
Solution content
    // Cursor Controllers. Null when disabled.
    private CursorController        mInsertionPointCursorController;
    private CursorController        mSelectionModifierCursorController;
    private boolean                 mShouldStartSelectionActionMode = false;
    private ActionMode              mSelectionActionMode;
    // Created once and shared by different CursorController helper methods.
    // Only one cursor controller is active at any time which prevent race conditions.
    private static Rect             sCursorControllerTempRect = new Rect();
File
TextView.java
Developer's decision
Version 1
Kind of conflict
Attribute