diff --git a/CHANGELOG.md b/CHANGELOG.md index 197e9f1..04df081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +##1.1.0 + +- 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 - Added CircularProgressDrawable (min API 14) diff --git a/build.gradle b/build.gradle index 7ef72b4..66cbb9f 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.1.0' } } diff --git a/gradle.properties b/gradle.properties index e4360ef..bafdc9f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ VERSION_NAME=1.1.0 -VERSION_CODE=21 -BUILD_TOOLS_VERSION=20 +VERSION_CODE=22 +BUILD_TOOLS_VERSION=21.1.2 COMPILE_SDK_VERSION=21 GROUP=com.github.castorflex.smoothprogressbar 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 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/gradle.properties b/library-circular/gradle.properties index 946f92a..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.0.2 +VERSION_NAME=1.1.0 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/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; 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-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-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-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 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 diff --git a/sample/build.gradle b/sample/build.gradle index 819b7e5..b03760d 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.application' repositories { mavenCentral() + mavenLocal() } dependencies { 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 + +