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

Commit fa1babd2 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug #7023040 android.widget.cts.TextViewTest#testResetTextAlignment failures

- cache the text aligment as we cannot resolve the text alignment during reset of the text direction

Change-Id: I79de625e517bf8bad6313fd5e349f1181b1eaa30
parent d2a8df95
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    // The alignment to pass to Layout, or null if not resolved.
    private Layout.Alignment mLayoutAlignment;
    private int mResolvedTextAlignment;

    private boolean mResolvedDrawables;

@@ -5639,9 +5640,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
    @Override
    public void onResolvedLayoutDirectionReset() {
        if (mLayoutAlignment != null) {
            int resolvedTextAlignment = getResolvedTextAlignment();
            if (resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START ||
                 resolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) {
            if (mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_START ||
                    mResolvedTextAlignment == TEXT_ALIGNMENT_VIEW_END) {
                mLayoutAlignment = null;
            }
        }
@@ -5649,8 +5649,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    private Layout.Alignment getLayoutAlignment() {
        if (mLayoutAlignment == null) {
            int textAlign = getResolvedTextAlignment();
            switch (textAlign) {
            mResolvedTextAlignment = getResolvedTextAlignment();
            switch (mResolvedTextAlignment) {
                case TEXT_ALIGNMENT_GRAVITY:
                    switch (mGravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
                        case Gravity.START: