From 284ffedf907fb638cf22adc6d173c9a7cd1e4c0a Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Tue, 3 Feb 2015 20:55:56 +0100 Subject: [PATCH 01/10] Updated grade plugin / grade version --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 7ef72b4..1e36ccb 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:0.13.3' + classpath 'com.android.tools.build:gradle:1.0.0' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a79d8b1..3053e04 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Oct 08 23:53:45 PDT 2014 +#Sun Feb 01 23:44:10 CET 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip From 185e9beec9bd83f8214ff479c1189708c6e2b6ca Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Tue, 3 Feb 2015 20:56:52 +0100 Subject: [PATCH 02/10] Fixes #67 --- .../CircularProgressBarUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBarUtils.java b/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBarUtils.java index e6be1a7..bfb3d64 100644 --- a/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBarUtils.java +++ b/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBarUtils.java @@ -8,6 +8,7 @@ * Created by castorflex on 8/14/14. */ class CircularProgressBarUtils { + private CircularProgressBarUtils() { } @@ -31,8 +32,8 @@ static void checkPositiveOrZero(float number, String name) { throw new IllegalArgumentException(String.format("%s %d must be positive", name, number)); } - static void checkPositive(int number, String name){ - if(number <= 0) + static void checkPositive(int number, String name) { + if (number <= 0) throw new IllegalArgumentException(String.format("%s must not be null", name)); } @@ -42,9 +43,8 @@ static void checkNotNull(Object o, String name) { } static float getAnimatedFraction(ValueAnimator animator) { - float fraction = animator.getDuration() > 0 ? ((float) animator.getCurrentPlayTime()) / animator.getDuration() : 1f; + float fraction = animator.getDuration() > 0 ? ((float) animator.getCurrentPlayTime()) / animator.getDuration() : 0f; - fraction %= 1f; fraction = min(fraction, 1f); fraction = animator.getInterpolator().getInterpolation(fraction); return fraction; From 0bb155d2df3f55c4c3d1cdb8b1a17bc9d58ccc18 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Sat, 21 Feb 2015 15:23:02 +0100 Subject: [PATCH 03/10] Fixed Themes for people using CircularProgressBar and SmoothProgressBar themes (removed that weird 48dp height). --- library-circular/src/main/res/values/styles.xml | 5 ++++- library/src/main/res/values-v11/styles.xml | 12 +----------- library/src/main/res/values/styles.xml | 7 +++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/library-circular/src/main/res/values/styles.xml b/library-circular/src/main/res/values/styles.xml index 40ed45f..ba40af0 100644 --- a/library-circular/src/main/res/values/styles.xml +++ b/library-circular/src/main/res/values/styles.xml @@ -5,7 +5,10 @@ @style/CircularProgressBar - + + \ No newline at end of file diff --git a/library/src/main/res/values/styles.xml b/library/src/main/res/values/styles.xml index 4884410..5c9b2c2 100644 --- a/library/src/main/res/values/styles.xml +++ b/library/src/main/res/values/styles.xml @@ -4,8 +4,9 @@ - - + \ No newline at end of file From c889fc1b7d791dafcc749eb1a47994133bfbc418 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Sat, 21 Feb 2015 15:26:08 +0100 Subject: [PATCH 04/10] Added v21 theme (mainly for determinate state) --- library-circular/build.gradle | 2 +- library-circular/src/main/res/values-v21/styles.xml | 5 +++++ library/build.gradle | 2 +- library/src/main/res/values-v21/styles.xml | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 library-circular/src/main/res/values-v21/styles.xml create mode 100644 library/src/main/res/values-v21/styles.xml diff --git a/library-circular/build.gradle b/library-circular/build.gradle index 4b22983..4f2b706 100644 --- a/library-circular/build.gradle +++ b/library-circular/build.gradle @@ -10,7 +10,7 @@ android { defaultConfig { minSdkVersion 14 - targetSdkVersion 20 + targetSdkVersion 21 versionName project.VERSION_NAME versionCode Integer.parseInt(project.VERSION_CODE) } diff --git a/library-circular/src/main/res/values-v21/styles.xml b/library-circular/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..61c8a3a --- /dev/null +++ b/library-circular/src/main/res/values-v21/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index 36e8582..cc5a8f3 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -10,7 +10,7 @@ android { defaultConfig { minSdkVersion 7 - targetSdkVersion 20 + targetSdkVersion 21 versionName project.VERSION_NAME versionCode Integer.parseInt(project.VERSION_CODE) } diff --git a/library/src/main/res/values-v21/styles.xml b/library/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..0251000 --- /dev/null +++ b/library/src/main/res/values-v21/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file From 7114bf33c1f6739188f07e8509477cdb38c23554 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Sat, 21 Feb 2015 15:26:21 +0100 Subject: [PATCH 05/10] Updated sample to lollipop --- sample/build.gradle | 2 ++ sample/src/main/AndroidManifest.xml | 3 ++- sample/src/main/res/values-v21/styles.xml | 5 +++++ sample/src/main/res/values/styles.xml | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 sample/src/main/res/values-v21/styles.xml diff --git a/sample/build.gradle b/sample/build.gradle index 819b7e5..b4ec9bc 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -5,6 +5,8 @@ repositories { } dependencies { +// compile 'com.github.castorflex.smoothprogressbar:library:+' +// compile 'com.github.castorflex.smoothprogressbar:library-circular:+' compile project(':library') compile project(':library-circular') } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 98afd22..70833e3 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -19,7 +19,8 @@ + android:label="Make your own" + android:parentActivityName=".MainActivity"/> diff --git a/sample/src/main/res/values-v21/styles.xml b/sample/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..bf8f6ff --- /dev/null +++ b/sample/src/main/res/values-v21/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 0345013..fbaf0f0 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -1,6 +1,6 @@ - @@ -49,4 +49,7 @@ false + + From 688c32284b218fd6b81e7fb2ec14b86aebbac4c5 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Sat, 21 Feb 2015 16:01:17 +0100 Subject: [PATCH 06/10] Updated android gradle plugin version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1e36ccb..66cbb9f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:1.0.0' + classpath 'com.android.tools.build:gradle:1.1.0' } } From b644cd5a4aa9c609a0386a204915a83be9eff835 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Mon, 23 Feb 2015 19:05:20 +0100 Subject: [PATCH 07/10] Added viewEditMode check in the progressDrawable builder. should fix #41 --- .../CircularProgressBar.java | 2 +- .../CircularProgressDrawable.java | 24 ++++++++++---- .../smoothprogressbar/SmoothProgressBar.java | 2 +- .../SmoothProgressDrawable.java | 32 +++++++++++++------ 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBar.java b/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBar.java index e8d36ca..6c636eb 100644 --- a/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBar.java +++ b/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressBar.java @@ -24,7 +24,7 @@ public CircularProgressBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) { - setIndeterminateDrawable(new CircularProgressDrawable.Builder(context).build()); + setIndeterminateDrawable(new CircularProgressDrawable.Builder(context, true).build()); return; } diff --git a/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressDrawable.java b/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressDrawable.java index e5703f2..4b65998 100644 --- a/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressDrawable.java +++ b/library-circular/src/main/java/fr.castorflex.android.circularprogressbar/CircularProgressDrawable.java @@ -5,6 +5,7 @@ import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; @@ -12,17 +13,16 @@ import android.graphics.RectF; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; -import android.util.Log; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.checkAngle; -import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.getAnimatedFraction; import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.checkColors; import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.checkNotNull; import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.checkPositiveOrZero; import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.checkSpeed; +import static fr.castorflex.android.circularprogressbar.CircularProgressBarUtils.getAnimatedFraction; public class CircularProgressDrawable extends Drawable implements Animatable { @@ -395,16 +395,26 @@ public static class Builder { private Interpolator mAngleInterpolator = DEFAULT_ROTATION_INTERPOLATOR; public Builder(Context context) { - initValues(context); + this(context, false); } - private void initValues(Context context) { + public Builder(Context context, boolean editMode) { + initValues(context, editMode); + } + + private void initValues(Context context, boolean editMode) { mStrokeWidth = context.getResources().getDimension(R.dimen.cpb_default_stroke_width); mSweepSpeed = 1f; mRotationSpeed = 1f; - mColors = new int[]{context.getResources().getColor(R.color.cpb_default_color)}; - mMinSweepAngle = context.getResources().getInteger(R.integer.cpb_default_min_sweep_angle); - mMaxSweepAngle = context.getResources().getInteger(R.integer.cpb_default_max_sweep_angle); + if (editMode) { + mColors = new int[]{Color.BLUE}; + mMinSweepAngle = 20; + mMaxSweepAngle = 300; + } else { + mColors = new int[]{context.getResources().getColor(R.color.cpb_default_color)}; + mMinSweepAngle = context.getResources().getInteger(R.integer.cpb_default_min_sweep_angle); + mMaxSweepAngle = context.getResources().getInteger(R.integer.cpb_default_max_sweep_angle); + } mStyle = Style.ROUNDED; } diff --git a/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressBar.java b/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressBar.java index c359be9..0923943 100644 --- a/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressBar.java +++ b/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressBar.java @@ -35,7 +35,7 @@ public SmoothProgressBar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) { - setIndeterminateDrawable(new SmoothProgressDrawable.Builder(context).build()); + setIndeterminateDrawable(new SmoothProgressDrawable.Builder(context, true).build()); return; } diff --git a/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressDrawable.java b/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressDrawable.java index f8f9b57..cd7a2b1 100644 --- a/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressDrawable.java +++ b/library/src/main/java/fr/castorflex/android/smoothprogressbar/SmoothProgressDrawable.java @@ -626,7 +626,11 @@ public static class Builder { private Callbacks mOnProgressiveStopEndedListener; public Builder(Context context) { - initValues(context); + this(context, false); + } + + public Builder(Context context, boolean editMode) { + initValues(context, editMode); } public SmoothProgressDrawable build() { @@ -651,18 +655,28 @@ public SmoothProgressDrawable build() { return ret; } - private void initValues(Context context) { + private void initValues(Context context, boolean editMode) { Resources res = context.getResources(); mInterpolator = new AccelerateInterpolator(); - mSectionsCount = res.getInteger(R.integer.spb_default_sections_count); - mColors = new int[]{res.getColor(R.color.spb_default_color)}; - mSpeed = Float.parseFloat(res.getString(R.string.spb_default_speed)); + if (!editMode) { + mSectionsCount = res.getInteger(R.integer.spb_default_sections_count); + mSpeed = Float.parseFloat(res.getString(R.string.spb_default_speed)); + mReversed = res.getBoolean(R.bool.spb_default_reversed); + mProgressiveStartActivated = res.getBoolean(R.bool.spb_default_progressiveStart_activated); + mColors = new int[]{res.getColor(R.color.spb_default_color)}; + mStrokeSeparatorLength = res.getDimensionPixelSize(R.dimen.spb_default_stroke_separator_length); + mStrokeWidth = res.getDimensionPixelOffset(R.dimen.spb_default_stroke_width); + } else { + mSectionsCount = 4; + mSpeed = 1f; + mReversed = false; + mProgressiveStartActivated = false; + mColors = new int[]{0xff33b5e5}; + mStrokeSeparatorLength = 4; + mStrokeWidth = 4; + } mProgressiveStartSpeed = mSpeed; mProgressiveStopSpeed = mSpeed; - mReversed = res.getBoolean(R.bool.spb_default_reversed); - mStrokeSeparatorLength = res.getDimensionPixelSize(R.dimen.spb_default_stroke_separator_length); - mStrokeWidth = res.getDimensionPixelOffset(R.dimen.spb_default_stroke_width); - mProgressiveStartActivated = res.getBoolean(R.bool.spb_default_progressiveStart_activated); mGradients = false; } From 350bf1ed3f6c7409ff5b48314c164152d1809054 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Mon, 23 Feb 2015 19:07:07 +0100 Subject: [PATCH 08/10] Updated versions codes / names. Cleaned grade build --- CHANGELOG.md | 6 ++++++ gradle.properties | 2 +- library-circular/gradle.properties | 2 +- library/gradle.properties | 2 +- sample/build.gradle | 3 +-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 197e9f1..fa686f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +##1.1.0 + +- Fixed Circular bugs (flashes) +- Added material themes (mainly for determinate support) +- Fixed exception bug in preview mode + ##1.0.0 - Added CircularProgressDrawable (min API 14) diff --git a/gradle.properties b/gradle.properties index e4360ef..2281c96 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ VERSION_NAME=1.1.0 -VERSION_CODE=21 +VERSION_CODE=22 BUILD_TOOLS_VERSION=20 COMPILE_SDK_VERSION=21 GROUP=com.github.castorflex.smoothprogressbar diff --git a/library-circular/gradle.properties b/library-circular/gradle.properties index 946f92a..abe2c94 100644 --- a/library-circular/gradle.properties +++ b/library-circular/gradle.properties @@ -3,4 +3,4 @@ POM_ARTIFACT_ID=library-circular POM_PACKAGING=aar POM_DESCRIPTION=Android Library make smooth circular indeterminate progress bars -VERSION_NAME=1.0.2 +VERSION_NAME=1.1.0-SNAPSHOT diff --git a/library/gradle.properties b/library/gradle.properties index 1fedf23..af699c4 100644 --- a/library/gradle.properties +++ b/library/gradle.properties @@ -3,4 +3,4 @@ POM_ARTIFACT_ID=library POM_PACKAGING=aar POM_DESCRIPTION=Android Library make smooth horizontal indeterminate progress bars -VERSION_NAME=1.0.0 +VERSION_NAME=1.1.0-SNAPSHOT diff --git a/sample/build.gradle b/sample/build.gradle index b4ec9bc..b03760d 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -2,11 +2,10 @@ apply plugin: 'com.android.application' repositories { mavenCentral() + mavenLocal() } dependencies { -// compile 'com.github.castorflex.smoothprogressbar:library:+' -// compile 'com.github.castorflex.smoothprogressbar:library-circular:+' compile project(':library') compile project(':library-circular') } From 63dd4fd3390cfc938b5e8c830e43065cb1b9fc99 Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Mon, 23 Feb 2015 19:12:50 +0100 Subject: [PATCH 09/10] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa686f1..04df081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Fixed Circular bugs (flashes) - Added material themes (mainly for determinate support) - Fixed exception bug in preview mode +- **/!\\** Removed a weird 48dp height in the SmoothProgressBar style ##1.0.0 From 6a5dc5b92fbfcdff51829da770d4edbb25cfd2ca Mon Sep 17 00:00:00 2001 From: Antoine Merle Date: Tue, 17 Mar 2015 18:57:31 +0100 Subject: [PATCH 10/10] Prepared release / updated build tools version to 21.1.2 --- gradle.properties | 2 +- library-circular/gradle.properties | 2 +- library/gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2281c96..bafdc9f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ VERSION_NAME=1.1.0 VERSION_CODE=22 -BUILD_TOOLS_VERSION=20 +BUILD_TOOLS_VERSION=21.1.2 COMPILE_SDK_VERSION=21 GROUP=com.github.castorflex.smoothprogressbar diff --git a/library-circular/gradle.properties b/library-circular/gradle.properties index abe2c94..fe49968 100644 --- a/library-circular/gradle.properties +++ b/library-circular/gradle.properties @@ -3,4 +3,4 @@ POM_ARTIFACT_ID=library-circular POM_PACKAGING=aar POM_DESCRIPTION=Android Library make smooth circular indeterminate progress bars -VERSION_NAME=1.1.0-SNAPSHOT +VERSION_NAME=1.1.0 diff --git a/library/gradle.properties b/library/gradle.properties index af699c4..4fb2d2b 100644 --- a/library/gradle.properties +++ b/library/gradle.properties @@ -3,4 +3,4 @@ POM_ARTIFACT_ID=library POM_PACKAGING=aar POM_DESCRIPTION=Android Library make smooth horizontal indeterminate progress bars -VERSION_NAME=1.1.0-SNAPSHOT +VERSION_NAME=1.1.0