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

Commit 1f4ec625 authored by Menghan Li's avatar Menghan Li Committed by Android (Google) Code Review
Browse files

Merge "Fix the gradient drawable orientation is not mirrored for RTL alignment" into udc-dev

parents 39b73e1f 87bc65c9
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.widget.TextView;

import androidx.annotation.ColorInt;
import androidx.annotation.IntDef;
import androidx.core.text.TextUtilsCompat;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;

@@ -49,6 +50,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

/** Preference that easier preview by matching name to color. */
@@ -156,8 +158,9 @@ public final class PaletteListPreference extends Preference {
        mGradientColors.set(Position.END, color);

        final GradientDrawable gradientDrawable = new GradientDrawable();
        final Locale locale = Locale.getDefault();
        final Orientation orientation =
                rootView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL
                TextUtilsCompat.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL
                    ? Orientation.RIGHT_LEFT
                    : Orientation.LEFT_RIGHT;
        gradientDrawable.setOrientation(orientation);