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

Commit 53b63f8b authored by Zhibin Liu's avatar Zhibin Liu Committed by Android (Google) Code Review
Browse files

Merge "Replace @hide API obtainAttributes with public API" into main

parents 79d07018 30c7e77f
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class TintDrawable extends DrawableWrapper {
    public void inflate(@NonNull Resources r, @NonNull XmlPullParser parser,
            @NonNull AttributeSet attrs, @Nullable Theme theme)
            throws XmlPullParserException, IOException {
        final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.TintDrawable);
        final TypedArray a = obtainAttributes(r, theme, attrs);

        super.inflate(r, parser, attrs, theme);

@@ -99,4 +99,14 @@ public class TintDrawable extends DrawableWrapper {
            getDrawable().mutate().setTintList(mTint);
        }
    }

    private static @NonNull TypedArray obtainAttributes(@NonNull Resources res,
            @Nullable Theme theme, @NonNull AttributeSet set) {
        // Don't depend on Drawable.obtainAttributes, which is @hide, thus cannot be accessed by
        // Settings search
        if (theme == null) {
            return res.obtainAttributes(set, R.styleable.TintDrawable);
        }
        return theme.obtainStyledAttributes(set, R.styleable.TintDrawable, 0, 0);
    }
}