Skip to content

Commit 1fb4080

Browse files
committed
see 04/26 log
1 parent 4acdc6b commit 1fb4080

File tree

7 files changed

+34
-11
lines changed

7 files changed

+34
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* `20/04/26` [fix] Utils#init fit tinker. Publish 1.28.3.
12
* `20/04/25` [fix] UriUtils#uri2File Unknown URI. Publish 1.28.2.
23
* `20/04/24` [add] SnackbarUtils support show on the top; UriUtils#uri2InputStream.
34
* `20/04/23` [fix] UriUtils#uri2File not support HW; TransActivity crash below 21.

buildSrc/src/main/groovy/Config.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Config {
1515
static minSdkVersion = 14
1616
static targetSdkVersion = 29
1717
static versionCode = 1_028_002
18-
static versionName = '1.28.2'// E.g. 1.9.72 => 1,009,072
18+
static versionName = '1.28.3'// E.g. 1.9.72 => 1,009,072
1919

2020
// lib version
2121
static gradlePluginVersion = '3.5.0'

lib/utilcode/README-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
Gradle:
44
```groovy
5-
implementation 'com.blankj:utilcode:1.28.2'
5+
implementation 'com.blankj:utilcode:1.28.3'
66
77
// if u use AndroidX, use the following
8-
implementation 'com.blankj:utilcodex:1.28.2'
8+
implementation 'com.blankj:utilcodex:1.28.3'
99
```
1010

1111

lib/utilcode/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
Gradle:
44
```groovy
5-
implementation 'com.blankj:utilcode:1.28.2'
5+
implementation 'com.blankj:utilcode:1.28.3'
66
77
// if u use AndroidX, use the following
8-
implementation 'com.blankj:utilcodex:1.28.2'
8+
implementation 'com.blankj:utilcodex:1.28.3'
99
```
1010

1111

lib/utilcode/src/main/java/com/blankj/utilcode/util/Utils.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,20 @@ private Utils() {
4242
* @param app application
4343
*/
4444
public static void init(final Application app) {
45-
if (sApp != null) return;
45+
if (app == null) {
46+
Log.e("Utils", "app is null.");
47+
return;
48+
}
49+
if (sApp == null) {
50+
sApp = app;
51+
UtilsBridge.init(sApp);
52+
UtilsBridge.preLoad();
53+
return;
54+
}
55+
if (sApp.equals(app)) return;
56+
UtilsBridge.unInit(sApp);
4657
sApp = app;
47-
UtilsBridge.init();
58+
UtilsBridge.init(sApp);
4859
}
4960

5061
/**

lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsActivityLifecycleImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ final class UtilsActivityLifecycleImpl implements Application.ActivityLifecycleC
4040
private int mConfigCount = 0;
4141
private boolean mIsBackground = false;
4242

43-
void init() {
43+
void init(Application app) {
44+
app.registerActivityLifecycleCallbacks(this);
45+
}
46+
47+
void unInit(Application app) {
4448
mActivityList.clear();
45-
Utils.getApp().registerActivityLifecycleCallbacks(this);
49+
app.unregisterActivityLifecycleCallbacks(this);
4650
}
4751

4852
Activity getTopActivity() {

lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsBridge.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@
3535
*/
3636
class UtilsBridge {
3737

38-
static void init() {
39-
UtilsActivityLifecycleImpl.INSTANCE.init();
38+
static void init(Application app) {
39+
UtilsActivityLifecycleImpl.INSTANCE.init(app);
40+
}
41+
42+
static void unInit(Application app) {
43+
UtilsActivityLifecycleImpl.INSTANCE.unInit(app);
44+
}
45+
46+
static void preLoad() {
4047
preLoad(AdaptScreenUtils.getPreLoadRunnable());
4148
}
4249

0 commit comments

Comments
 (0)