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

Commit 244f5125 authored by Raph Levien's avatar Raph Levien Committed by Android Git Automerger
Browse files

am b9e224cc: am 6f8c1bad: Merge "Fix for bug 7344916 text view flickers when...

am b9e224cc: am 6f8c1bad: Merge "Fix for bug 7344916 text view flickers when you hit enter" into jb-mr1-dev

* commit 'b9e224cc':
  Fix for bug 7344916 text view flickers when you hit enter
parents 006f6dfc b9e224cc
Loading
Loading
Loading
Loading
+13 −2
Original line number Original line Diff line number Diff line
@@ -367,6 +367,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    private boolean mSingleLine;
    private boolean mSingleLine;
    private int mDesiredHeightAtMeasure = -1;
    private int mDesiredHeightAtMeasure = -1;
    private boolean mIncludePad = true;
    private boolean mIncludePad = true;
    private int mDeferScroll = -1;


    // tmp primitives, so we don't alloc them on each draw
    // tmp primitives, so we don't alloc them on each draw
    private Rect mTempRect;
    private Rect mTempRect;
@@ -6317,6 +6318,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    @Override
    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);
        super.onLayout(changed, left, top, right, bottom);
        if (mDeferScroll >= 0) {
            int curs = mDeferScroll;
            mDeferScroll = -1;
            bringPointIntoView(curs);
        }
        if (changed && mEditor != null) mEditor.invalidateTextDisplayList();
        if (changed && mEditor != null) mEditor.invalidateTextDisplayList();
    }
    }


@@ -6399,6 +6405,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
     * This has to be called after layout. Returns true if anything changed.
     * This has to be called after layout. Returns true if anything changed.
     */
     */
    public boolean bringPointIntoView(int offset) {
    public boolean bringPointIntoView(int offset) {
        if (isLayoutRequested()) {
            mDeferScroll = offset;
            return false;
        }
        boolean changed = false;
        boolean changed = false;


        Layout layout = isShowingHint() ? mHintLayout: mLayout;
        Layout layout = isShowingHint() ? mHintLayout: mLayout;
@@ -7108,13 +7118,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            registerForPreDraw();
            registerForPreDraw();
        }
        }


        checkForResize();

        if (curs >= 0) {
        if (curs >= 0) {
            mHighlightPathBogus = true;
            mHighlightPathBogus = true;
            if (mEditor != null) mEditor.makeBlink();
            if (mEditor != null) mEditor.makeBlink();
            bringPointIntoView(curs);
            bringPointIntoView(curs);
        }
        }

        checkForResize();
    }
    }


    /**
    /**
@@ -7161,6 +7171,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener


            if (oldStart >= 0 || newStart >= 0) {
            if (oldStart >= 0 || newStart >= 0) {
                invalidateCursor(Selection.getSelectionStart(buf), oldStart, newStart);
                invalidateCursor(Selection.getSelectionStart(buf), oldStart, newStart);
                checkForResize();
                registerForPreDraw();
                registerForPreDraw();
                if (mEditor != null) mEditor.makeBlink();
                if (mEditor != null) mEditor.makeBlink();
            }
            }