@Test @SmallTest public void sizeIsSquareBasedOnSmallerEdgeWithNoCenterRadius() { int width = 100; int height = 50; mDrawableUnderTest.setBounds(new Rect(0, 0, width, height)); mDrawableUnderTest.draw(mMockCanvas); ArgumentCaptor<RectF> captor = ArgumentCaptor.forClass(RectF.class); verify(mMockCanvas).drawArc(captor.capture(), anyFloat(), anyFloat(), anyBoolean(), any(Paint.class)); assertTrue(captor.getValue().width() == captor.getValue().height()); assertTrue(captor.getValue().width() <= width); assertTrue(captor.getValue().width() <= height); }
@Override public void draw(Canvas canvas) { final Rect bounds = getBounds(); canvas.save(); canvas.rotate(mRotation, bounds.exactCenterX(), bounds.exactCenterY()); mRing.draw(canvas, bounds); canvas.restore(); }
CircularProgressDrawable extends Drawable implements Animatable { @Override public void draw(Canvas canvas) { final Rect bounds = getBounds(); canvas.save(); canvas.rotate(mRotation, bounds.exactCenterX(), bounds.exactCenterY()); mRing.draw(canvas, bounds); canvas.restore(); } }
CircularProgressDrawable extends Drawable implements Animatable { @Override public void draw(Canvas canvas) { final Rect bounds = getBounds(); canvas.save(); canvas.rotate(mRotation, bounds.exactCenterX(), bounds.exactCenterY()); mRing.draw(canvas, bounds); canvas.restore(); } CircularProgressDrawable(@NonNull Context context); }
CircularProgressDrawable extends Drawable implements Animatable { @Override public void draw(Canvas canvas) { final Rect bounds = getBounds(); canvas.save(); canvas.rotate(mRotation, bounds.exactCenterX(), bounds.exactCenterY()); mRing.draw(canvas, bounds); canvas.restore(); } CircularProgressDrawable(@NonNull Context context); void setStyle(@ProgressDrawableSize int size); float getStrokeWidth(); void setStrokeWidth(float strokeWidth); float getCenterRadius(); void setCenterRadius(float centerRadius); void setStrokeCap(@NonNull Paint.Cap strokeCap); @NonNull Paint.Cap getStrokeCap(); float getArrowWidth(); float getArrowHeight(); void setArrowDimensions(float width, float height); boolean getArrowEnabled(); void setArrowEnabled(boolean show); float getArrowScale(); void setArrowScale(float scale); float getStartTrim(); float getEndTrim(); void setStartEndTrim(float start, float end); float getProgressRotation(); void setProgressRotation(float rotation); int getBackgroundColor(); void setBackgroundColor(int color); @NonNull int[] getColorSchemeColors(); void setColorSchemeColors(@NonNull int... colors); @Override void draw(Canvas canvas); @Override void setAlpha(int alpha); @Override int getAlpha(); @Override void setColorFilter(ColorFilter colorFilter); @Override int getOpacity(); @Override boolean isRunning(); @Override void start(); @Override void stop(); }
CircularProgressDrawable extends Drawable implements Animatable { @Override public void draw(Canvas canvas) { final Rect bounds = getBounds(); canvas.save(); canvas.rotate(mRotation, bounds.exactCenterX(), bounds.exactCenterY()); mRing.draw(canvas, bounds); canvas.restore(); } CircularProgressDrawable(@NonNull Context context); void setStyle(@ProgressDrawableSize int size); float getStrokeWidth(); void setStrokeWidth(float strokeWidth); float getCenterRadius(); void setCenterRadius(float centerRadius); void setStrokeCap(@NonNull Paint.Cap strokeCap); @NonNull Paint.Cap getStrokeCap(); float getArrowWidth(); float getArrowHeight(); void setArrowDimensions(float width, float height); boolean getArrowEnabled(); void setArrowEnabled(boolean show); float getArrowScale(); void setArrowScale(float scale); float getStartTrim(); float getEndTrim(); void setStartEndTrim(float start, float end); float getProgressRotation(); void setProgressRotation(float rotation); int getBackgroundColor(); void setBackgroundColor(int color); @NonNull int[] getColorSchemeColors(); void setColorSchemeColors(@NonNull int... colors); @Override void draw(Canvas canvas); @Override void setAlpha(int alpha); @Override int getAlpha(); @Override void setColorFilter(ColorFilter colorFilter); @Override int getOpacity(); @Override boolean isRunning(); @Override void start(); @Override void stop(); static final int LARGE; static final int DEFAULT; }