Skip to content

Commit 99f873e

Browse files
Refactoring - Code style
1 parent 3b1ee29 commit 99f873e

File tree

6 files changed

+46
-48
lines changed

6 files changed

+46
-48
lines changed

loading-button-android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apply plugin: 'com.jfrog.bintray'
44
apply plugin: 'com.github.dcendents.android-maven'
55

66
//Bintray depends on this global variable to set the library version!
7-
version = '1.6.6'
7+
version = '1.7.0'
88
group = 'br.com.simplepass'
99

1010
android {
@@ -15,7 +15,7 @@ android {
1515
minSdkVersion 16
1616
targetSdkVersion 25
1717
versionCode 6
18-
versionName "1.6.6"
18+
versionName "1.7.0"
1919
}
2020
buildTypes {
2121
release {
@@ -70,7 +70,7 @@ install {
7070
packaging 'aar'
7171
groupId 'br.com.simplepass'
7272
artifactId 'loading-button-android'
73-
version '1.6.6'
73+
version '1.7.0'
7474

7575
licenses {
7676
license {

loading-button-android/src/main/java/br/com/simplepass/loading_button_lib/animatedDrawables/CircularAnimatedDrawable.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,21 @@ private void toggleAppearingMode() {
209209
}
210210

211211

212-
public void dispose()
213-
{
214-
if (mValueAnimatorAngle != null)
215-
{
212+
public void dispose() {
213+
if (mValueAnimatorAngle != null) {
216214
mValueAnimatorAngle.end();
217215
mValueAnimatorAngle.removeAllUpdateListeners();
218216
mValueAnimatorAngle.cancel();
219217
}
218+
220219
mValueAnimatorAngle = null;
221-
if (mValueAnimatorSweep != null)
222-
{
220+
221+
if (mValueAnimatorSweep != null) {
223222
mValueAnimatorSweep.end();
224223
mValueAnimatorSweep.removeAllUpdateListeners();
225224
mValueAnimatorSweep.cancel();
226225
}
226+
227227
mValueAnimatorSweep = null;
228228
}
229229
}

loading-button-android/src/main/java/br/com/simplepass/loading_button_lib/animatedDrawables/CircularRevealAnimatedDrawable.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import android.animation.Animator;
44
import android.animation.AnimatorListenerAdapter;
55
import android.animation.ValueAnimator;
6-
import android.content.Context;
76
import android.graphics.Bitmap;
87
import android.graphics.Canvas;
98
import android.graphics.Color;
109
import android.graphics.ColorFilter;
1110
import android.graphics.Paint;
11+
import android.graphics.PixelFormat;
1212
import android.graphics.Rect;
1313
import android.graphics.drawable.Animatable;
1414
import android.graphics.drawable.Drawable;
@@ -38,8 +38,6 @@ public class CircularRevealAnimatedDrawable extends Drawable implements Animatab
3838
private float bitMapXOffset;
3939
private float bitMapYOffset;
4040

41-
private Context mContext;
42-
4341
/**
4442
*
4543
* @param view The view that if being animated
@@ -184,17 +182,16 @@ public void setColorFilter(ColorFilter colorFilter) {}
184182

185183
@Override
186184
public int getOpacity() {
187-
return 0;
185+
return PixelFormat.OPAQUE;
188186
}
189187

190-
public void dispose()
191-
{
192-
if (mRevealInAnimation != null)
193-
{
188+
public void dispose() {
189+
if (mRevealInAnimation != null) {
194190
mRevealInAnimation.end();
195191
mRevealInAnimation.removeAllUpdateListeners();
196192
mRevealInAnimation.cancel();
197193
}
194+
198195
mRevealInAnimation = null;
199196
}
200197
}

loading-button-android/src/main/java/br/com/simplepass/loading_button_lib/customViews/CircularProgressButton.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private void init(Context context, AttributeSet attrs){
168168
* @param canvas Canvas
169169
*/
170170
@Override
171-
protected void onDraw(Canvas canvas){
171+
protected void onDraw(Canvas canvas) {
172172
super.onDraw(canvas);
173173

174174
if (mState == State.PROGRESS && !mIsMorphingInProgress) {
@@ -208,7 +208,7 @@ private void drawIndeterminateProgress(Canvas canvas) {
208208
/**
209209
* Stops the animation and sets the button in the STOPED state.
210210
*/
211-
public void stopAnimation(){
211+
public void stopAnimation() {
212212
if(mState == State.PROGRESS && !mIsMorphingInProgress) {
213213
mState = State.STOPED;
214214
mAnimatedDrawable.stop();
@@ -224,7 +224,7 @@ public void stopAnimation(){
224224
* @param fillColor The color of the background of the button
225225
* @param bitmap The image that will be shown
226226
*/
227-
public void doneLoadingAnimation(int fillColor, Bitmap bitmap){
227+
public void doneLoadingAnimation(int fillColor, Bitmap bitmap) {
228228
if(mState != State.PROGRESS) {
229229
return;
230230
}
@@ -412,25 +412,27 @@ public void onAnimationEnd(Animator animation) {
412412
}
413413

414414
@Override
415-
public void dispose()
416-
{
417-
if (mAnimatedDrawable != null)
415+
public void dispose() {
416+
if (mAnimatedDrawable != null) {
418417
mAnimatedDrawable.dispose();
419-
if (mRevealDrawable != null)
418+
}
419+
420+
if (mRevealDrawable != null) {
420421
mRevealDrawable.dispose();
422+
}
421423
}
422424

423425
/**
424426
* Method called to start the animation. Morphs in to a ball and then starts a loading spinner.
425427
*/
426-
public void startAnimation(){
427-
if(mState != State.IDLE){
428+
public void startAnimation() {
429+
if(mState != State.IDLE) {
428430
return;
429431
}
430432

431-
if(mIsMorphingInProgress){
433+
if(mIsMorphingInProgress) {
432434
mAnimatorSet.cancel();
433-
} else{
435+
} else {
434436
mParams.mInitialWidth = getWidth();
435437
mParams.mInitialHeight = getHeight();
436438
}
@@ -513,7 +515,7 @@ public void run() {
513515
/**
514516
* Class with all the params to configure the button.
515517
*/
516-
private class Params{
518+
private class Params {
517519
private float mSpinningBarWidth;
518520
private int mSpinningBarColor;
519521
private int mDoneColor;

loading-button-android/src/main/java/br/com/simplepass/loading_button_lib/customViews/CircularProgressEditText.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@ public void onAnimationEnd(Animator animation) {
197197
mAnimatorSet.start();
198198
}
199199

200-
public void startAnimation(){
201-
if(mState != State.IDLE){
200+
public void startAnimation() {
201+
if(mState != State.IDLE) {
202202
return;
203203
}
204204

205205
this.setText(null);
206206
setClickable(false);
207207

208-
if(mIsMorphingInProgress){
208+
if(mIsMorphingInProgress ){
209209
mAnimatorSet.cancel();
210210
}
211211

loading-button-android/src/main/java/br/com/simplepass/loading_button_lib/customViews/CircularProgressImageButton.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public CircularProgressImageButton(Context context, AttributeSet attrs, int defS
105105
* @param context Context
106106
* @param attrs Atributes passed in the XML
107107
*/
108-
private void init(Context context, AttributeSet attrs){
108+
private void init(Context context, AttributeSet attrs) {
109109
mParams = new Params();
110110

111111
mParams.mPaddingProgress = 0f;
@@ -166,12 +166,12 @@ private void init(Context context, AttributeSet attrs){
166166
* @param canvas Canvas
167167
*/
168168
@Override
169-
protected void onDraw(Canvas canvas){
169+
protected void onDraw(Canvas canvas) {
170170
super.onDraw(canvas);
171171

172172
if (mState == State.PROGRESS && !mIsMorphingInProgress) {
173173
drawIndeterminateProgress(canvas);
174-
} else if(mState == State.DONE){
174+
} else if(mState == State.DONE) {
175175
drawDoneAnimation(canvas);
176176
}
177177
}
@@ -206,7 +206,7 @@ private void drawIndeterminateProgress(Canvas canvas) {
206206
/**
207207
* Stops the animation and sets the button in the STOPED state.
208208
*/
209-
public void stopAnimation(){
209+
public void stopAnimation() {
210210
if(mState == State.PROGRESS && !mIsMorphingInProgress) {
211211
mState = State.STOPED;
212212
mAnimatedDrawable.stop();
@@ -259,14 +259,14 @@ public void doneLoadingAnimation(int fillColor, Bitmap bitmap) {
259259
*
260260
* @param canvas Canvas
261261
*/
262-
private void drawDoneAnimation(Canvas canvas){
262+
private void drawDoneAnimation(Canvas canvas) {
263263
mRevealDrawable.draw(canvas);
264264
}
265265

266266
public void revertAnimation(){
267267
mState = State.IDLE;
268268

269-
if(mAnimatedDrawable != null && mAnimatedDrawable.isRunning()){
269+
if(mAnimatedDrawable != null && mAnimatedDrawable.isRunning()) {
270270
stopAnimation();
271271
}
272272

@@ -338,7 +338,7 @@ public void onAnimationEnd(Animator animation) {
338338
mMorphingAnimatorSet.start();
339339
}
340340

341-
public void revertAnimation(final OnAnimationEndListener onAnimationEndListener){
341+
public void revertAnimation(final OnAnimationEndListener onAnimationEndListener) {
342342
mState = State.IDLE;
343343

344344
if(mAnimatedDrawable != null && mAnimatedDrawable.isRunning()){
@@ -415,28 +415,27 @@ public void onAnimationEnd(Animator animation) {
415415
}
416416

417417
@Override
418-
public void dispose()
419-
{
420-
if (mMorphingAnimatorSet != null)
421-
{
418+
public void dispose() {
419+
if (mMorphingAnimatorSet != null) {
422420
mMorphingAnimatorSet.end();
423421
mMorphingAnimatorSet.removeAllListeners();
424422
mMorphingAnimatorSet.cancel();
425423
}
424+
426425
mMorphingAnimatorSet = null;
427426
}
428427

429428
/**
430429
* Method called to start the animation. Morphs in to a ball and then starts a loading spinner.
431430
*/
432-
public void startAnimation(){
433-
if(mState != State.IDLE){
431+
public void startAnimation() {
432+
if(mState != State.IDLE) {
434433
return;
435434
}
436435

437-
if(mIsMorphingInProgress){
436+
if (mIsMorphingInProgress) {
438437
mMorphingAnimatorSet.cancel();
439-
} else{
438+
} else {
440439
mParams.mInitialWidth = getWidth();
441440
mParams.mInitialHeight = getHeight();
442441
}
@@ -520,7 +519,7 @@ public void run() {
520519
/**
521520
* Class with all the params to configure the button.
522521
*/
523-
private class Params{
522+
private class Params {
524523
private float mSpinningBarWidth;
525524
private int mSpinningBarColor;
526525
private int mDoneColor;

0 commit comments

Comments
 (0)