From f213c602ffa0eae66ca2d64bd2cdd223d0f2298a Mon Sep 17 00:00:00 2001 From: Blankj <--global> Date: Wed, 21 Mar 2018 01:03:33 +0800 Subject: [PATCH] see 03/21 log --- README-CN.md | 2 +- README.md | 2 +- app/build.gradle | 2 +- app/src/main/res_core/values/strings.xml | 1 + build.gradle | 4 +-- update_log.md | 1 + utilcode/README-CN.md | 2 +- utilcode/README.md | 2 +- utilcode/src/main/AndroidManifest.xml | 1 + .../com/blankj/utilcode/util/ImageUtils.java | 30 +++++++++++++++++++ .../blankj/utilcode/util/PermissionUtils.java | 5 +++- 11 files changed, 44 insertions(+), 8 deletions(-) diff --git a/README-CN.md b/README-CN.md index b31ecd76..b7830c5f 100644 --- a/README-CN.md +++ b/README-CN.md @@ -41,7 +41,7 @@ [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png -[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.4-brightgreen.svg +[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.5-brightgreen.svg [auc]: https://github.com/Blankj/AndroidUtilCode [apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg diff --git a/README.md b/README.md index 273ec711..16fcc718 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If this ptoject helps you a lot, and you would like to support this ptoject's fu [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png -[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.4-brightgreen.svg +[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.5-brightgreen.svg [auc]: https://github.com/Blankj/AndroidUtilCode [apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg diff --git a/app/build.gradle b/app/build.gradle index 4f64cfb4..c0176560 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -56,7 +56,7 @@ dependencies { // LeakCanary debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version" releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version" -// implementation 'com.blankj:utilcode:1.13.4' +// implementation 'com.blankj:utilcode:1.13.5' } diff --git a/app/src/main/res_core/values/strings.xml b/app/src/main/res_core/values/strings.xml index b91c37f5..a02fcc9c 100644 --- a/app/src/main/res_core/values/strings.xml +++ b/app/src/main/res_core/values/strings.xml @@ -133,6 +133,7 @@ Src + Add Color Scale Clip Skew diff --git a/build.gradle b/build.gradle index 2ec8e312..4569fdf5 100644 --- a/build.gradle +++ b/build.gradle @@ -34,8 +34,8 @@ ext { min_sdk_version = 14 target_sdk_version = 26 - version_code = 1_013_004 - version_name = '1.13.4'// E.g 1.9.72 => 1,009,072 + version_code = 1_013_005 + version_name = '1.13.5'// E.g 1.9.72 => 1,009,072 // App dependencies support_version = '26.1.0' diff --git a/update_log.md b/update_log.md index 041ba638..5b2f6016 100644 --- a/update_log.md +++ b/update_log.md @@ -1,3 +1,4 @@ +* 18/03/20 修复 PermissionUtils 子进程的问题 * 18/03/16 新增 gradle 插件来格式化 README * 18/03/14 修复 KeyboardUtils#getContentViewInvisibleHeight,发布 1.13.4 版本 * 18/03/10 完善 Utils#installAppSilent 和 DeviceUtils#getMacAddress,发布 1.13.3 版本 diff --git a/utilcode/README-CN.md b/utilcode/README-CN.md index 0e564668..8987879b 100644 --- a/utilcode/README-CN.md +++ b/utilcode/README-CN.md @@ -2,7 +2,7 @@ Gradle: ```groovy -compile 'com.blankj:utilcode:1.13.4' +compile 'com.blankj:utilcode:1.13.5' ``` diff --git a/utilcode/README.md b/utilcode/README.md index e02e3588..ac07d8d4 100644 --- a/utilcode/README.md +++ b/utilcode/README.md @@ -2,7 +2,7 @@ Gradle: ```groovy -compile 'com.blankj:utilcode:1.13.4' +compile 'com.blankj:utilcode:1.13.5' ``` diff --git a/utilcode/src/main/AndroidManifest.xml b/utilcode/src/main/AndroidManifest.xml index 8eacc347..dada788f 100644 --- a/utilcode/src/main/AndroidManifest.xml +++ b/utilcode/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ diff --git a/utilcode/src/main/java/com/blankj/utilcode/util/ImageUtils.java b/utilcode/src/main/java/com/blankj/utilcode/util/ImageUtils.java index 3c24c63e..ded23770 100644 --- a/utilcode/src/main/java/com/blankj/utilcode/util/ImageUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/util/ImageUtils.java @@ -32,6 +32,7 @@ import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.FloatRange; import android.support.annotation.IntRange; +import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; import android.view.View; @@ -358,6 +359,35 @@ public final class ImageUtils { return BitmapFactory.decodeFileDescriptor(fd, null, options); } + /** + * Return the bitmap with the specified color. + * + * @param src The source of bitmap. + * @param color The color. + * @return the bitmap with the specified color + */ + public static Bitmap drawColor(@NonNull final Bitmap src, @ColorInt final int color) { + return drawColor(src, color, false); + } + + /** + * Return the bitmap with the specified color. + * + * @param src The source of bitmap. + * @param color The color. + * @param recycle True to recycle the source of bitmap, false otherwise. + * @return the bitmap with the specified color + */ + public static Bitmap drawColor(@NonNull final Bitmap src, + @ColorInt final int color, + final boolean recycle) { + if (isEmptyBitmap(src)) return null; + Bitmap ret = recycle ? src : src.copy(src.getConfig(), true); + Canvas canvas = new Canvas(ret); + canvas.drawColor(color, PorterDuff.Mode.DARKEN); + return ret; + } + /** * Return the scaled bitmap. * diff --git a/utilcode/src/main/java/com/blankj/utilcode/util/PermissionUtils.java b/utilcode/src/main/java/com/blankj/utilcode/util/PermissionUtils.java index 7f5c3aa6..6f06b45e 100755 --- a/utilcode/src/main/java/com/blankj/utilcode/util/PermissionUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/util/PermissionUtils.java @@ -298,7 +298,10 @@ public final class PermissionUtils { } if (sInstance.mPermissionsRequest != null) { int size = sInstance.mPermissionsRequest.size(); - if (size <= 0) return; + if (size <= 0) { + finish(); + return; + } requestPermissions(sInstance.mPermissionsRequest.toArray(new String[size]), 1); } } -- GitLab