File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
src/main/java/com/wang/avi/indicator Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ You can also find iOS version of this [here](https://github.com/ninjaprox/NVActi
20
20
Add dependencies in build.gradle.
21
21
``` groovy
22
22
dependencies {
23
- compile 'com.wang.avi:library:1.0.4 '
23
+ compile 'com.wang.avi:library:1.0.5 '
24
24
compile 'com.nineoldandroids:library:2.4.0'
25
25
}
26
26
```
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ android {
7
7
defaultConfig {
8
8
minSdkVersion 9
9
9
targetSdkVersion 23
10
- versionCode 5
11
- versionName " 1.0.4 "
10
+ versionCode 6
11
+ versionName " 1.0.5 "
12
12
}
13
13
buildTypes {
14
14
release {
@@ -26,7 +26,7 @@ dependencies {
26
26
27
27
ext {
28
28
PUBLISH_GROUP_ID = ' com.wang.avi'
29
- PUBLISH_VERSION = ' 1.0.4 '
29
+ PUBLISH_VERSION = ' 1.0.5 '
30
30
PUBLISH_DES = ' Nice loading animations for Android'
31
31
LIB_NAME = ' AVLoadingIndicatorView'
32
32
Original file line number Diff line number Diff line change 2
2
3
3
import android .graphics .Canvas ;
4
4
import android .graphics .Paint ;
5
- import android .util .Log ;
6
5
import android .view .View ;
7
6
8
7
import com .nineoldandroids .animation .Animator ;
9
8
10
- import java .util . ArrayList ;
9
+ import java .lang . ref . WeakReference ;
11
10
import java .util .List ;
12
11
13
12
/**
16
15
public abstract class BaseIndicatorController {
17
16
18
17
19
- private View mTarget ;
18
+ private WeakReference < View > mTarget ;
20
19
21
20
private List <Animator > mAnimators ;
22
21
23
22
24
23
public void setTarget (View target ){
25
- this .mTarget =target ;
24
+ this .mTarget =new WeakReference <>( target ) ;
26
25
}
27
26
28
27
public View getTarget (){
29
- return mTarget ;
28
+ return mTarget != null ? mTarget . get (): null ;
30
29
}
31
30
32
31
33
32
public int getWidth (){
34
- return mTarget .getWidth ();
33
+ return getTarget ()!= null ? getTarget () .getWidth (): 0 ;
35
34
}
36
35
37
36
public int getHeight (){
38
- return mTarget .getHeight ();
37
+ return getTarget ()!= null ? getTarget () .getHeight (): 0 ;
39
38
}
40
39
41
40
public void postInvalidate (){
42
- mTarget .postInvalidate ();
41
+ if (getTarget ()!=null ){
42
+ getTarget ().postInvalidate ();
43
+ }
43
44
}
44
45
45
46
/**
You can’t perform that action at this time.
0 commit comments