Skip to content

Commit 6a836a0

Browse files
committed
see 07/26 log
1 parent 8f1c522 commit 6a836a0

File tree

23 files changed

+294
-66
lines changed

23 files changed

+294
-66
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* `19/07/26` [add] ContainerUtils. Publish v1.25.2.
2+
* `19/07/25` [fix] PermissionUtils' NullPointException.
3+
* `19/07/24` [fix] ZipUtils#unzipFile.
14
* `19/07/23` [fix] ThreadUtils of cache pool. Publish v1.25.1.
25
* `19/07/18` [add] README of ApiUtils and BusUtils.
36
* `19/07/15` [add] Publish v1.25.0.

README-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
4747

48-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.1-brightgreen.svg
48+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.2-brightgreen.svg
4949
[auc]: https://github.com/Blankj/AndroidUtilCode
5050

5151
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ If this project helps you a lot and you want to support the project's developmen
4545

4646
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
4747

48-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.1-brightgreen.svg
48+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.2-brightgreen.svg
4949
[auc]: https://github.com/Blankj/AndroidUtilCode
5050

5151
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

buildApp.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ configApkName()
1616
android {
1717
compileSdkVersion Config.compileSdkVersion
1818
defaultConfig {
19-
minSdkVersion Config.minSdkVersion
19+
minSdkVersion 16
2020
versionCode Config.versionCode
2121
versionName Config.versionName
2222
applicationId Config.applicationId + suffix
@@ -55,6 +55,9 @@ dependencies {
5555
debugImplementation Config.depConfig.leakcanary.support_fragment.dep
5656
releaseImplementation Config.depConfig.leakcanary.android_no_op.dep
5757

58+
debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:1.1.8'
59+
releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.1.8'
60+
5861
// 根据 Config.pkgConfig 来依赖所有 pkg
5962
for (def entrySet : ConfigUtils.getApplyPkgs().entrySet()) {
6063
api entrySet.value.dep

buildSrc/src/main/groovy/Config.groovy

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Config {
1414
static compileSdkVersion = 27
1515
static minSdkVersion = 14
1616
static targetSdkVersion = 27
17-
static versionCode = 1_025_001
18-
static versionName = '1.25.1'// E.g. 1.9.72 => 1,009,072
17+
static versionCode = 1_025_002
18+
static versionName = '1.25.2'// E.g. 1.9.72 => 1,009,072
1919

2020
// lib version
2121
static kotlin_version = '1.3.10'
@@ -71,10 +71,11 @@ class Config {
7171
],
7272

7373
lib : [
74-
base : new DepConfig(":lib:base"),
75-
common : new DepConfig(":lib:common"),
76-
subutil : new DepConfig(":lib:subutil"),
77-
utilcode: new DepConfig(true/*是否本地调试*/, ":lib:utilcode", "com.blankj:utilcode:$versionName"),
74+
base : new DepConfig(":lib:base"),
75+
common : new DepConfig(":lib:common"),
76+
subutil : new DepConfig(":lib:subutil"),
77+
utilcode : new DepConfig(true/*是否本地调试*/, ":lib:utilcode", "com.blankj:utilcode:$versionName"),
78+
utildebug: new DepConfig(true/*是否本地调试*/, ":lib:utildebug", "com.blankj:utildebug:$versionName"),
7879
],
7980

8081
support : [

buildSrc/src/main/groovy/ConfigUtils.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class ConfigUtils {
8888
void beforeEvaluate(Project project) {
8989
if (project.subprojects.isEmpty()) {
9090
if (project.path.contains(":plugin:")) {
91-
// 插件的话自己写 build.gradle
9291
return
9392
}
9493
if (project.name == "app") {

lib/base/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ dependencies {
1212
api Config.depConfig.swipe_panel.dep
1313
api Config.depConfig.eventbus.lib.dep
1414
compileOnly Config.depConfig.leakcanary.android_no_op.dep
15+
compileOnly 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.1.8'
1516
}

lib/base/src/main/java/com/blankj/base/BaseApplication.java

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.blankj.utilcode.util.CrashUtils;
99
import com.blankj.utilcode.util.LogUtils;
1010
import com.blankj.utilcode.util.ProcessUtils;
11+
import com.didichuxing.doraemonkit.DoraemonKit;
1112
import com.squareup.leakcanary.LeakCanary;
1213

1314
import java.util.ArrayList;
@@ -41,6 +42,7 @@ protected void attachBaseContext(Context base) {
4142
public void onCreate() {
4243
super.onCreate();
4344
sInstance = this;
45+
DoraemonKit.install(this);
4446
initLeakCanary();
4547
initLog();
4648
initCrash();

lib/utilcode/README-CN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

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

1111

lib/utilcode/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

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

1111

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
package com.blankj.utilcode.util;
2+
3+
import android.os.Build;
4+
import android.support.annotation.RequiresApi;
5+
import android.support.v4.util.SimpleArrayMap;
6+
import android.util.SparseArray;
7+
import android.util.SparseBooleanArray;
8+
import android.util.SparseIntArray;
9+
import android.util.SparseLongArray;
10+
11+
import java.util.Collection;
12+
import java.util.Collections;
13+
14+
/**
15+
* <pre>
16+
* author: blankj
17+
* blog : http://blankj.com
18+
* time : 2019/07/26
19+
* desc : utils about container
20+
* </pre>
21+
*/
22+
public final class ContainerUtils {
23+
24+
private ContainerUtils() {
25+
throw new UnsupportedOperationException("u can't instantiate me...");
26+
}
27+
28+
public static <T> boolean isEmpty(T[] arr) {
29+
return arr == null || arr.length == 0;
30+
}
31+
32+
public static boolean isEmpty(final Collection obj) {
33+
return obj == null || obj.isEmpty();
34+
}
35+
36+
public static boolean isEmpty(final java.util.Map obj) {
37+
return obj == null || obj.isEmpty();
38+
}
39+
40+
public static boolean isEmpty(final SimpleArrayMap obj) {
41+
return obj == null || obj.isEmpty();
42+
}
43+
44+
public static boolean isEmpty(final SparseArray obj) {
45+
return obj == null || obj.size() == 0;
46+
}
47+
48+
public static boolean isEmpty(final SparseBooleanArray obj) {
49+
return obj == null || obj.size() == 0;
50+
}
51+
52+
public static boolean isEmpty(final SparseIntArray obj) {
53+
return obj == null || obj.size() == 0;
54+
}
55+
56+
public static boolean isEmpty(final android.support.v4.util.LongSparseArray obj) {
57+
return obj == null || obj.size() == 0;
58+
}
59+
60+
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
61+
public static boolean isEmpty(final android.util.LongSparseArray obj) {
62+
return obj == null || obj.size() == 0;
63+
}
64+
65+
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
66+
public static boolean isEmpty(final SparseLongArray obj) {
67+
return obj == null || obj.size() == 0;
68+
}
69+
70+
public static <V> boolean isNotEmpty(V[] obj) {
71+
return !isEmpty(obj);
72+
}
73+
74+
public static boolean isNotEmpty(final Collection obj) {
75+
return !isEmpty(obj);
76+
}
77+
78+
public static boolean isNotEmpty(final java.util.Map obj) {
79+
return !isEmpty(obj);
80+
}
81+
82+
public static boolean isNotEmpty(final SimpleArrayMap obj) {
83+
return !isEmpty(obj);
84+
}
85+
86+
public static boolean isNotEmpty(final SparseArray obj) {
87+
return !isEmpty(obj);
88+
}
89+
90+
public static boolean isNotEmpty(final SparseBooleanArray obj) {
91+
return !isEmpty(obj);
92+
}
93+
94+
public static boolean isNotEmpty(final SparseIntArray obj) {
95+
return !isEmpty(obj);
96+
}
97+
98+
public static boolean isNotEmpty(final android.support.v4.util.LongSparseArray obj) {
99+
return !isEmpty(obj);
100+
}
101+
102+
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
103+
public static boolean isNotEmpty(final android.util.LongSparseArray obj) {
104+
return !isEmpty(obj);
105+
}
106+
107+
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
108+
public static boolean isNotEmpty(final SparseLongArray obj) {
109+
return !isEmpty(obj);
110+
}
111+
112+
113+
public static final class Array {
114+
115+
private Array() {
116+
throw new UnsupportedOperationException("u can't instantiate me...");
117+
}
118+
119+
public static <T> int getSize(final T[] arr) {
120+
if (isEmpty(arr)) return 0;
121+
return arr.length;
122+
}
123+
124+
public static <T> void reverse(final T[] arr) {
125+
int size = getSize(arr);
126+
if (size <= 1) return;
127+
int mid = size >> 1;
128+
T tmp;
129+
for (int i = 0; i < mid; i++) {
130+
tmp = arr[i];
131+
arr[i] = arr[size - i - 1];
132+
arr[size - i - 1] = tmp;
133+
}
134+
}
135+
}
136+
137+
138+
public static final class List {
139+
140+
private List() {
141+
throw new UnsupportedOperationException("u can't instantiate me...");
142+
}
143+
144+
public static <T> int getSize(java.util.List<T> list) {
145+
if (isEmpty(list)) return 0;
146+
return list.size();
147+
}
148+
149+
public static <V> void reverse(java.util.List<V> list) {
150+
if (getSize(list) <= 1) return;
151+
Collections.reverse(list);
152+
}
153+
154+
}
155+
156+
157+
public static final class Map {
158+
159+
private Map() {
160+
throw new UnsupportedOperationException("u can't instantiate me...");
161+
}
162+
163+
public static <K, V> int getSize(java.util.Map<K, V> map) {
164+
if (isEmpty(map)) return 0;
165+
return map.size();
166+
}
167+
168+
169+
}
170+
171+
172+
}

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
410410
public void onRequestPermissionsResult(int requestCode,
411411
@NonNull String[] permissions,
412412
@NonNull int[] grantResults) {
413-
sInstance.onRequestPermissionsResult(this);
413+
if (sInstance != null && sInstance.mPermissionsRequest != null) {
414+
sInstance.onRequestPermissionsResult(this);
415+
}
414416
finish();
415417
}
416418

0 commit comments

Comments
 (0)