From 1d45e4a48583ac94b327a640916c43c589507ec7 Mon Sep 17 00:00:00 2001 From: Blankj <625783482@qq.com> Date: Thu, 13 Sep 2018 09:50:11 +0800 Subject: [PATCH] see 09/13 log --- README-CN.md | 2 +- README.md | 2 +- .../core/keyboard/KeyboardActivity.java | 4 ---- config.gradle | 6 ++--- update_log.md | 1 + utilcode/README-CN.md | 2 +- utilcode/README.md | 2 +- .../com/blankj/utilcode/util/ToastUtils.java | 22 ++++++++++++++++--- 8 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README-CN.md b/README-CN.md index 089a1460..0de1d223 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.20.2-brightgreen.svg +[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.20.3-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 4ad3915d..a18da39f 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png -[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.20.2-brightgreen.svg +[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.20.3-brightgreen.svg [auc]: https://github.com/Blankj/AndroidUtilCode [apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg diff --git a/app/src/main/java/com/blankj/androidutilcode/feature/core/keyboard/KeyboardActivity.java b/app/src/main/java/com/blankj/androidutilcode/feature/core/keyboard/KeyboardActivity.java index 55497aa0..c255c1c7 100644 --- a/app/src/main/java/com/blankj/androidutilcode/feature/core/keyboard/KeyboardActivity.java +++ b/app/src/main/java/com/blankj/androidutilcode/feature/core/keyboard/KeyboardActivity.java @@ -2,7 +2,6 @@ package com.blankj.androidutilcode.feature.core.keyboard; import android.content.Context; import android.content.Intent; -import android.graphics.Color; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AlertDialog; @@ -11,12 +10,9 @@ import android.widget.EditText; import android.widget.TextView; import com.blankj.androidutilcode.R; -import com.blankj.androidutilcode.base.BaseActivity; import com.blankj.androidutilcode.base.BaseBackActivity; import com.blankj.androidutilcode.helper.DialogHelper; -import com.blankj.utilcode.util.BarUtils; import com.blankj.utilcode.util.KeyboardUtils; -import com.blankj.utilcode.util.ScreenUtils; import com.blankj.utilcode.util.SpanUtils; /** diff --git a/config.gradle b/config.gradle index 2e930407..fa19194b 100644 --- a/config.gradle +++ b/config.gradle @@ -6,8 +6,8 @@ ext { compileSdkVersion: 27, minSdkVersion : 14, targetSdkVersion : 27, - versionCode : 1_020_002, - versionName : '1.20.2'// E.g. 1.9.72 => 1,009,072 + versionCode : 1_020_003, + versionName : '1.20.3'// E.g. 1.9.72 => 1,009,072 ] versionConfig = [ @@ -172,7 +172,7 @@ def configAppDependencies(Project pro) { // LeakCanary debugImplementation depConfig.leakcanary.android releaseImplementation depConfig.leakcanary.android_no_op -// implementation 'com.blankj:utilcode:1.20.2' +// implementation 'com.blankj:utilcode:1.20.3' } } diff --git a/update_log.md b/update_log.md index d1baa906..134b3131 100644 --- a/update_log.md +++ b/update_log.md @@ -1,3 +1,4 @@ +* `18/09/13` 修复 ToastUtils 在小米手机显示 Toast 带有 App 名,发布 1.20.3 * `18/09/12` 修复 KeyBoardUtils#fixAndroidBug5497,完善 ToastUtils,发布 1.20.2 * `18/09/11` 新增 BarUtils#isSupportNavBar,删除 BarUtils#setNavBarImmersive * `18/09/10` 修复 KeyboardUtils 中 getWindowVisibleDisplayFrame 空指针异常,更新 BarUtils#isNavBarVisible diff --git a/utilcode/README-CN.md b/utilcode/README-CN.md index 2a6f3f6a..9428c94b 100644 --- a/utilcode/README-CN.md +++ b/utilcode/README-CN.md @@ -2,7 +2,7 @@ Gradle: ```groovy -implementation 'com.blankj:utilcode:1.20.2' +implementation 'com.blankj:utilcode:1.20.3' ``` diff --git a/utilcode/README.md b/utilcode/README.md index c6c0f7f7..41c3554f 100644 --- a/utilcode/README.md +++ b/utilcode/README.md @@ -2,7 +2,7 @@ Gradle: ```groovy -implementation 'com.blankj:utilcode:1.20.2' +implementation 'com.blankj:utilcode:1.20.3' ``` diff --git a/utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java b/utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java index 37054257..2f762a6f 100644 --- a/utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java +++ b/utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java @@ -3,6 +3,7 @@ package com.blankj.utilcode.util; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.Configuration; +import android.content.res.Resources; import android.graphics.Color; import android.graphics.PixelFormat; import android.graphics.PorterDuff; @@ -333,13 +334,13 @@ public final class ToastUtils { static IToast makeToast(Context context, CharSequence text, int duration) { if (NotificationManagerCompat.from(context).areNotificationsEnabled()) { - return new SystemToast(Toast.makeText(context, text, duration)); + return new SystemToast(makeNormalToast(context, text, duration)); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) { - return new ToastWithoutNotification(Toast.makeText(context, text, duration)); + return new ToastWithoutNotification(makeNormalToast(context, text, duration)); } Log.e("ToastUtils", "Toast is GG. In fact, next step is useless."); - return new SystemToast(Toast.makeText(context, text, duration)); + return new SystemToast(makeNormalToast(context, text, duration)); } static IToast newToast(Context context) { @@ -352,6 +353,21 @@ public final class ToastUtils { Log.e("ToastUtils", "Toast is GG. In fact, next step is useless."); return new SystemToast(new Toast(context)); } + + private static Toast makeNormalToast(Context context, CharSequence text, int duration) { + if ("Xiaomi".equals(Build.MANUFACTURER)) { + Toast toast = new Toast(context); + int identifier = Resources.getSystem() + .getIdentifier("transient_notification", "layout", "android"); + View view = getView(identifier); + toast.setView(view); + toast.setDuration(duration); + TextView tv = view.findViewById(android.R.id.message); + tv.setText(text); + return toast; + } + return Toast.makeText(context, text, duration); + } } static class SystemToast implements IToast { -- GitLab