提交 07925ad2 编写于 作者: B Blankj

see 08/09 log

上级 205943d3
......@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.18.5-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.18.6-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -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.18.5-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.18.6-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1018005,"versionName":"1.18.5","enabled":true,"outputFile":"util_1_18_5.apk","fullName":"release","baseName":"release"},"path":"util_1_18_5.apk","properties":{}}]
\ No newline at end of file
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1018006,"versionName":"1.18.6","enabled":true,"outputFile":"util_1_18_6.apk","fullName":"release","baseName":"release"},"path":"util_1_18_6.apk","properties":{}}]
\ No newline at end of file
......@@ -63,7 +63,7 @@ public class UtilsApp extends BaseApplication {
.setLogHeadSwitch(true)// 设置 log 头信息开关,默认为开
.setLog2FileSwitch(false)// 打印 log 时是否存到文件的开关,默认关
.setDir("")// 当自定义路径为空时,写入应用的/cache/log/目录中
.setFilePrefix("")// 当文件前缀为空时,默认为"util",即写入文件为"util-MM-dd.txt"
.setFilePrefix("")// 当文件前缀为空时,默认为"util",即写入文件为"util-yyyy-MM-dd.txt"
.setBorderSwitch(true)// 输出日志是否带边框开关,默认开
.setSingleTagSwitch(true)// 一条日志仅输出一条,默认开,为美化 AS 3.1 的 Logcat
.setConsoleFilter(LogUtils.V)// log 的控制台过滤器,和 logcat 过滤器同理,默认 Verbose
......
......@@ -8,6 +8,7 @@ import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.Gravity;
import android.view.View;
import android.widget.Toast;
import com.blankj.androidutilcode.R;
import com.blankj.androidutilcode.base.BaseBackActivity;
......
......@@ -6,8 +6,8 @@ ext {
compileSdkVersion: 27,
minSdkVersion : 14,
targetSdkVersion : 27,
versionCode : 1_018_005,
versionName : '1.18.5'// E.g 1.9.72 => 1,009,072
versionCode : 1_018_006,
versionName : '1.18.6'// E.g 1.9.72 => 1,009,072
]
versionConfig = [
......@@ -167,7 +167,7 @@ def configAppDependencies(Project pro) {
// LeakCanary
debugImplementation depConfig.leakcanary.android
releaseImplementation depConfig.leakcanary.android_no_op
// implementation 'com.blankj:utilcode:1.18.5'
// implementation 'com.blankj:utilcode:1.18.6'
}
}
......
* 18/08/09 新增 IntentUtils#isIntentAvailable,ToastUtils 传入空显示 null,发布 1.18.6
* 18/08/08 修复 ScreenUtils#adaptxx 在第三方 SDK 会出现的问题,发布 1.18.5
* 18/08/07 修复 ScreenUtils#adaptxx 在 API 26 以下无效的 bug,发布 1.18.4
* 18/08/06 修复 ScreenUtils#screenShot 中 decorView.getDrawingCache() 为空的问题,发布 1.18.3
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.18.5'
implementation 'com.blankj:utilcode:1.18.6'
```
......@@ -347,6 +347,7 @@ compressBySampleSize : 按采样大小压缩
* ### 意图相关 -> [IntentUtils.java][intent.java]
```
isIntentAvailable : 判断意图是否可用
getInstallAppIntent : 获取安装 App(支持 6.0)的意图
getUninstallAppIntent : 获取卸载 App 的意图
getLaunchAppIntent : 获取打开 App 的意图
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.18.5'
implementation 'com.blankj:utilcode:1.18.6'
```
......@@ -347,6 +347,7 @@ compressBySampleSize
* ### About Intent -> [IntentUtils.java][intent.java]
```
isIntentAvailable
getInstallAppIntent
getUninstallAppIntent
getLaunchAppIntent
......
......@@ -30,6 +30,16 @@ public final class IntentUtils {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* Return whether the intent is available.
*
* @param intent The intent.
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isIntentAvailable(final Intent intent) {
return Utils.getApp().getPackageManager().queryIntentActivities(intent, 0).size() > 0;
}
/**
* Return the intent of install app.
* <p>Target APIs greater than 25 must hold
......
......@@ -302,6 +302,7 @@ public final class ScreenUtils {
/**
* Adapt the screen for vertical slide.
*
* @param activity The activity.
* @param designWidthInPx The size of design diagram's width, in pixel.
*/
public static void adaptScreen4VerticalSlide(final Activity activity,
......@@ -312,6 +313,7 @@ public final class ScreenUtils {
/**
* Adapt the screen for horizontal slide.
*
* @param activity The activity.
* @param designHeightInPx The size of design diagram's height, in pixel.
*/
public static void adaptScreen4HorizontalSlide(final Activity activity,
......
......@@ -39,6 +39,7 @@ public final class ToastUtils {
private static final int COLOR_DEFAULT = 0xFEFFFFFF;
private static final Handler HANDLER = new Handler(Looper.getMainLooper());
private static final String NULL = "null";
private static Toast sToast;
private static int sGravity = -1;
......@@ -107,8 +108,8 @@ public final class ToastUtils {
*
* @param text The text.
*/
public static void showShort(@NonNull final CharSequence text) {
show(text, Toast.LENGTH_SHORT);
public static void showShort(final CharSequence text) {
show(text == null ? NULL : text, Toast.LENGTH_SHORT);
}
/**
......@@ -127,11 +128,7 @@ public final class ToastUtils {
* @param args The args.
*/
public static void showShort(@StringRes final int resId, final Object... args) {
if (args != null && args.length == 0) {
show(resId, Toast.LENGTH_SHORT);
} else {
show(resId, Toast.LENGTH_SHORT, args);
}
show(resId, Toast.LENGTH_SHORT, args);
}
/**
......@@ -141,11 +138,7 @@ public final class ToastUtils {
* @param args The args.
*/
public static void showShort(final String format, final Object... args) {
if (args != null && args.length == 0) {
show(format, Toast.LENGTH_SHORT);
} else {
show(format, Toast.LENGTH_SHORT, args);
}
show(format, Toast.LENGTH_SHORT, args);
}
/**
......@@ -153,8 +146,8 @@ public final class ToastUtils {
*
* @param text The text.
*/
public static void showLong(@NonNull final CharSequence text) {
show(text, Toast.LENGTH_LONG);
public static void showLong(final CharSequence text) {
show(text == null ? NULL : text, Toast.LENGTH_LONG);
}
/**
......@@ -173,11 +166,7 @@ public final class ToastUtils {
* @param args The args.
*/
public static void showLong(@StringRes final int resId, final Object... args) {
if (args != null && args.length == 0) {
show(resId, Toast.LENGTH_SHORT);
} else {
show(resId, Toast.LENGTH_LONG, args);
}
show(resId, Toast.LENGTH_LONG, args);
}
/**
......@@ -187,11 +176,7 @@ public final class ToastUtils {
* @param args The args.
*/
public static void showLong(final String format, final Object... args) {
if (args != null && args.length == 0) {
show(format, Toast.LENGTH_SHORT);
} else {
show(format, Toast.LENGTH_LONG, args);
}
show(format, Toast.LENGTH_LONG, args);
}
/**
......@@ -234,7 +219,16 @@ public final class ToastUtils {
}
private static void show(final String format, final int duration, final Object... args) {
show(String.format(format, args), duration);
String text;
if (format == null) {
text = NULL;
} else {
text = String.format(format, args);
if (text == null) {
text = NULL;
}
}
show(text, duration);
}
private static void show(final CharSequence text, final int duration) {
......@@ -280,6 +274,7 @@ public final class ToastUtils {
private static void showToast() {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N_MR1) {
try {
//noinspection JavaReflectionMemberAccess
Field field = View.class.getDeclaredField("mContext");
field.setAccessible(true);
field.set(sToast.getView(), new ApplicationContextWrapperForApi25());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册