提交 2a5c5e4f 编写于 作者: B Blankj

see 04/23 log

上级 6024e7a2
......@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.16-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.14.0-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.13.16-brightgreen.svg
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.14.0-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -57,7 +57,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.15'
// implementation 'com.blankj:utilcode:1.14.0'
}
......@@ -11,7 +11,6 @@ import com.blankj.androidutilcode.base.BaseBackActivity;
import com.blankj.androidutilcode.feature.core.activity.ActivityActivity;
import com.blankj.androidutilcode.feature.core.app.AppActivity;
import com.blankj.androidutilcode.feature.core.bar.BarActivity;
import com.blankj.androidutilcode.feature.core.clean.CleanActivity;
import com.blankj.androidutilcode.feature.core.device.DeviceActivity;
import com.blankj.androidutilcode.feature.core.fragment.FragmentActivity;
import com.blankj.androidutilcode.feature.core.image.ImageActivity;
......@@ -85,10 +84,6 @@ public class CoreUtilActivity extends BaseBackActivity {
BarActivity.start(this);
}
public void cleanClick(View view) {
CleanActivity.start(this);
}
public void crashClick(View view) {
throw new NullPointerException("crash test");
}
......
......@@ -43,6 +43,8 @@ public class SDCardActivity extends BaseBackActivity {
TextView tvAboutSdcard = findViewById(R.id.tv_about_sdcard);
tvAboutSdcard.setText(new SpanUtils()
.appendLine("isSDCardEnableByEnvironment: " + SDCardUtils.isSDCardEnableByEnvironment())
.appendLine("getSDCardPathByEnvironment: " + SDCardUtils.getSDCardPathByEnvironment())
.appendLine("isSDCardEnable: " + SDCardUtils.isSDCardEnable())
.appendLine("getSDCardPaths: " + SDCardUtils.getSDCardPaths())
.appendLine("getInnerSDCardPaths: " + SDCardUtils.getSDCardPaths(true))
......
......@@ -33,8 +33,8 @@ ext {
min_sdk_version = 14
target_sdk_version = 27
version_code = 1_013_016
version_name = '1.13.16'// E.g 1.9.72 => 1,009,072
version_code = 1_014_000
version_name = '1.14.0'// E.g 1.9.72 => 1,009,072
// App dependencies
support_version = '27.1.0'
......
* 18/04/24 修复多 FileProvider 带来的问题,发布 1.14.0 版本
* 18/04/23 新增 RSA 加解密,发布 1.13.16 版本
* 18/04/22 新增 LogUtils 设置栈偏移
* 18/04/21 新增 AppUtils#relaunchApp、DeviceUtils#getABIs,发布 1.13.15 版本
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.13.16'
implementation 'com.blankj:utilcode:1.14.0'
```
......@@ -16,11 +16,7 @@ Utils.init(application);
## Proguard
```
-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**
```
U needn't do anything, because I add `consumerProguardFiles 'proguard-rules.pro'` in build.gradle.
## APIs
......@@ -493,8 +489,10 @@ isTablet : 判断是否是平板
* ### SD 卡相关 -> [SDCardUtils.java][sdcard.java] -> [Demo][sdcard.demo]
```
isSDCardEnable: 判断 SD 卡是否可用
getSDCardPaths: 获取 SD 卡路径
isSDCardEnableByEnvironment: 根据 Environment 判断 SD 卡是否可用
getSDCardPathByEnvironment : 根据 Environment 获取 SD 卡路径
isSDCardEnable : 判断 SD 卡是否可用
getSDCardPaths : 获取 SD 卡路径
```
* ### 服务相关 -> [ServiceUtils.java][service.java]
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.13.16'
implementation 'com.blankj:utilcode:1.14.0'
```
......@@ -16,11 +16,7 @@ Utils.init(application);
## Proguard
```
-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**
```
U needn't do anything, because I add `consumerProguardFiles 'proguard-rules.pro'` in build.gradle.
## APIs
......@@ -493,6 +489,8 @@ isTablet
* ### About SDCard -> [SDCardUtils.java][sdcard.java] -> [Demo][sdcard.demo]
```
isSDCardEnableByEnvironment
getSDCardPathByEnvironment
isSDCardEnable
getSDCardPaths
```
......
......@@ -12,6 +12,7 @@ android {
buildTypes {
release {
minifyEnabled false
consumerProguardFiles 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
......
......@@ -14,4 +14,8 @@
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
\ No newline at end of file
#}
-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**
\ No newline at end of file
......@@ -10,13 +10,13 @@
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" />
<provider
android:name="android.support.v4.content.FileProvider"
android:name="android.support.v4.content.FileProvider4Util"
android:authorities="${applicationId}.utilcode.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
android:resource="@xml/util_code_provider_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package android.support.v4.content;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/04/23
* desc :
* </pre>
*/
public final class FileProvider4Util extends FileProvider {
}
......@@ -11,7 +11,6 @@ import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewCompat;
import android.util.Log;
import android.view.View;
......@@ -1170,7 +1169,13 @@ public final class FragmentUtils {
* @param background The background.
*/
public static void setBackground(@NonNull final Fragment fragment, final Drawable background) {
ViewCompat.setBackground(fragment.getView(), background);
View view = fragment.getView();
if (view == null) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
view.setBackground(background);
} else {
view.setBackgroundDrawable(background);
}
}
/**
......
package com.blankj.utilcode.util;
import android.content.Context;
import android.os.Environment;
import android.os.storage.StorageManager;
import java.lang.reflect.Array;
......@@ -24,6 +25,27 @@ public final class SDCardUtils {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* Return whether sdcard is enabled by environment.
*
* @return true : enabled<br>false : disabled
*/
public static boolean isSDCardEnableByEnvironment() {
return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
}
/**
* Return the path of sdcard by environment.
*
* @return the path of sdcard by environment
*/
public static String getSDCardPathByEnvironment() {
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
return Environment.getExternalStorageDirectory().getAbsolutePath();
}
return null;
}
/**
* Return whether sdcard is enabled.
*
......
......@@ -6,6 +6,7 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.ColorInt;
......@@ -13,8 +14,6 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.TextViewCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
......@@ -244,7 +243,11 @@ public final class ToastUtils {
final TextView tvMessage = toast.getView().findViewById(android.R.id.message);
int msgColor = tvMessage.getCurrentTextColor();
//it solve the font of toast
TextViewCompat.setTextAppearance(tvMessage, android.R.style.TextAppearance);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
tvMessage.setTextAppearance(android.R.style.TextAppearance);
} else {
tvMessage.setTextAppearance(tvMessage.getContext(), android.R.style.TextAppearance);
}
if (sMsgColor != COLOR_DEFAULT) {
tvMessage.setTextColor(sMsgColor);
} else {
......@@ -292,7 +295,11 @@ public final class ToastUtils {
new PorterDuffColorFilter(sBgColor, PorterDuff.Mode.SRC_IN)
);
} else {
ViewCompat.setBackground(toastView, new ColorDrawable(sBgColor));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
toastView.setBackground(new ColorDrawable(sBgColor));
} else {
toastView.setBackgroundDrawable(new ColorDrawable(sBgColor));
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册