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

Commit 59075643 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "Handle non DynamicLayout in Editable draw method."

parents ee9da04e 0711047a
Loading
Loading
Loading
Loading
+55 −54
Original line number Diff line number Diff line
@@ -11707,13 +11707,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            layout.drawBackground(canvas, highlight, mHighlightPaint, cursorOffsetVertical,
                    firstLine, lastLine);

            if (layout instanceof DynamicLayout) {
                if (mTextDisplayLists == null) {
                    mTextDisplayLists = new DisplayList[ArrayUtils.idealObjectArraySize(0)];
                }
            if (! (layout instanceof DynamicLayout)) {
                Log.e(LOG_TAG, "Editable TextView is not using a DynamicLayout");
                return;
            }

                DynamicLayout dynamicLayout = (DynamicLayout) layout;
                int[] blockEnds = dynamicLayout.getBlockEnds();
@@ -11767,6 +11764,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    endOfPreviousBlock = blockEnd;
                }
                canvas.translate(-mScrollX, -mScrollY);
            } else {
                // Fallback on the layout method (a BoringLayout is used when the text is empty)
                layout.drawText(canvas, firstLine, lastLine);
            }
        }

        private int getAvailableDisplayListIndex(int[] blockIndices, int numberOfBlocks,