Permalink
Browse files

Make ProgressBarDrawable implement CloneableDrawable

Reviewed By: massimocarli

Differential Revision: D4403804

fbshipit-source-id: e673b7c9ee502bae5e598293c3c2d11f8aa16e57
  • Loading branch information...
1 parent be87e89 commit 4c72c04b92c1915610f39f28473677004c9b9be3 @lambdapioneer lambdapioneer committed with facebook-github-bot Jan 11, 2017
Showing with 15 additions and 1 deletion.
  1. +15 −1 drawee/src/main/java/com/facebook/drawee/drawable/ProgressBarDrawable.java
@@ -20,7 +20,7 @@
/**
* Drawable that displays a progress bar based on the level.
*/
-public class ProgressBarDrawable extends Drawable {
+public class ProgressBarDrawable extends Drawable implements CloneableDrawable {
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Path mPath = new Path();
@@ -160,6 +160,20 @@ public void draw(Canvas canvas) {
}
}
+ @Override
+ public Drawable cloneDrawable() {
+ final ProgressBarDrawable copy = new ProgressBarDrawable();
+ copy.mBackgroundColor = mBackgroundColor;
+ copy.mColor = mColor;
+ copy.mPadding = mPadding;
+ copy.mBarWidth = mBarWidth;
+ copy.mLevel = mLevel;
+ copy.mRadius = mRadius;
+ copy.mHideWhenZero = mHideWhenZero;
+ copy.mIsVertical = mIsVertical;
+ return copy;
+ }
+
private void drawHorizontalBar(Canvas canvas, int level, int color) {
Rect bounds = getBounds();
int length = (bounds.width() - 2 * mPadding) * level / 10000;

0 comments on commit 4c72c04

Please sign in to comment.