Loading graphics/java/android/graphics/drawable/ShapeDrawable.java +2 −2 Original line number Diff line number Diff line Loading @@ -594,12 +594,12 @@ public class ShapeDrawable extends Drawable { @Override public Drawable newDrawable() { return new ShapeDrawable(this, null); return new ShapeDrawable(new ShapeState(this), null); } @Override public Drawable newDrawable(Resources res) { return new ShapeDrawable(this, res); return new ShapeDrawable(new ShapeState(this), res); } @Override Loading graphics/java/android/graphics/drawable/shapes/ArcShape.java +23 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Paint; import java.util.Objects; /** * Creates an arc shape. The arc shape starts at a specified angle and sweeps * clockwise, drawing slices of pie. Loading Loading @@ -74,5 +76,26 @@ public class ArcShape extends RectShape { public ArcShape clone() throws CloneNotSupportedException { return (ArcShape) super.clone(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ArcShape arcShape = (ArcShape) o; return Float.compare(arcShape.mStartAngle, mStartAngle) == 0 && Float.compare(arcShape.mSweepAngle, mSweepAngle) == 0; } @Override public int hashCode() { return Objects.hash(super.hashCode(), mStartAngle, mSweepAngle); } } graphics/java/android/graphics/drawable/shapes/PathShape.java +27 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import java.util.Objects; /** * Creates geometric paths, utilizing the {@link android.graphics.Path} class. * <p> Loading Loading @@ -74,5 +76,30 @@ public class PathShape extends Shape { shape.mPath = new Path(mPath); return shape; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } PathShape pathShape = (PathShape) o; return Float.compare(pathShape.mStdWidth, mStdWidth) == 0 && Float.compare(pathShape.mStdHeight, mStdHeight) == 0 && Float.compare(pathShape.mScaleX, mScaleX) == 0 && Float.compare(pathShape.mScaleY, mScaleY) == 0 // Path does not have equals implementation but incase it gains one, use it here && Objects.equals(mPath, pathShape.mPath); } @Override public int hashCode() { return Objects.hash(super.hashCode(), mStdWidth, mStdHeight, mPath, mScaleX, mScaleY); } } graphics/java/android/graphics/drawable/shapes/RectShape.java +22 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.graphics.Outline; import android.graphics.Paint; import android.graphics.RectF; import java.util.Objects; /** * Defines a rectangle shape. * <p> Loading Loading @@ -63,4 +65,24 @@ public class RectShape extends Shape { shape.mRect = new RectF(mRect); return shape; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } RectShape rectShape = (RectShape) o; return Objects.equals(mRect, rectShape.mRect); } @Override public int hashCode() { return Objects.hash(super.hashCode(), mRect); } } graphics/java/android/graphics/drawable/shapes/RoundRectShape.java +30 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; import java.util.Arrays; import java.util.Objects; /** * Creates a rounded-corner rectangle. Optionally, an inset (rounded) rectangle * can be included (to make a sort of "O" shape). Loading Loading @@ -137,4 +140,31 @@ public class RoundRectShape extends RectShape { shape.mPath = new Path(mPath); return shape; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } RoundRectShape that = (RoundRectShape) o; return Arrays.equals(mOuterRadii, that.mOuterRadii) && Objects.equals(mInset, that.mInset) && Arrays.equals(mInnerRadii, that.mInnerRadii) && Objects.equals(mInnerRect, that.mInnerRect) && Objects.equals(mPath, that.mPath); } @Override public int hashCode() { int result = Objects.hash(super.hashCode(), mInset, mInnerRect, mPath); result = 31 * result + Arrays.hashCode(mOuterRadii); result = 31 * result + Arrays.hashCode(mInnerRadii); return result; } } Loading
graphics/java/android/graphics/drawable/ShapeDrawable.java +2 −2 Original line number Diff line number Diff line Loading @@ -594,12 +594,12 @@ public class ShapeDrawable extends Drawable { @Override public Drawable newDrawable() { return new ShapeDrawable(this, null); return new ShapeDrawable(new ShapeState(this), null); } @Override public Drawable newDrawable(Resources res) { return new ShapeDrawable(this, res); return new ShapeDrawable(new ShapeState(this), res); } @Override Loading
graphics/java/android/graphics/drawable/shapes/ArcShape.java +23 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Paint; import java.util.Objects; /** * Creates an arc shape. The arc shape starts at a specified angle and sweeps * clockwise, drawing slices of pie. Loading Loading @@ -74,5 +76,26 @@ public class ArcShape extends RectShape { public ArcShape clone() throws CloneNotSupportedException { return (ArcShape) super.clone(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ArcShape arcShape = (ArcShape) o; return Float.compare(arcShape.mStartAngle, mStartAngle) == 0 && Float.compare(arcShape.mSweepAngle, mSweepAngle) == 0; } @Override public int hashCode() { return Objects.hash(super.hashCode(), mStartAngle, mSweepAngle); } }
graphics/java/android/graphics/drawable/shapes/PathShape.java +27 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import java.util.Objects; /** * Creates geometric paths, utilizing the {@link android.graphics.Path} class. * <p> Loading Loading @@ -74,5 +76,30 @@ public class PathShape extends Shape { shape.mPath = new Path(mPath); return shape; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } PathShape pathShape = (PathShape) o; return Float.compare(pathShape.mStdWidth, mStdWidth) == 0 && Float.compare(pathShape.mStdHeight, mStdHeight) == 0 && Float.compare(pathShape.mScaleX, mScaleX) == 0 && Float.compare(pathShape.mScaleY, mScaleY) == 0 // Path does not have equals implementation but incase it gains one, use it here && Objects.equals(mPath, pathShape.mPath); } @Override public int hashCode() { return Objects.hash(super.hashCode(), mStdWidth, mStdHeight, mPath, mScaleX, mScaleY); } }
graphics/java/android/graphics/drawable/shapes/RectShape.java +22 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.graphics.Outline; import android.graphics.Paint; import android.graphics.RectF; import java.util.Objects; /** * Defines a rectangle shape. * <p> Loading Loading @@ -63,4 +65,24 @@ public class RectShape extends Shape { shape.mRect = new RectF(mRect); return shape; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } RectShape rectShape = (RectShape) o; return Objects.equals(mRect, rectShape.mRect); } @Override public int hashCode() { return Objects.hash(super.hashCode(), mRect); } }
graphics/java/android/graphics/drawable/shapes/RoundRectShape.java +30 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,9 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; import java.util.Arrays; import java.util.Objects; /** * Creates a rounded-corner rectangle. Optionally, an inset (rounded) rectangle * can be included (to make a sort of "O" shape). Loading Loading @@ -137,4 +140,31 @@ public class RoundRectShape extends RectShape { shape.mPath = new Path(mPath); return shape; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } RoundRectShape that = (RoundRectShape) o; return Arrays.equals(mOuterRadii, that.mOuterRadii) && Objects.equals(mInset, that.mInset) && Arrays.equals(mInnerRadii, that.mInnerRadii) && Objects.equals(mInnerRect, that.mInnerRect) && Objects.equals(mPath, that.mPath); } @Override public int hashCode() { int result = Objects.hash(super.hashCode(), mInset, mInnerRect, mPath); result = 31 * result + Arrays.hashCode(mOuterRadii); result = 31 * result + Arrays.hashCode(mInnerRadii); return result; } }