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

Commit 7ca0bb5d authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Better handling of unresolved theme attributes" into lmp-dev

parents 6a2f703f 34a14f96
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -715,7 +715,13 @@ public class Resources {
     * @see #getDrawable(int, Theme)
     */
    public Drawable getDrawable(int id) throws NotFoundException {
        return getDrawable(id, null);
        final Drawable d = getDrawable(id, null);
        if (d.canApplyTheme()) {
            Log.w(TAG, "Drawable " + getResourceName(id) + " has unresolved theme "
                    + "attributes! Consider using Resources.getDrawable(int, Theme) or "
                    + "Context.getDrawable(int).", new RuntimeException());
        }
        return d;
    }

    /**
+7 −3
Original line number Diff line number Diff line
@@ -395,8 +395,12 @@ public class RippleDrawable extends LayerDrawable {
            mState.mColor = color;
        }

        // If we're not waiting on a theme, verify required attributes.
        if (state.mTouchThemeAttrs == null && mState.mColor == null) {
        verifyRequiredAttributes(a);
    }

    private void verifyRequiredAttributes(TypedArray a) throws XmlPullParserException {
        if (mState.mColor == null && (mState.mTouchThemeAttrs == null
                || mState.mTouchThemeAttrs[R.styleable.RippleDrawable_color] == 0)) {
            throw new XmlPullParserException(a.getPositionDescription() +
                    ": <ripple> requires a valid color attribute");
        }
@@ -891,7 +895,7 @@ public class RippleDrawable extends LayerDrawable {

    static class RippleState extends LayerState {
        int[] mTouchThemeAttrs;
        ColorStateList mColor = null;
        ColorStateList mColor = ColorStateList.valueOf(Color.MAGENTA);
        int mMaxRadius = RADIUS_AUTO;

        public RippleState(RippleState orig, RippleDrawable owner, Resources res) {