Skip to content

Commit

Permalink
see 07/26 log
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankj committed Jul 26, 2019
1 parent 8f1c522 commit 6a836a0
Show file tree
Hide file tree
Showing 23 changed files with 294 additions and 66 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* `19/07/26` [add] ContainerUtils. Publish v1.25.2.
* `19/07/25` [fix] PermissionUtils' NullPointException.
* `19/07/24` [fix] ZipUtils#unzipFile.
* `19/07/23` [fix] ThreadUtils of cache pool. Publish v1.25.1.
* `19/07/18` [add] README of ApiUtils and BusUtils.
* `19/07/15` [add] Publish v1.25.0.
Expand Down
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

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

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

[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If this project helps you a lot and you want to support the project's developmen

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

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

[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
Expand Down
5 changes: 4 additions & 1 deletion buildApp.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ configApkName()
android {
compileSdkVersion Config.compileSdkVersion
defaultConfig {
minSdkVersion Config.minSdkVersion
minSdkVersion 16
versionCode Config.versionCode
versionName Config.versionName
applicationId Config.applicationId + suffix
Expand Down Expand Up @@ -55,6 +55,9 @@ dependencies {
debugImplementation Config.depConfig.leakcanary.support_fragment.dep
releaseImplementation Config.depConfig.leakcanary.android_no_op.dep

debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:1.1.8'
releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.1.8'

// 根据 Config.pkgConfig 来依赖所有 pkg
for (def entrySet : ConfigUtils.getApplyPkgs().entrySet()) {
api entrySet.value.dep
Expand Down
13 changes: 7 additions & 6 deletions buildSrc/src/main/groovy/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class Config {
static compileSdkVersion = 27
static minSdkVersion = 14
static targetSdkVersion = 27
static versionCode = 1_025_001
static versionName = '1.25.1'// E.g. 1.9.72 => 1,009,072
static versionCode = 1_025_002
static versionName = '1.25.2'// E.g. 1.9.72 => 1,009,072

// lib version
static kotlin_version = '1.3.10'
Expand Down Expand Up @@ -71,10 +71,11 @@ class Config {
],

lib : [
base : new DepConfig(":lib:base"),
common : new DepConfig(":lib:common"),
subutil : new DepConfig(":lib:subutil"),
utilcode: new DepConfig(true/*是否本地调试*/, ":lib:utilcode", "com.blankj:utilcode:$versionName"),
base : new DepConfig(":lib:base"),
common : new DepConfig(":lib:common"),
subutil : new DepConfig(":lib:subutil"),
utilcode : new DepConfig(true/*是否本地调试*/, ":lib:utilcode", "com.blankj:utilcode:$versionName"),
utildebug: new DepConfig(true/*是否本地调试*/, ":lib:utildebug", "com.blankj:utildebug:$versionName"),
],

support : [
Expand Down
1 change: 0 additions & 1 deletion buildSrc/src/main/groovy/ConfigUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class ConfigUtils {
void beforeEvaluate(Project project) {
if (project.subprojects.isEmpty()) {
if (project.path.contains(":plugin:")) {
// 插件的话自己写 build.gradle
return
}
if (project.name == "app") {
Expand Down
1 change: 1 addition & 0 deletions lib/base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ dependencies {
api Config.depConfig.swipe_panel.dep
api Config.depConfig.eventbus.lib.dep
compileOnly Config.depConfig.leakcanary.android_no_op.dep
compileOnly 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.1.8'
}
2 changes: 2 additions & 0 deletions lib/base/src/main/java/com/blankj/base/BaseApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.blankj.utilcode.util.CrashUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ProcessUtils;
import com.didichuxing.doraemonkit.DoraemonKit;
import com.squareup.leakcanary.LeakCanary;

import java.util.ArrayList;
Expand Down Expand Up @@ -41,6 +42,7 @@ protected void attachBaseContext(Context base) {
public void onCreate() {
super.onCreate();
sInstance = this;
DoraemonKit.install(this);
initLeakCanary();
initLog();
initCrash();
Expand Down
4 changes: 2 additions & 2 deletions lib/utilcode/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Gradle:
```groovy
implementation 'com.blankj:utilcode:1.25.1'
implementation 'com.blankj:utilcode:1.25.2'
// if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.25.1'
implementation 'com.blankj:utilcodex:1.25.2'
```


Expand Down
4 changes: 2 additions & 2 deletions lib/utilcode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Gradle:
```groovy
implementation 'com.blankj:utilcode:1.25.1'
implementation 'com.blankj:utilcode:1.25.2'
// if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.25.1'
implementation 'com.blankj:utilcodex:1.25.2'
```


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
package com.blankj.utilcode.util;

import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v4.util.SimpleArrayMap;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import android.util.SparseLongArray;

import java.util.Collection;
import java.util.Collections;

/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/07/26
* desc : utils about container
* </pre>
*/
public final class ContainerUtils {

private ContainerUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}

public static <T> boolean isEmpty(T[] arr) {
return arr == null || arr.length == 0;
}

public static boolean isEmpty(final Collection obj) {
return obj == null || obj.isEmpty();
}

public static boolean isEmpty(final java.util.Map obj) {
return obj == null || obj.isEmpty();
}

public static boolean isEmpty(final SimpleArrayMap obj) {
return obj == null || obj.isEmpty();
}

public static boolean isEmpty(final SparseArray obj) {
return obj == null || obj.size() == 0;
}

public static boolean isEmpty(final SparseBooleanArray obj) {
return obj == null || obj.size() == 0;
}

public static boolean isEmpty(final SparseIntArray obj) {
return obj == null || obj.size() == 0;
}

public static boolean isEmpty(final android.support.v4.util.LongSparseArray obj) {
return obj == null || obj.size() == 0;
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public static boolean isEmpty(final android.util.LongSparseArray obj) {
return obj == null || obj.size() == 0;
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static boolean isEmpty(final SparseLongArray obj) {
return obj == null || obj.size() == 0;
}

public static <V> boolean isNotEmpty(V[] obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final Collection obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final java.util.Map obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final SimpleArrayMap obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final SparseArray obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final SparseBooleanArray obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final SparseIntArray obj) {
return !isEmpty(obj);
}

public static boolean isNotEmpty(final android.support.v4.util.LongSparseArray obj) {
return !isEmpty(obj);
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public static boolean isNotEmpty(final android.util.LongSparseArray obj) {
return !isEmpty(obj);
}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public static boolean isNotEmpty(final SparseLongArray obj) {
return !isEmpty(obj);
}


public static final class Array {

private Array() {
throw new UnsupportedOperationException("u can't instantiate me...");
}

public static <T> int getSize(final T[] arr) {
if (isEmpty(arr)) return 0;
return arr.length;
}

public static <T> void reverse(final T[] arr) {
int size = getSize(arr);
if (size <= 1) return;
int mid = size >> 1;
T tmp;
for (int i = 0; i < mid; i++) {
tmp = arr[i];
arr[i] = arr[size - i - 1];
arr[size - i - 1] = tmp;
}
}
}


public static final class List {

private List() {
throw new UnsupportedOperationException("u can't instantiate me...");
}

public static <T> int getSize(java.util.List<T> list) {
if (isEmpty(list)) return 0;
return list.size();
}

public static <V> void reverse(java.util.List<V> list) {
if (getSize(list) <= 1) return;
Collections.reverse(list);
}

}


public static final class Map {

private Map() {
throw new UnsupportedOperationException("u can't instantiate me...");
}

public static <K, V> int getSize(java.util.Map<K, V> map) {
if (isEmpty(map)) return 0;
return map.size();
}


}


}
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
sInstance.onRequestPermissionsResult(this);
if (sInstance != null && sInstance.mPermissionsRequest != null) {
sInstance.onRequestPermissionsResult(this);
}
finish();
}

Expand Down

0 comments on commit 6a836a0

Please sign in to comment.