Skip to content

Commit 2a5c5e4

Browse files
committed
see 04/23 log
1 parent 6024e7a commit 2a5c5e4

File tree

17 files changed

+78
-33
lines changed

17 files changed

+78
-33
lines changed

README-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.16-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.14.0-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

4747
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.13.16-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.14.0-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

4747
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ dependencies {
5757
// LeakCanary
5858
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
5959
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
60-
// implementation 'com.blankj:utilcode:1.13.15'
60+
// implementation 'com.blankj:utilcode:1.14.0'
6161
}
6262

6363

app/src/main/java/com/blankj/androidutilcode/feature/core/CoreUtilActivity.java

-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.blankj.androidutilcode.feature.core.activity.ActivityActivity;
1212
import com.blankj.androidutilcode.feature.core.app.AppActivity;
1313
import com.blankj.androidutilcode.feature.core.bar.BarActivity;
14-
import com.blankj.androidutilcode.feature.core.clean.CleanActivity;
1514
import com.blankj.androidutilcode.feature.core.device.DeviceActivity;
1615
import com.blankj.androidutilcode.feature.core.fragment.FragmentActivity;
1716
import com.blankj.androidutilcode.feature.core.image.ImageActivity;
@@ -85,10 +84,6 @@ public void barClick(View view) {
8584
BarActivity.start(this);
8685
}
8786

88-
public void cleanClick(View view) {
89-
CleanActivity.start(this);
90-
}
91-
9287
public void crashClick(View view) {
9388
throw new NullPointerException("crash test");
9489
}

