Skip to content

Commit

Permalink
exceeding max progress fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacek Kwiecień committed Oct 14, 2015
1 parent c329adb commit 6c44f04
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
24 changes: 24 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 7
versionName "1.0.6"
versionCode 8
versionName "1.0.7"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void init(AttributeSet attrs) {
int src = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "src", 0);
BitmapDrawable bitmapDrawable = (BitmapDrawable) getResources().getDrawable(src);

progressColor = a.getColor(R.styleable.RoundOverlayProgressView_progressColor, R.color.default_progress);
progressColor = a.getColor(R.styleable.RoundOverlayProgressView_progressColor, getResources().getColor(R.color.default_progress));
maxProgress = a.getInteger(R.styleable.RoundOverlayProgressView_maxProgress, 100);
animationDuration = a.getInteger(R.styleable.RoundOverlayProgressView_animationDuration, 300);
animate = a.getBoolean(R.styleable.RoundOverlayProgressView_animate, true);
Expand Down Expand Up @@ -127,6 +127,8 @@ private float calculateStartAngle(int progress) {
}

public void setProgress(int newProgress) {
if (newProgress > maxProgress) newProgress = maxProgress;

if (animate) {
ObjectAnimator anim = ObjectAnimator.ofInt(this, "currentProgress", currentProgress, newProgress);
anim.setDuration(animationDuration);
Expand Down

0 comments on commit 6c44f04

Please sign in to comment.