Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiaoxuan_i809
AndroidUtilCode
提交
4eee99fa
A
AndroidUtilCode
项目概览
xiaoxuan_i809
/
AndroidUtilCode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AndroidUtilCode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4eee99fa
编写于
4月 02, 2020
作者:
B
Blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 04/02 log
上级
5f588ea0
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
68 addition
and
84 deletion
+68
-84
.github/workflows/android.yml
.github/workflows/android.yml
+1
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
buildSrc/src/main/groovy/Config.groovy
buildSrc/src/main/groovy/Config.groovy
+1
-1
lib/utilcode/README-CN.md
lib/utilcode/README-CN.md
+2
-2
lib/utilcode/README.md
lib/utilcode/README.md
+2
-2
lib/utilcode/src/main/java/com/blankj/utilcode/util/ActivityUtils.java
...src/main/java/com/blankj/utilcode/util/ActivityUtils.java
+30
-38
lib/utilcode/src/main/java/com/blankj/utilcode/util/AppUtils.java
...code/src/main/java/com/blankj/utilcode/util/AppUtils.java
+1
-7
lib/utilcode/src/main/java/com/blankj/utilcode/util/PathUtils.java
...ode/src/main/java/com/blankj/utilcode/util/PathUtils.java
+25
-25
lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsActivityLifecycleImpl.java
.../com/blankj/utilcode/util/UtilsActivityLifecycleImpl.java
+1
-8
lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsBridge.java
...e/src/main/java/com/blankj/utilcode/util/UtilsBridge.java
+4
-0
未找到文件。
.github/workflows/android.yml
浏览文件 @
4eee99fa
...
...
@@ -14,4 +14,4 @@ jobs:
with
:
java-version
:
1.8
-
name
:
Build with Gradle
run
:
./gradlew aR
run
:
./gradlew aR
-x :lib:lib_utilcode:verifyReleaseResources
CHANGELOG.md
浏览文件 @
4eee99fa
*
`20/04/02`
[fix] PathUtils sdcard enable state is wrong; ActivityUtils finish activity wrong; Publish v1.27.1.
*
`20/03/31`
[add] Publish v1.27.0.
*
`20/03/30`
[add] BatteryUtils in subutil.
*
`20/03/27`
[add] publish.gradle.
...
...
buildSrc/src/main/groovy/Config.groovy
浏览文件 @
4eee99fa
...
...
@@ -15,7 +15,7 @@ class Config {
static
minSdkVersion
=
14
static
targetSdkVersion
=
29
static
versionCode
=
1
_026_001
static
versionName
=
'1.27.
0
'
// E.g. 1.9.72 => 1,009,072
static
versionName
=
'1.27.
1
'
// E.g. 1.9.72 => 1,009,072
// lib version
static
gradlePluginVersion
=
'3.5.0'
...
...
lib/utilcode/README-CN.md
浏览文件 @
4eee99fa
...
...
@@ -2,10 +2,10 @@
Gradle:
```
groovy
implementation
'com.blankj:utilcode:1.27.
0
'
implementation
'com.blankj:utilcode:1.27.
1
'
// if u use AndroidX, use the following
implementation
'com.blankj:utilcodex:1.27.
0
'
implementation
'com.blankj:utilcodex:1.27.
1
'
```
...
...
lib/utilcode/README.md
浏览文件 @
4eee99fa
...
...
@@ -2,10 +2,10 @@
Gradle:
```
groovy
implementation
'com.blankj:utilcode:1.27.
0
'
implementation
'com.blankj:utilcode:1.27.
1
'
// if u use AndroidX, use the following
implementation
'com.blankj:utilcodex:1.27.
0
'
implementation
'com.blankj:utilcodex:1.27.
1
'
```
...
...
lib/utilcode/src/main/java/com/blankj/utilcode/util/ActivityUtils.java
浏览文件 @
4eee99fa
...
...
@@ -1645,15 +1645,14 @@ public final class ActivityUtils {
final
boolean
isIncludeSelf
,
final
boolean
isLoadAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
Activity
aActivity
=
activities
.
get
(
i
);
if
(
aActivity
.
equals
(
activity
))
{
for
(
Activity
act
:
activities
)
{
if
(
act
.
equals
(
activity
))
{
if
(
isIncludeSelf
)
{
finishActivity
(
a
Activity
,
isLoadAnim
);
finishActivity
(
a
ct
,
isLoadAnim
);
}
return
true
;
}
finishActivity
(
a
Activity
,
isLoadAnim
);
finishActivity
(
a
ct
,
isLoadAnim
);
}
return
false
;
}
...
...
@@ -1673,15 +1672,14 @@ public final class ActivityUtils {
@AnimRes
final
int
enterAnim
,
@AnimRes
final
int
exitAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
Activity
aActivity
=
activities
.
get
(
i
);
if
(
aActivity
.
equals
(
activity
))
{
for
(
Activity
act
:
activities
)
{
if
(
act
.
equals
(
activity
))
{
if
(
isIncludeSelf
)
{
finishActivity
(
a
Activity
,
enterAnim
,
exitAnim
);
finishActivity
(
a
ct
,
enterAnim
,
exitAnim
);
}
return
true
;
}
finishActivity
(
a
Activity
,
enterAnim
,
exitAnim
);
finishActivity
(
a
ct
,
enterAnim
,
exitAnim
);
}
return
false
;
}
...
...
@@ -1708,15 +1706,14 @@ public final class ActivityUtils {
final
boolean
isIncludeSelf
,
final
boolean
isLoadAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
Activity
aActivity
=
activities
.
get
(
i
);
if
(
aActivity
.
getClass
().
equals
(
clz
))
{
for
(
Activity
act
:
activities
)
{
if
(
act
.
getClass
().
equals
(
clz
))
{
if
(
isIncludeSelf
)
{
finishActivity
(
a
Activity
,
isLoadAnim
);
finishActivity
(
a
ct
,
isLoadAnim
);
}
return
true
;
}
finishActivity
(
a
Activity
,
isLoadAnim
);
finishActivity
(
a
ct
,
isLoadAnim
);
}
return
false
;
}
...
...
@@ -1736,15 +1733,14 @@ public final class ActivityUtils {
@AnimRes
final
int
enterAnim
,
@AnimRes
final
int
exitAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
Activity
aActivity
=
activities
.
get
(
i
);
if
(
aActivity
.
getClass
().
equals
(
clz
))
{
for
(
Activity
act
:
activities
)
{
if
(
act
.
getClass
().
equals
(
clz
))
{
if
(
isIncludeSelf
)
{
finishActivity
(
a
Activity
,
enterAnim
,
exitAnim
);
finishActivity
(
a
ct
,
enterAnim
,
exitAnim
);
}
return
true
;
}
finishActivity
(
a
Activity
,
enterAnim
,
exitAnim
);
finishActivity
(
a
ct
,
enterAnim
,
exitAnim
);
}
return
false
;
}
...
...
@@ -1768,10 +1764,9 @@ public final class ActivityUtils {
public
static
void
finishOtherActivities
(
@NonNull
final
Class
<?
extends
Activity
>
clz
,
final
boolean
isLoadAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
1
;
i
>=
0
;
i
--)
{
Activity
activity
=
activities
.
get
(
i
);
if
(!
activity
.
getClass
().
equals
(
clz
))
{
finishActivity
(
activity
,
isLoadAnim
);
for
(
Activity
act
:
activities
)
{
if
(!
act
.
getClass
().
equals
(
clz
))
{
finishActivity
(
act
,
isLoadAnim
);
}
}
}
...
...
@@ -1789,10 +1784,9 @@ public final class ActivityUtils {
@AnimRes
final
int
enterAnim
,
@AnimRes
final
int
exitAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
1
;
i
>=
0
;
i
--)
{
Activity
activity
=
activities
.
get
(
i
);
if
(!
activity
.
getClass
().
equals
(
clz
))
{
finishActivity
(
activity
,
enterAnim
,
exitAnim
);
for
(
Activity
act
:
activities
)
{
if
(!
act
.
getClass
().
equals
(
clz
))
{
finishActivity
(
act
,
enterAnim
,
exitAnim
);
}
}
}
...
...
@@ -1811,12 +1805,11 @@ public final class ActivityUtils {
*/
public
static
void
finishAllActivities
(
final
boolean
isLoadAnim
)
{
List
<
Activity
>
activityList
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activityList
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
// remove from top
Activity
activity
=
activityList
.
get
(
i
);
for
(
Activity
act
:
activityList
)
{
// sActivityList remove the index activity at onActivityDestroyed
act
ivity
.
finish
();
act
.
finish
();
if
(!
isLoadAnim
)
{
act
ivity
.
overridePendingTransition
(
0
,
0
);
act
.
overridePendingTransition
(
0
,
0
);
}
}
}
...
...
@@ -1832,11 +1825,10 @@ public final class ActivityUtils {
public
static
void
finishAllActivities
(
@AnimRes
final
int
enterAnim
,
@AnimRes
final
int
exitAnim
)
{
List
<
Activity
>
activityList
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activityList
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
// remove from top
Activity
activity
=
activityList
.
get
(
i
);
for
(
Activity
act
:
activityList
)
{
// sActivityList remove the index activity at onActivityDestroyed
act
ivity
.
finish
();
act
ivity
.
overridePendingTransition
(
enterAnim
,
exitAnim
);
act
.
finish
();
act
.
overridePendingTransition
(
enterAnim
,
exitAnim
);
}
}
...
...
@@ -1854,7 +1846,7 @@ public final class ActivityUtils {
*/
public
static
void
finishAllActivitiesExceptNewest
(
final
boolean
isLoadAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
2
;
i
>=
0
;
i
--
)
{
for
(
int
i
=
1
;
i
<
activities
.
size
()
-
1
;
i
++
)
{
finishActivity
(
activities
.
get
(
i
),
isLoadAnim
);
}
}
...
...
@@ -1870,7 +1862,7 @@ public final class ActivityUtils {
public
static
void
finishAllActivitiesExceptNewest
(
@AnimRes
final
int
enterAnim
,
@AnimRes
final
int
exitAnim
)
{
List
<
Activity
>
activities
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activities
.
size
()
-
2
;
i
>=
0
;
i
--
)
{
for
(
int
i
=
1
;
i
<
activities
.
size
()
-
1
;
i
++
)
{
finishActivity
(
activities
.
get
(
i
),
enterAnim
,
exitAnim
);
}
}
...
...
lib/utilcode/src/main/java/com/blankj/utilcode/util/AppUtils.java
浏览文件 @
4eee99fa
package
com.blankj.utilcode.util
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.ActivityManager
;
import
android.content.Context
;
import
android.content.Intent
;
...
...
@@ -294,12 +293,7 @@ public final class AppUtils {
* Exit the application.
*/
public
static
void
exitApp
()
{
List
<
Activity
>
activityList
=
UtilsBridge
.
getActivityList
();
for
(
int
i
=
activityList
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
// remove from top
Activity
activity
=
activityList
.
get
(
i
);
// sActivityList remove the index activity at onActivityDestroyed
activity
.
finish
();
}
UtilsBridge
.
finishAllActivities
();
System
.
exit
(
0
);
}
...
...
lib/utilcode/src/main/java/com/blankj/utilcode/util/PathUtils.java
浏览文件 @
4eee99fa
...
...
@@ -134,7 +134,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0
*/
public
static
String
getExternalStoragePath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStorageDirectory
());
}
...
...
@@ -144,7 +144,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Music
*/
public
static
String
getExternalMusicPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MUSIC
));
}
...
...
@@ -154,7 +154,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Podcasts
*/
public
static
String
getExternalPodcastsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PODCASTS
));
}
...
...
@@ -164,7 +164,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Ringtones
*/
public
static
String
getExternalRingtonesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_RINGTONES
));
}
...
...
@@ -174,7 +174,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Alarms
*/
public
static
String
getExternalAlarmsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_ALARMS
));
}
...
...
@@ -184,7 +184,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Notifications
*/
public
static
String
getExternalNotificationsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_NOTIFICATIONS
));
}
...
...
@@ -194,7 +194,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Pictures
*/
public
static
String
getExternalPicturesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PICTURES
));
}
...
...
@@ -204,7 +204,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Movies
*/
public
static
String
getExternalMoviesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MOVIES
));
}
...
...
@@ -214,7 +214,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Download
*/
public
static
String
getExternalDownloadsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOWNLOADS
));
}
...
...
@@ -224,7 +224,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/DCIM
*/
public
static
String
getExternalDcimPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DCIM
));
}
...
...
@@ -234,7 +234,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Documents
*/
public
static
String
getExternalDocumentsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
getAbsolutePath
(
Environment
.
getExternalStorageDirectory
())
+
"/Documents"
;
}
...
...
@@ -247,7 +247,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package
*/
public
static
String
getExternalAppDataPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
File
externalCacheDir
=
Utils
.
getApp
().
getExternalCacheDir
();
if
(
externalCacheDir
==
null
)
return
""
;
return
getAbsolutePath
(
externalCacheDir
.
getParentFile
());
...
...
@@ -259,7 +259,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/cache
*/
public
static
String
getExternalAppCachePath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalCacheDir
());
}
...
...
@@ -269,7 +269,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files
*/
public
static
String
getExternalAppFilesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
null
));
}
...
...
@@ -279,7 +279,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Music
*/
public
static
String
getExternalAppMusicPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_MUSIC
));
}
...
...
@@ -289,7 +289,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Podcasts
*/
public
static
String
getExternalAppPodcastsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PODCASTS
));
}
...
...
@@ -299,7 +299,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Ringtones
*/
public
static
String
getExternalAppRingtonesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_RINGTONES
));
}
...
...
@@ -309,7 +309,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Alarms
*/
public
static
String
getExternalAppAlarmsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_ALARMS
));
}
...
...
@@ -319,7 +319,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Notifications
*/
public
static
String
getExternalAppNotificationsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_NOTIFICATIONS
));
}
...
...
@@ -329,7 +329,7 @@ public class PathUtils {
* @return path of /storage/emulated/0/Android/data/package/files/Pictures
*/
public
static
String
getExternalAppPicturesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PICTURES
));
}
...
...
@@ -339,7 +339,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Movies
*/
public
static
String
getExternalAppMoviesPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_MOVIES
));
}
...
...
@@ -349,7 +349,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Download
*/
public
static
String
getExternalAppDownloadPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
));
}
...
...
@@ -359,7 +359,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/DCIM
*/
public
static
String
getExternalAppDcimPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DCIM
));
}
...
...
@@ -369,7 +369,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/data/package/files/Documents
*/
public
static
String
getExternalAppDocumentsPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
getAbsolutePath
(
Utils
.
getApp
().
getExternalFilesDir
(
null
))
+
"/Documents"
;
}
...
...
@@ -382,7 +382,7 @@ public class PathUtils {
* @return the path of /storage/emulated/0/Android/obb/package
*/
public
static
String
getExternalAppObbPath
()
{
if
(
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
if
(
!
UtilsBridge
.
isSDCardEnableByEnvironment
())
return
""
;
return
getAbsolutePath
(
Utils
.
getApp
().
getObbDir
());
}
...
...
lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsActivityLifecycleImpl.java
浏览文件 @
4eee99fa
...
...
@@ -6,8 +6,6 @@ import android.app.Application;
import
android.arch.lifecycle.Lifecycle
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
android.view.Window
;
import
android.view.WindowManager
;
...
...
@@ -133,15 +131,10 @@ final class UtilsActivityLifecycleImpl implements Application.ActivityLifecycleC
// lifecycle start
///////////////////////////////////////////////////////////////////////////
@Override
public
void
onActivity
PreCreated
(
@NonNull
Activity
activity
,
@Nullable
Bundle
savedInstanceState
)
{
public
void
onActivity
Created
(
@NotNull
Activity
activity
,
Bundle
savedInstanceState
)
{
UtilsBridge
.
applyLanguage
(
activity
);
setAnimatorsEnabled
();
setTopActivity
(
activity
);
}
@Override
public
void
onActivityCreated
(
@NotNull
Activity
activity
,
Bundle
savedInstanceState
)
{
setTopActivity
(
activity
);
consumeActivityLifecycleCallbacks
(
activity
,
Lifecycle
.
Event
.
ON_CREATE
);
}
...
...
lib/utilcode/src/main/java/com/blankj/utilcode/util/UtilsBridge.java
浏览文件 @
4eee99fa
...
...
@@ -95,6 +95,10 @@ class UtilsBridge {
ActivityUtils
.
startHomeActivity
();
}
static
void
finishAllActivities
()
{
ActivityUtils
.
finishAllActivities
();
}
///////////////////////////////////////////////////////////////////////////
// AppUtils
///////////////////////////////////////////////////////////////////////////
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录