app/src/main/java/com/blankj/androidutilcode/feature/core/sdcard/SDCardActivity.java

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public void initView(Bundle savedInstanceState, View contentView) {
4343

4444
TextView tvAboutSdcard = findViewById(R.id.tv_about_sdcard);
4545
tvAboutSdcard.setText(new SpanUtils()
46+
.appendLine("isSDCardEnableByEnvironment: " + SDCardUtils.isSDCardEnableByEnvironment())
47+
.appendLine("getSDCardPathByEnvironment: " + SDCardUtils.getSDCardPathByEnvironment())
4648
.appendLine("isSDCardEnable: " + SDCardUtils.isSDCardEnable())
4749
.appendLine("getSDCardPaths: " + SDCardUtils.getSDCardPaths())
4850
.appendLine("getInnerSDCardPaths: " + SDCardUtils.getSDCardPaths(true))

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ ext {
3333
min_sdk_version = 14
3434
target_sdk_version = 27
3535

36-
version_code = 1_013_016
37-
version_name = '1.13.16'// E.g 1.9.72 => 1,009,072
36+
version_code = 1_014_000
37+
version_name = '1.14.0'// E.g 1.9.72 => 1,009,072
3838

3939
// App dependencies
4040
support_version = '27.1.0'

update_log.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* 18/04/24 修复多 FileProvider 带来的问题,发布 1.14.0 版本
12
* 18/04/23 新增 RSA 加解密,发布 1.13.16 版本
23
* 18/04/22 新增 LogUtils 设置栈偏移
34
* 18/04/21 新增 AppUtils#relaunchApp、DeviceUtils#getABIs,发布 1.13.15 版本

utilcode/README-CN.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gradle:
44
```groovy
5-
implementation 'com.blankj:utilcode:1.13.16'
5+
implementation 'com.blankj:utilcode:1.14.0'
66
```
77

88

@@ -16,11 +16,7 @@ Utils.init(application);
1616

1717
## Proguard
1818

19-
```
20-
-keep class com.blankj.utilcode.** { *; }
21-
-keepclassmembers class com.blankj.utilcode.** { *; }
22-
-dontwarn com.blankj.utilcode.**
23-
```
19+
U needn't do anything, because I add `consumerProguardFiles 'proguard-rules.pro'` in build.gradle.
2420

2521

2622
## APIs
@@ -493,8 +489,10 @@ isTablet : 判断是否是平板
493489

494490
* ### SD 卡相关 -> [SDCardUtils.java][sdcard.java] -> [Demo][sdcard.demo]
495491
```
496-
isSDCardEnable: 判断 SD 卡是否可用
497-
getSDCardPaths: 获取 SD 卡路径
492+
isSDCardEnableByEnvironment: 根据 Environment 判断 SD 卡是否可用
493+
getSDCardPathByEnvironment : 根据 Environment 获取 SD 卡路径
494+
isSDCardEnable : 判断 SD 卡是否可用
495+
getSDCardPaths : 获取 SD 卡路径
498496
```
499497

500498
* ### 服务相关 -> [ServiceUtils.java][service.java]

utilcode/README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gradle:
44
```groovy
5-
implementation 'com.blankj:utilcode:1.13.16'
5+
implementation 'com.blankj:utilcode:1.14.0'
66
```
77

88

@@ -16,11 +16,7 @@ Utils.init(application);
1616

1717
## Proguard
1818

19-
```
20-
-keep class com.blankj.utilcode.** { *; }
21-
-keepclassmembers class com.blankj.utilcode.** { *; }
22-
-dontwarn com.blankj.utilcode.**
23-
```
19+
U needn't do anything, because I add `consumerProguardFiles 'proguard-rules.pro'` in build.gradle.
2420

2521

2622
## APIs
@@ -493,6 +489,8 @@ isTablet
493489

494490
* ### About SDCard -> [SDCardUtils.java][sdcard.java] -> [Demo][sdcard.demo]
495491
```
492+
isSDCardEnableByEnvironment
493+
getSDCardPathByEnvironment
496494
isSDCardEnable
497495
getSDCardPaths
498496
```

utilcode/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ android {
1212
buildTypes {
1313
release {
1414
minifyEnabled false
15+
consumerProguardFiles 'proguard-rules.pro'
1516
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1617
}
1718
}

utilcode/proguard-rules.pro

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
# class:
1515
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1616
# public *;
17-
#}
17+
#}
18+
19+
-keep class com.blankj.utilcode.** { *; }
20+
-keepclassmembers class com.blankj.utilcode.** { *; }
21+
-dontwarn com.blankj.utilcode.**

utilcode/src/main/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" />
1111

1212
<provider
13-
android:name="android.support.v4.content.FileProvider"
13+
android:name="android.support.v4.content.FileProvider4Util"
1414
android:authorities="${applicationId}.utilcode.provider"
1515
android:exported="false"
1616
android:grantUriPermissions="true">
1717
<meta-data
1818
android:name="android.support.FILE_PROVIDER_PATHS"
19-
android:resource="@xml/provider_paths" />
19+
android:resource="@xml/util_code_provider_paths" />
2020
</provider>
2121
</application>
2222
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package android.support.v4.content;
2+
3+
/**
4+
* <pre>
5+
* author: Blankj
6+
* blog : http://blankj.com
7+
* time : 2018/04/23
8+
* desc :
9+
* </pre>
10+
*/
11+
public final class FileProvider4Util extends FileProvider {
12+
}

utilcode/src/main/java/com/blankj/utilcode/util/FragmentUtils.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import android.support.v4.app.Fragment;
1212
import android.support.v4.app.FragmentManager;
1313
import android.support.v4.app.FragmentTransaction;
14-
import android.support.v4.view.ViewCompat;
1514
import android.util.Log;
1615
import android.view.View;
1716

@@ -1170,7 +1169,13 @@ public static void setBackgroundResource(@NonNull final Fragment fragment,
11701169
* @param background The background.
11711170
*/
11721171
public static void setBackground(@NonNull final Fragment fragment, final Drawable background) {
1173-
ViewCompat.setBackground(fragment.getView(), background);
1172+
View view = fragment.getView();
1173+
if (view == null) return;
1174+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
1175+
view.setBackground(background);
1176+
} else {
1177+
view.setBackgroundDrawable(background);
1178+
}
11741179
}
11751180

11761181
/**

utilcode/src/main/java/com/blankj/utilcode/util/SDCardUtils.java

+22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.blankj.utilcode.util;
22

33
import android.content.Context;
4+
import android.os.Environment;
45
import android.os.storage.StorageManager;
56

67
import java.lang.reflect.Array;
@@ -24,6 +25,27 @@ private SDCardUtils() {
2425
throw new UnsupportedOperationException("u can't instantiate me...");
2526
}
2627

28+
/**
29+
* Return whether sdcard is enabled by environment.
30+
*
31+
* @return true : enabled<br>false : disabled
32+
*/
33+
public static boolean isSDCardEnableByEnvironment() {
34+
return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
35+
}
36+
37+
/**
38+
* Return the path of sdcard by environment.
39+
*
40+
* @return the path of sdcard by environment
41+
*/
42+
public static String getSDCardPathByEnvironment() {
43+
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
44+
return Environment.getExternalStorageDirectory().getAbsolutePath();
45+
}
46+
return null;
47+
}
48+
2749
/**
2850
* Return whether sdcard is enabled.
2951
*

utilcode/src/main/java/com/blankj/utilcode/util/ToastUtils.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
import android.graphics.PorterDuffColorFilter;
77
import android.graphics.drawable.ColorDrawable;
88
import android.graphics.drawable.Drawable;
9+
import android.os.Build;
910
import android.os.Handler;
1011
import android.os.Looper;
1112
import android.support.annotation.ColorInt;
1213
import android.support.annotation.DrawableRes;
1314
import android.support.annotation.LayoutRes;
1415
import android.support.annotation.NonNull;
1516
import android.support.annotation.StringRes;
16-
import android.support.v4.view.ViewCompat;
17-
import android.support.v4.widget.TextViewCompat;
1817
import android.view.LayoutInflater;
1918
import android.view.View;
2019
import android.widget.TextView;
@@ -244,7 +243,11 @@ public void run() {
244243
final TextView tvMessage = toast.getView().findViewById(android.R.id.message);
245244
int msgColor = tvMessage.getCurrentTextColor();
246245
//it solve the font of toast
247-
TextViewCompat.setTextAppearance(tvMessage, android.R.style.TextAppearance);
246+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
247+
tvMessage.setTextAppearance(android.R.style.TextAppearance);
248+
} else {
249+
tvMessage.setTextAppearance(tvMessage.getContext(), android.R.style.TextAppearance);
250+
}
248251
if (sMsgColor != COLOR_DEFAULT) {
249252
tvMessage.setTextColor(sMsgColor);
250253
} else {
@@ -292,7 +295,11 @@ private static void setBg(final Toast toast) {
292295
new PorterDuffColorFilter(sBgColor, PorterDuff.Mode.SRC_IN)
293296
);
294297
} else {
295-
ViewCompat.setBackground(toastView, new ColorDrawable(sBgColor));
298+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
299+
toastView.setBackground(new ColorDrawable(sBgColor));
300+
} else {
301+
toastView.setBackgroundDrawable(new ColorDrawable(sBgColor));
302+
}
296303
}
297304
}
298305
}

0 commit comments

Comments
 (0)