diff --git a/.gitignore b/.gitignore index 0f41f1b..ee46a18 100644 --- a/.gitignore +++ b/.gitignore @@ -28,15 +28,8 @@ proguard/ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm ## Directory-based project format -.idea/ -# if you remove the above rule, at least ignore user-specific stuff: -# .idea/workspace.xml -# .idea/tasks.xml -# and these sensitive or high-churn files: -# .idea/dataSources.ids -# .idea/dataSources.xml -# .idea/sqlDataSources.xml -# .idea/dynamic.xml +.idea/* +!.idea/codeStyles/ ## File-based project format *.ipr diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..a0d6955 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 17c8528..0eceb85 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -1,3 +1,4 @@ - + + diff --git a/library/src/main/java/com/dd/CircularAnimatedDrawable.java b/library/src/main/java/com/dd/CircularAnimatedDrawable.java index e92e9b3..788def5 100644 --- a/library/src/main/java/com/dd/CircularAnimatedDrawable.java +++ b/library/src/main/java/com/dd/CircularAnimatedDrawable.java @@ -91,18 +91,18 @@ protected void onBoundsChange(Rect bounds) { fBounds.bottom = bounds.bottom - mBorderWidth / 2f - .5f; } - private Property mAngleProperty = + private Property mAngleProperty = new Property(Float.class, "angle") { - @Override - public Float get(CircularAnimatedDrawable object) { - return object.getCurrentGlobalAngle(); - } - - @Override - public void set(CircularAnimatedDrawable object, Float value) { - object.setCurrentGlobalAngle(value); - } - }; + @Override + public Float get(CircularAnimatedDrawable object) { + return object.getCurrentGlobalAngle(); + } + + @Override + public void set(CircularAnimatedDrawable object, Float value) { + object.setCurrentGlobalAngle(value); + } + }; private Property mSweepProperty = new Property(Float.class, "arc") { diff --git a/library/src/main/java/com/dd/CircularProgressButton.java b/library/src/main/java/com/dd/CircularProgressButton.java index 14ac55b..ba1f446 100644 --- a/library/src/main/java/com/dd/CircularProgressButton.java +++ b/library/src/main/java/com/dd/CircularProgressButton.java @@ -1,7 +1,5 @@ package com.dd; -import com.dd.circular.progress.button.R; - import android.annotation.SuppressLint; import android.content.Context; import android.content.res.ColorStateList; @@ -17,6 +15,8 @@ import android.util.StateSet; import android.widget.Button; +import com.dd.circular.progress.button.R; + public class CircularProgressButton extends Button { public static final int IDLE_STATE_PROGRESS = 0; diff --git a/library/src/main/java/com/dd/StateManager.java b/library/src/main/java/com/dd/StateManager.java index 4e7b76a..6d50787 100644 --- a/library/src/main/java/com/dd/StateManager.java +++ b/library/src/main/java/com/dd/StateManager.java @@ -25,7 +25,7 @@ public int getProgress() { public void checkState(CircularProgressButton progressButton) { if (progressButton.getProgress() != getProgress()) { progressButton.setProgress(progressButton.getProgress()); - } else if(progressButton.isEnabled() != isEnabled()) { + } else if (progressButton.isEnabled() != isEnabled()) { progressButton.setEnabled(progressButton.isEnabled()); } } diff --git a/library/src/main/res/color/cpb_complete_state_selector.xml b/library/src/main/res/color/cpb_complete_state_selector.xml index e872399..b490705 100644 --- a/library/src/main/res/color/cpb_complete_state_selector.xml +++ b/library/src/main/res/color/cpb_complete_state_selector.xml @@ -1,11 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/library/src/main/res/color/cpb_error_state_selector.xml b/library/src/main/res/color/cpb_error_state_selector.xml index d5ab732..0fe742c 100644 --- a/library/src/main/res/color/cpb_error_state_selector.xml +++ b/library/src/main/res/color/cpb_error_state_selector.xml @@ -1,11 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/library/src/main/res/color/cpb_idle_state_selector.xml b/library/src/main/res/color/cpb_idle_state_selector.xml index 7fa1aa4..50c6b55 100644 --- a/library/src/main/res/color/cpb_idle_state_selector.xml +++ b/library/src/main/res/color/cpb_idle_state_selector.xml @@ -1,11 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/library/src/main/res/drawable/cpb_background.xml b/library/src/main/res/drawable/cpb_background.xml index ccd49bc..8385f0d 100644 --- a/library/src/main/res/drawable/cpb_background.xml +++ b/library/src/main/res/drawable/cpb_background.xml @@ -1,9 +1,9 @@ + android:shape="rectangle"> - + android:width="@dimen/cpb_stroke_width" + android:color="@color/cpb_blue" /> + \ 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 8456cec..1a9af25 100644 --- a/library/src/main/res/values/styles.xml +++ b/library/src/main/res/values/styles.xml @@ -1,20 +1,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/sample/src/main/java/com/dd/sample/Sample1Activity.java b/sample/src/main/java/com/dd/sample/Sample1Activity.java index c9553c7..36a8b2b 100644 --- a/sample/src/main/java/com/dd/sample/Sample1Activity.java +++ b/sample/src/main/java/com/dd/sample/Sample1Activity.java @@ -1,13 +1,13 @@ package com.dd.sample; -import com.dd.CircularProgressButton; - import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; +import com.dd.CircularProgressButton; + /** * Indeterminate Progress Sample */ @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ac_sample_1); ActionBar actionBar = getActionBar(); - if(actionBar != null) { + if (actionBar != null) { actionBar.setTitle(R.string.IndeterminateProgressSample); } diff --git a/sample/src/main/java/com/dd/sample/Sample2Activity.java b/sample/src/main/java/com/dd/sample/Sample2Activity.java index 032067f..8d01491 100644 --- a/sample/src/main/java/com/dd/sample/Sample2Activity.java +++ b/sample/src/main/java/com/dd/sample/Sample2Activity.java @@ -1,7 +1,5 @@ package com.dd.sample; -import com.dd.CircularProgressButton; - import android.animation.ValueAnimator; import android.app.ActionBar; import android.app.Activity; @@ -10,6 +8,8 @@ import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; +import com.dd.CircularProgressButton; + /** * Integer Progress Sample */ @@ -25,7 +25,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ac_sample_2); ActionBar actionBar = getActionBar(); - if(actionBar != null) { + if (actionBar != null) { actionBar.setTitle(R.string.IntegerProgressSample); } diff --git a/sample/src/main/java/com/dd/sample/Sample3Activity.java b/sample/src/main/java/com/dd/sample/Sample3Activity.java index d4af0b7..6a143c8 100644 --- a/sample/src/main/java/com/dd/sample/Sample3Activity.java +++ b/sample/src/main/java/com/dd/sample/Sample3Activity.java @@ -1,13 +1,13 @@ package com.dd.sample; -import com.dd.CircularProgressButton; - import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; +import com.dd.CircularProgressButton; + /** * State Change Sample */ @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ac_sample_3); ActionBar actionBar = getActionBar(); - if(actionBar != null) { + if (actionBar != null) { actionBar.setTitle(R.string.StateChangeSample); } diff --git a/sample/src/main/java/com/dd/sample/Sample4Activity.java b/sample/src/main/java/com/dd/sample/Sample4Activity.java index 8d4dcf8..dea6338 100644 --- a/sample/src/main/java/com/dd/sample/Sample4Activity.java +++ b/sample/src/main/java/com/dd/sample/Sample4Activity.java @@ -1,13 +1,13 @@ package com.dd.sample; -import com.dd.CircularProgressButton; - import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; +import com.dd.CircularProgressButton; + /** * Progress Padding Sample */ @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ac_sample_4); ActionBar actionBar = getActionBar(); - if(actionBar != null) { + if (actionBar != null) { actionBar.setTitle(R.string.ProgressPaddingSample); } diff --git a/sample/src/main/java/com/dd/sample/Sample5Activity.java b/sample/src/main/java/com/dd/sample/Sample5Activity.java index d44570e..279df99 100644 --- a/sample/src/main/java/com/dd/sample/Sample5Activity.java +++ b/sample/src/main/java/com/dd/sample/Sample5Activity.java @@ -1,13 +1,13 @@ package com.dd.sample; -import com.dd.CircularProgressButton; - import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; +import com.dd.CircularProgressButton; + /** * Progress Padding Sample */ @@ -23,7 +23,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.ac_sample_5); ActionBar actionBar = getActionBar(); - if(actionBar != null) { + if (actionBar != null) { actionBar.setTitle(R.string.CustomSelectorSample); } diff --git a/sample/src/main/res/drawable/complete_state_selector.xml b/sample/src/main/res/drawable/complete_state_selector.xml index 8716c4c..045dc88 100644 --- a/sample/src/main/res/drawable/complete_state_selector.xml +++ b/sample/src/main/res/drawable/complete_state_selector.xml @@ -1,11 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/sample/src/main/res/drawable/error_state_selector.xml b/sample/src/main/res/drawable/error_state_selector.xml index 5237f2f..c547375 100644 --- a/sample/src/main/res/drawable/error_state_selector.xml +++ b/sample/src/main/res/drawable/error_state_selector.xml @@ -1,11 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/sample/src/main/res/drawable/idle_state_selector.xml b/sample/src/main/res/drawable/idle_state_selector.xml index 77dcc24..533b34f 100644 --- a/sample/src/main/res/drawable/idle_state_selector.xml +++ b/sample/src/main/res/drawable/idle_state_selector.xml @@ -1,11 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/ac_sample_4.xml b/sample/src/main/res/layout/ac_sample_4.xml index a7f5a0f..1e3927c 100644 --- a/sample/src/main/res/layout/ac_sample_4.xml +++ b/sample/src/main/res/layout/ac_sample_4.xml @@ -7,29 +7,29 @@ android:orientation="vertical"> + android:id="@+id/circularButton1" + android:layout_width="196dp" + android:layout_height="64dp" + android:layout_marginTop="16dp" + android:textColor="@color/cpb_white" + android:textSize="18sp" + app:cpb_cornerRadius="48dp" + app:cpb_paddingProgress="10dp" + app:cpb_textComplete="@string/Complete" + app:cpb_textError="@string/Error" + app:cpb_textIdle="@string/Upload" /> + android:id="@+id/circularButton2" + android:layout_width="196dp" + android:layout_height="64dp" + android:layout_marginTop="16dp" + android:textColor="@color/cpb_white" + android:textSize="18sp" + app:cpb_cornerRadius="48dp" + app:cpb_paddingProgress="10dp" + app:cpb_textComplete="@string/Complete" + app:cpb_textError="@string/Error" + app:cpb_textIdle="@string/Upload" /> diff --git a/sample/src/main/res/layout/ac_sample_5.xml b/sample/src/main/res/layout/ac_sample_5.xml index e026060..b205efd 100644 --- a/sample/src/main/res/layout/ac_sample_5.xml +++ b/sample/src/main/res/layout/ac_sample_5.xml @@ -7,33 +7,33 @@ android:orientation="vertical"> + android:id="@+id/circularButton1" + android:layout_width="196dp" + android:layout_height="64dp" + android:layout_marginTop="16dp" + android:textColor="@color/cpb_white" + android:textSize="18sp" + app:cpb_cornerRadius="48dp" + app:cpb_textComplete="@string/Complete" + app:cpb_textError="@string/Error" + app:cpb_textIdle="@string/Upload" + app:cpb_selectorIdle="@drawable/idle_state_selector" + app:cpb_selectorComplete="@drawable/complete_state_selector" + app:cpb_selectorError="@drawable/error_state_selector" /> + android:id="@+id/circularButton2" + android:layout_width="196dp" + android:layout_height="64dp" + android:layout_marginTop="16dp" + android:textColor="@color/cpb_white" + android:textSize="18sp" + app:cpb_cornerRadius="48dp" + app:cpb_textComplete="@string/Complete" + app:cpb_textError="@string/Error" + app:cpb_textIdle="@string/Upload" + app:cpb_selectorIdle="@drawable/idle_state_selector" + app:cpb_selectorComplete="@drawable/complete_state_selector" + app:cpb_selectorError="@drawable/error_state_selector" />