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

Commit 4f77f313 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed issue where XmlPullParserExceptions are thrown with Theme defined...

Merge "Fixed issue where XmlPullParserExceptions are thrown with Theme defined GradientDrawable attributes"
parents 937bd611 129f414e
Loading
Loading
Loading
Loading
+61 −64
Original line number Original line Diff line number Diff line
@@ -1312,6 +1312,10 @@ public class GradientDrawable extends Drawable {
                    y0 = r.top + (r.bottom - r.top) * st.mCenterY;
                    y0 = r.top + (r.bottom - r.top) * st.mCenterY;


                    float radius = st.mGradientRadius;
                    float radius = st.mGradientRadius;
                    if (Float.compare(radius, 0.0f) == -1 || Float.isNaN(radius)) {
                        throw new IllegalArgumentException("Gradient radius must be a valid "
                                + "number greater than or equal to 0");
                    }
                    if (st.mGradientRadiusType == RADIUS_TYPE_FRACTION) {
                    if (st.mGradientRadiusType == RADIUS_TYPE_FRACTION) {
                        // Fall back to parent width or height if intrinsic
                        // Fall back to parent width or height if intrinsic
                        // size is not specified.
                        // size is not specified.
@@ -1759,7 +1763,6 @@ public class GradientDrawable extends Drawable {
            st.mGradientColors[1] = endColor;
            st.mGradientColors[1] = endColor;
        }
        }


        if (st.mGradient == LINEAR_GRADIENT) {
        int angle = (int) a.getFloat(R.styleable.GradientDrawableGradient_angle, st.mAngle);
        int angle = (int) a.getFloat(R.styleable.GradientDrawableGradient_angle, st.mAngle);
        angle %= 360;
        angle %= 360;


@@ -1797,7 +1800,7 @@ public class GradientDrawable extends Drawable {
                st.mOrientation = Orientation.TL_BR;
                st.mOrientation = Orientation.TL_BR;
                break;
                break;
        }
        }
        } else {

        final TypedValue tv = a.peekValue(R.styleable.GradientDrawableGradient_gradientRadius);
        final TypedValue tv = a.peekValue(R.styleable.GradientDrawableGradient_gradientRadius);
        if (tv != null) {
        if (tv != null) {
            final float radius;
            final float radius;
@@ -1822,12 +1825,6 @@ public class GradientDrawable extends Drawable {


            st.mGradientRadius = radius;
            st.mGradientRadius = radius;
            st.mGradientRadiusType = radiusType;
            st.mGradientRadiusType = radiusType;
            } else if (st.mGradient == RADIAL_GRADIENT) {
                throw new XmlPullParserException(
                        a.getPositionDescription()
                        + "<gradient> tag requires 'gradientRadius' "
                        + "attribute with radial type");
            }
        }
        }
    }
    }