@Test public void oval() { region.set(16, 24, 48, 40); BadgeShape.oval(0.5f, 2, Gravity.CENTER).onDraw(canvas, region, paint); canvas.assertDrawn(TestCanvas.Shape.OVAL, region); }
public static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity) { return new BadgeShape(scale, aspectRatio, gravity) { private final RectF region = new RectF(); @Override protected void onDraw(@NonNull Canvas canvas, @NonNull Rect region, @NonNull Paint paint) { this.region.set(region); canvas.drawOval(this.region, paint); } }; }
BadgeShape { public static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity) { return new BadgeShape(scale, aspectRatio, gravity) { private final RectF region = new RectF(); @Override protected void onDraw(@NonNull Canvas canvas, @NonNull Rect region, @NonNull Paint paint) { this.region.set(region); canvas.drawOval(this.region, paint); } }; } }
BadgeShape { public static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity) { return new BadgeShape(scale, aspectRatio, gravity) { private final RectF region = new RectF(); @Override protected void onDraw(@NonNull Canvas canvas, @NonNull Rect region, @NonNull Paint paint) { this.region.set(region); canvas.drawOval(this.region, paint); } }; } protected  BadgeShape(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); }
BadgeShape { public static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity) { return new BadgeShape(scale, aspectRatio, gravity) { private final RectF region = new RectF(); @Override protected void onDraw(@NonNull Canvas canvas, @NonNull Rect region, @NonNull Paint paint) { this.region.set(region); canvas.drawOval(this.region, paint); } }; } protected  BadgeShape(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); Rect draw(@NonNull Canvas canvas, @NonNull Rect bounds, @NonNull Paint paint, int layoutDirection); static BadgeShape circle(@FloatRange(from = 0, to = 1) float scale, int gravity); static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); static BadgeShape rect(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); static BadgeShape rect(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity,
                                  @FloatRange(from = 0, to = 1) final float radiusFactor); static BadgeShape square(@FloatRange(from = 0, to = 1) float scale, int gravity); static BadgeShape square(@FloatRange(from = 0, to = 1) float scale, int gravity,
                                    @FloatRange(from = 0, to = 1) float radiusFactor); }
BadgeShape { public static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity) { return new BadgeShape(scale, aspectRatio, gravity) { private final RectF region = new RectF(); @Override protected void onDraw(@NonNull Canvas canvas, @NonNull Rect region, @NonNull Paint paint) { this.region.set(region); canvas.drawOval(this.region, paint); } }; } protected  BadgeShape(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); Rect draw(@NonNull Canvas canvas, @NonNull Rect bounds, @NonNull Paint paint, int layoutDirection); static BadgeShape circle(@FloatRange(from = 0, to = 1) float scale, int gravity); static BadgeShape oval(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); static BadgeShape rect(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity); static BadgeShape rect(@FloatRange(from = 0, to = 1) float scale, float aspectRatio, int gravity,
                                  @FloatRange(from = 0, to = 1) final float radiusFactor); static BadgeShape square(@FloatRange(from = 0, to = 1) float scale, int gravity); static BadgeShape square(@FloatRange(from = 0, to = 1) float scale, int gravity,
                                    @FloatRange(from = 0, to = 1) float radiusFactor);  }