From 6c44f04752483f152b14dd60039f78ad10a61b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20Kwiecie=C5=84?= Date: Wed, 14 Oct 2015 14:52:43 +0200 Subject: [PATCH] exceeding max progress fix --- .idea/misc.xml | 24 +++++++++++++++++++ .idea/vcs.xml | 2 +- library/build.gradle | 4 ++-- .../RoundOverlayProgressView.java | 4 +++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 01d38cd..6a1e020 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,6 +3,30 @@ + + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..6564d52 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index 4bf56fb..d8c6b80 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 22 - versionCode 7 - versionName "1.0.6" + versionCode 8 + versionName "1.0.7" } buildTypes { release { diff --git a/library/src/main/java/pl/schibsted/roundoverlayprogress/RoundOverlayProgressView.java b/library/src/main/java/pl/schibsted/roundoverlayprogress/RoundOverlayProgressView.java index 1f52174..6260cfc 100644 --- a/library/src/main/java/pl/schibsted/roundoverlayprogress/RoundOverlayProgressView.java +++ b/library/src/main/java/pl/schibsted/roundoverlayprogress/RoundOverlayProgressView.java @@ -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); @@ -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);