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

Commit 17b0bda4 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi
Browse files

Fix: TextView makes new layouts too frequently.

TextView#checkForRelayout was almost always called in
TextView#onRtlPropertiesChanged.
However, #onRtlPropertiesChanged just checks if re-layout
can be skipped for when the text has changed. As a result,
TextView makes new layouts too frequently in that method.

With this patch, TextView#checkForRelayout is called only
when mTextDir has actually changed.

Bug: 17971103
Change-Id: I449d8c8fd7370495cd5af9e38cada942744ca801
parent 0463cad7
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -9499,12 +9499,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    public void onRtlPropertiesChanged(int layoutDirection) {
        super.onRtlPropertiesChanged(layoutDirection);

        mTextDir = getTextDirectionHeuristic();

        final TextDirectionHeuristic newTextDir = getTextDirectionHeuristic();
        if (mTextDir != newTextDir) {
            mTextDir = newTextDir;
            if (mLayout != null) {
                checkForRelayout();
            }
        }
    }

    TextDirectionHeuristic getTextDirectionHeuristic() {
        if (hasPasswordTransformationMethod()) {