File tree 15 files changed +796
-181
lines changed
java/com/blankj/androidutilcode/feature/core
src/main/java/com/blankj/utilcode/util
15 files changed +796
-181
lines changed Original file line number Diff line number Diff line change 41
41
42
42
[ logo ] : https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
43
43
44
- [ aucsvg ] : https://img.shields.io/badge/AndroidUtilCode-v1.16.0 -brightgreen.svg
44
+ [ aucsvg ] : https://img.shields.io/badge/AndroidUtilCode-v1.16.1 -brightgreen.svg
45
45
[ auc ] : https://github.com/Blankj/AndroidUtilCode
46
46
47
47
[ apisvg ] : https://img.shields.io/badge/API-14+-brightgreen.svg
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
41
41
42
42
[ logo ] : https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
43
43
44
- [ aucsvg ] : https://img.shields.io/badge/AndroidUtilCode-v1.16.0 -brightgreen.svg
44
+ [ aucsvg ] : https://img.shields.io/badge/AndroidUtilCode-v1.16.1 -brightgreen.svg
45
45
[ auc ] : https://github.com/Blankj/AndroidUtilCode
46
46
47
47
[ apisvg ] : https://img.shields.io/badge/API-14+-brightgreen.svg
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ android {
47
47
48
48
dependencies {
49
49
implementation fileTree(include : [' *.jar' ], dir : ' libs' )
50
- // implementation project(':utilcode')
50
+ implementation project(' :utilcode' )
51
51
implementation project(' :subutil' )
52
52
53
53
implementation " com.android.support:appcompat-v7:$support_version "
@@ -56,7 +56,7 @@ dependencies {
56
56
// LeakCanary
57
57
debugImplementation " com.squareup.leakcanary:leakcanary-android:$leakcanary_version "
58
58
releaseImplementation " com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version "
59
- implementation ' com.blankj:utilcode:1.16.0 '
59
+ // implementation 'com.blankj:utilcode:1.16.1 '
60
60
}
61
61
62
62
Original file line number Diff line number Diff line change 53
53
android : theme =" @style/AppTheme" >
54
54
<activity
55
55
android : name =" .MainActivity"
56
- android : launchMode = " singleTop "
56
+ android : screenOrientation = " user "
57
57
android : windowSoftInputMode =" stateHidden|adjustPan" >
58
58
<intent-filter >
59
59
<action android : name =" android.intent.action.MAIN" />
Original file line number Diff line number Diff line change 16
16
import com .blankj .utilcode .util .LogUtils ;
17
17
import com .blankj .utilcode .util .SpanUtils ;
18
18
import com .blankj .utilcode .util .ToastUtils ;
19
+ import com .blankj .utilcode .util .Utils ;
19
20
20
21
/**
21
22
* <pre>
@@ -42,7 +43,17 @@ public static void start(Context context) {
42
43
43
44
@ Override
44
45
public void initData (@ Nullable Bundle bundle ) {
46
+ AppUtils .registerAppStatusChangedListener (this , new Utils .OnAppStatusChangedListener () {
47
+ @ Override
48
+ public void onForeground () {
49
+ ToastUtils .showShort ("foreground" );
50
+ }
45
51
52
+ @ Override
53
+ public void onBackground () {
54
+ ToastUtils .showShort ("background" );
55
+ }
56
+ });
46
57
}
47
58
48
59
@ Override
@@ -147,4 +158,10 @@ public void onPermissionGranted() {
147
158
break ;
148
159
}
149
160
}
161
+
162
+ @ Override
163
+ protected void onDestroy () {
164
+ AppUtils .unregisterAppStatusChangedListener (this );
165
+ super .onDestroy ();
166
+ }
150
167
}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public void onWidgetClick(View view) {
82
82
PermissionUtils .launchAppDetailsSettings ();
83
83
break ;
84
84
case R .id .btn_request_calendar :
85
- PermissionUtils .permission (PermissionConstants .CALENDAR )
85
+ PermissionUtils .permission (PermissionConstants .PHONE , PermissionConstants . STORAGE )
86
86
.rationale (new PermissionUtils .OnRationaleListener () {
87
87
@ Override
88
88
public void rationale (final ShouldRequest shouldRequest ) {
Original file line number Diff line number Diff line change 24
24
<item name =" android:textAllCaps" >false</item >
25
25
</style >
26
26
27
- <style name =" AnimationActivity" parent =" @android:style/Animation.Activity " >
27
+ <style name =" AnimationActivity" parent =" @android:style/Animation.Translucent " >
28
28
<item name =" android:activityOpenEnterAnimation" >@anim/slide_in_left</item >
29
29
<item name =" android:activityOpenExitAnimation" >@anim/slide_out_left</item >
30
30
<item name =" android:activityCloseEnterAnimation" >@anim/slide_in_right</item >
Original file line number Diff line number Diff line change 44
44
min_sdk_version = 14
45
45
target_sdk_version = 27
46
46
47
- version_code = 1_016_000
48
- version_name = ' 1.16.0 ' // E.g 1.9.72 => 1,009,072
47
+ version_code = 1_016_001
48
+ version_name = ' 1.16.1 ' // E.g 1.9.72 => 1,009,072
49
49
50
50
// App dependencies
51
51
support_version = ' 27.1.0'
Original file line number Diff line number Diff line change
1
+ * 18/05/25 新增 AppUtils#registerAppStatusChangedListener 和 AppUtils#unregisterAppStatusChangedListener,发布 1.16.1 版本
1
2
* 18/05/22 新增 ThreadUtils,发布 1.16.0 版本
2
3
* 18/05/15 新增 MetaDataUtils 和 ActivityUtils#startActivityForResult,发布 1.15.1 版本
3
4
* 18/05/08 新增 ResourceUtils,发布 1.15.0 版本
Original file line number Diff line number Diff line change 2
2
3
3
Gradle:
4
4
``` groovy
5
- implementation 'com.blankj:utilcode:1.16.0 '
5
+ implementation 'com.blankj:utilcode:1.16.1 '
6
6
```
7
7
8
8
@@ -624,6 +624,7 @@ toSBC : 转化为全角字符
624
624
isMainThread : 判断当前是否主线程
625
625
getFixedPool : 获取固定线程池
626
626
getSinglePool : 获取单线程池
627
+ getCachedPool : 获取缓冲线程池
627
628
getIoPool : 获取 IO 线程池
628
629
getCpuPool : 获取 CPU 线程池
629
630
executeByFixed : 在固定线程池执行任务
@@ -632,6 +633,9 @@ executeByFixedAtFixRate : 在固定线程池按固定频率执行任务
632
633
executeBySingle : 在单线程池执行任务
633
634
executeBySingleWithDelay: 在单线程池延时执行任务
634
635
executeBySingleAtFixRate: 在单线程池按固定频率执行任务
636
+ executeByCached : 在缓冲线程池执行任务
637
+ executeByCachedWithDelay: 在缓冲线程池延时执行任务
638
+ executeByCachedAtFixRate: 在缓冲线程池按固定频率执行任务
635
639
executeByIo : 在 IO 线程池执行任务
636
640
executeByIoWithDelay : 在 IO 线程池延时执行任务
637
641
executeByIoAtFixRate : 在 IO 线程池按固定频率执行任务
Original file line number Diff line number Diff line change 2
2
3
3
Gradle:
4
4
``` groovy
5
- implementation 'com.blankj:utilcode:1.16.0 '
5
+ implementation 'com.blankj:utilcode:1.16.1 '
6
6
```
7
7
8
8
@@ -624,6 +624,7 @@ toSBC
624
624
isMainThread
625
625
getFixedPool
626
626
getSinglePool
627
+ getCachedPool
627
628
getIoPool
628
629
getCpuPool
629
630
executeByFixed
@@ -632,6 +633,9 @@ executeByFixedAtFixRate
632
633
executeBySingle
633
634
executeBySingleWithDelay
634
635
executeBySingleAtFixRate
636
+ executeByCached
637
+ executeByCachedWithDelay
638
+ executeByCachedAtFixRate
635
639
executeByIo
636
640
executeByIoWithDelay
637
641
executeByIoAtFixRate
Original file line number Diff line number Diff line change @@ -1048,7 +1048,7 @@ public static String getLauncherActivity(@NonNull final String pkg) {
1048
1048
* @return the top activity in activity's stack
1049
1049
*/
1050
1050
public static Activity getTopActivity () {
1051
- return Utils .getTopActivity ();
1051
+ return Utils .getActivityLifecycle (). getTopActivity ();
1052
1052
}
1053
1053
1054
1054
/**
You can’t perform that action at this time.
0 commit comments