File tree Expand file tree Collapse file tree
androidTest/java/com/github/nikartm/stripedprocessbutton
java/com/github/nikartm/stripedprocessbutton
test/java/com/github/nikartm/stripedprocessbutton
support/src/main/java/com/github/nikartm/support Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
33android {
44 compileSdkVersion 27
55 defaultConfig {
6- applicationId " com.github.nikartm.strippedprogressbutton "
6+ applicationId " com.github.nikartm.stripedprocessbutton "
77 minSdkVersion 21
88 targetSdkVersion 27
99 versionCode 1
Original file line number Diff line number Diff line change 1- package com .github .nikartm .strippedprocessbutton ;
1+ package com .github .nikartm .stripedprocessbutton ;
22
33import android .content .Context ;
44import android .support .test .InstrumentationRegistry ;
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<manifest xmlns : android =" http://schemas.android.com/apk/res/android"
3- package =" com.github.nikartm.strippedprocessbutton " >
3+ package =" com.github.nikartm.stripedprocessbutton " >
44
55 <application
66 android : allowBackup =" true"
99 android : roundIcon =" @mipmap/ic_launcher_round"
1010 android : supportsRtl =" true"
1111 android : theme =" @style/AppTheme" >
12- <activity android : name =" .MainActivity" >
12+ <activity android : name =" com.github.nikartm.stripedprocessbutton .MainActivity" >
1313 <intent-filter >
1414 <action android : name =" android.intent.action.MAIN" />
1515
Original file line number Diff line number Diff line change 1- package com .github .nikartm .strippedprocessbutton ;
1+ package com .github .nikartm .stripedprocessbutton ;
22
33import android .os .Bundle ;
44import android .support .v7 .app .AppCompatActivity ;
Original file line number Diff line number Diff line change 2929 android : clickable =" true"
3030 android : focusable =" true"
3131 android : textColor =" #ffffff"
32- app : spb_cornerRadius =" 50 " />
32+ app : spb_cornerRadius =" 10 " />
3333
3434 <Button
3535 android : id =" @+id/btn_stop"
Original file line number Diff line number Diff line change 11<resources >
2- <string name =" app_name" >StrippedProcessButton -Android</string >
2+ <string name =" app_name" >StripedProcessButton -Android</string >
33</resources >
Original file line number Diff line number Diff line change 1- package com .github .nikartm .strippedprocessbutton ;
1+ package com .github .nikartm .stripedprocessbutton ;
22
33import org .junit .Test ;
44
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ protected void onDraw(Canvas canvas) {
5959
6060 @ Override
6161 public void start () {
62- if (isRunning ()) {
62+ if (isRunning () || ! isAttachedToWindow () ) {
6363 return ;
6464 }
6565 setEnabled (isRunning ());
@@ -69,7 +69,7 @@ public void start() {
6969
7070 @ Override
7171 public void stop () {
72- if (!isRunning ()) {
72+ if (!isRunning () || ! isAttachedToWindow () ) {
7373 return ;
7474 }
7575 setEnabled (isRunning ());
@@ -79,7 +79,7 @@ public void stop() {
7979
8080 @ Override
8181 public boolean isRunning () {
82- return stripedDrawable .isRunning ();
82+ return isAttachedToWindow () && stripedDrawable .isRunning ();
8383 }
8484
8585 private void animateButton (boolean start ) {
You can’t perform that action at this time.
0 commit comments