Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mmm-rain
AndroidUtilCode
提交
64c72c59
A
AndroidUtilCode
项目概览
mmm-rain
/
AndroidUtilCode
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
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,发现更多精彩内容 >>
提交
64c72c59
编写于
4月 16, 2018
作者:
B
Blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 04/16 log
上级
e51b1e2f
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
364 addition
and
10 deletion
+364
-10
README-CN.md
README-CN.md
+1
-1
README.md
README.md
+1
-1
app/build.gradle
app/build.gradle
+1
-1
build.gradle
build.gradle
+2
-2
subutil/src/main/java/com/blankj/subutil/util/PathUtils.java
subutil/src/main/java/com/blankj/subutil/util/PathUtils.java
+354
-0
subutil/src/test/java/com/blankj/subutil/util/TestUtils.java
subutil/src/test/java/com/blankj/subutil/util/TestUtils.java
+0
-1
update_log.md
update_log.md
+2
-1
utilcode/README-CN.md
utilcode/README-CN.md
+1
-1
utilcode/README.md
utilcode/README.md
+1
-1
utilcode/src/main/java/com/blankj/utilcode/util/AppUtils.java
...code/src/main/java/com/blankj/utilcode/util/AppUtils.java
+1
-1
未找到文件。
README-CN.md
浏览文件 @
64c72c59
...
...
@@ -41,7 +41,7 @@
[
logo
]:
https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.13.1
0
-brightgreen.svg
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.13.1
1
-brightgreen.svg
[
auc
]:
https://github.com/Blankj/AndroidUtilCode
[
apisvg
]:
https://img.shields.io/badge/API-14+-brightgreen.svg
...
...
README.md
浏览文件 @
64c72c59
...
...
@@ -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.1
0
-brightgreen.svg
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.13.1
1
-brightgreen.svg
[
auc
]:
https://github.com/Blankj/AndroidUtilCode
[
apisvg
]:
https://img.shields.io/badge/API-14+-brightgreen.svg
...
...
app/build.gradle
浏览文件 @
64c72c59
...
...
@@ -60,7 +60,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.1
0
'
// implementation 'com.blankj:utilcode:1.13.1
1
'
}
build.gradle
浏览文件 @
64c72c59
...
...
@@ -33,8 +33,8 @@ ext {
min_sdk_version
=
14
target_sdk_version
=
27
version_code
=
1
_013_01
0
version_name
=
'1.13.1
0
'
// E.g 1.9.72 => 1,009,072
version_code
=
1
_013_01
1
version_name
=
'1.13.1
1
'
// E.g 1.9.72 => 1,009,072
// App dependencies
support_version
=
'27.1.0'
...
...
subutil/src/main/java/com/blankj/subutil/util/PathUtils.java
0 → 100644
浏览文件 @
64c72c59
package
com.blankj.subutil.util
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.support.annotation.RequiresApi
;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/04/15
* desc : 路径相关工具类
* </pre>
*/
public
class
PathUtils
{
private
PathUtils
()
{
throw
new
UnsupportedOperationException
(
"u can't instantiate me..."
);
}
/**
* 获取 Android 系统根目录
* <pre>path: /system</pre>
*
* @return 系统根目录
*/
public
static
String
getRootPath
()
{
return
Environment
.
getRootDirectory
().
getAbsolutePath
();
}
/**
* 获取 data 目录
* <pre>path: /data</pre>
*
* @return data 目录
*/
public
static
String
getDataPath
()
{
return
Environment
.
getDataDirectory
().
getAbsolutePath
();
}
/**
* 获取缓存目录
* <pre>path: data/cache</pre>
*
* @return 缓存目录
*/
public
static
String
getIntDownloadCachePath
()
{
return
Environment
.
getDownloadCacheDirectory
().
getAbsolutePath
();
}
/**
* 获取此应用的缓存目录
* <pre>path: /data/data/package/cache</pre>
*
* @return 此应用的缓存目录
*/
public
static
String
getAppIntCachePath
()
{
return
Utils
.
getApp
().
getCacheDir
().
getAbsolutePath
();
}
/**
* 获取此应用的文件目录
* <pre>path: /data/data/package/files</pre>
*
* @return 此应用的文件目录
*/
public
static
String
getAppIntFilesPath
()
{
return
Utils
.
getApp
().
getFilesDir
().
getAbsolutePath
();
}
/**
* 获取此应用的数据库文件目录
* <pre>path: /data/data/package/databases/name</pre>
*
* @param name 数据库文件名
* @return 数据库文件目录
*/
public
static
String
getAppIntDbPath
(
String
name
)
{
return
Utils
.
getApp
().
getDatabasePath
(
name
).
getAbsolutePath
();
}
/**
* 获取 Android 外置储存的根目录
* <pre>path: /storage/emulated/0</pre>
*
* @return 外置储存根目录
*/
public
static
String
getExtStoragePath
()
{
return
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
();
}
/**
* 获取闹钟铃声目录
* <pre>path: /storage/emulated/0/Alarms</pre>
*
* @return 闹钟铃声目录
*/
public
static
String
getExtAlarmsPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_ALARMS
)
.
getAbsolutePath
();
}
/**
* 获取相机拍摄的照片和视频的目录
* <pre>path: /storage/emulated/0/DCIM</pre>
*
* @return 照片和视频目录
*/
public
static
String
getExtDcimPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DCIM
)
.
getAbsolutePath
();
}
/**
* 获取文档目录
* <pre>path: /storage/emulated/0/Documents</pre>
*
* @return 文档目录
*/
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
KITKAT
)
public
static
String
getExtDocumentsPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
)
.
getAbsolutePath
();
}
/**
* 获取下载目录
* <pre>path: /storage/emulated/0/Download</pre>
*
* @return 下载目录
*/
public
static
String
getExtDownloadsPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOWNLOADS
)
.
getAbsolutePath
();
}
/**
* 获取视频目录
* <pre>path: /storage/emulated/0/Movies</pre>
*
* @return 视频目录
*/
public
static
String
getExtMoviesPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MOVIES
)
.
getAbsolutePath
();
}
/**
* 获取音乐目录
* <pre>path: /storage/emulated/0/Music</pre>
*
* @return 音乐目录
*/
public
static
String
getExtMusicPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MUSIC
)
.
getAbsolutePath
();
}
/**
* 获取提示音目录
* <pre>path: /storage/emulated/0/Notifications</pre>
*
* @return 提示音目录
*/
public
static
String
getExtNotificationsPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_NOTIFICATIONS
)
.
getAbsolutePath
();
}
/**
* 获取图片目录
* <pre>path: /storage/emulated/0/Pictures</pre>
*
* @return 图片目录
*/
public
static
String
getExtPicturesPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PICTURES
)
.
getAbsolutePath
();
}
/**
* 获取 Podcasts 目录
* <pre>path: /storage/emulated/0/Podcasts</pre>
*
* @return Podcasts 目录
*/
public
static
String
getExtPodcastsPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PODCASTS
)
.
getAbsolutePath
();
}
/**
* 获取铃声目录
* <pre>path: /storage/emulated/0/Ringtones</pre>
*
* @return 下载目录
*/
public
static
String
getExtRingtonesPath
()
{
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_RINGTONES
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的缓存目录
* <pre>path: /storage/emulated/0/Android/data/package/cache</pre>
*
* @return 此应用在外置储存中的缓存目录
*/
public
static
String
getAppExtCachePath
()
{
return
Utils
.
getApp
().
getExternalCacheDir
().
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的文件目录
* <pre>path: /storage/emulated/0/Android/data/package/files</pre>
*
* @return 此应用在外置储存中的文件目录
*/
public
static
String
getAppExtFilePath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
null
).
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的闹钟铃声目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Alarms</pre>
*
* @return 此应用在外置储存中的闹钟铃声目录
*/
public
static
String
getAppExtAlarmsPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_ALARMS
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的相机目录
* <pre>path: /storage/emulated/0/Android/data/package/files/DCIM</pre>
*
* @return 此应用在外置储存中的相机目录
*/
public
static
String
getAppExtDcimPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DCIM
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的文档目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Documents</pre>
*
* @return 此应用在外置储存中的文档目录
*/
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
KITKAT
)
public
static
String
getAppExtDocumentsPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DOCUMENTS
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的闹钟目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Download</pre>
*
* @return 此应用在外置储存中的闹钟目录
*/
public
static
String
getAppExtDownloadPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的视频目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Movies</pre>
*
* @return 此应用在外置储存中的视频目录
*/
public
static
String
getAppExtMoviesPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_MOVIES
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的音乐目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Music</pre>
*
* @return 此应用在外置储存中的音乐目录
*/
public
static
String
getAppExtMusicPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_MUSIC
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的提示音目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Notifications</pre>
*
* @return 此应用在外置储存中的提示音目录
*/
public
static
String
getAppExtNotificationsPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_NOTIFICATIONS
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的图片目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Pictures</pre>
*
* @return 此应用在外置储存中的图片目录
*/
public
static
String
getAppExtPicturesPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PICTURES
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的 Podcasts 目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Podcasts</pre>
*
* @return 此应用在外置储存中的 Podcasts 目录
*/
public
static
String
getAppExtPodcastsPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PODCASTS
)
.
getAbsolutePath
();
}
/**
* 获取此应用在外置储存中的铃声目录
* <pre>path: /storage/emulated/0/Android/data/package/files/Ringtones</pre>
*
* @return 此应用在外置储存中的铃声目录
*/
public
static
String
getAppExtRingtonesPath
()
{
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_RINGTONES
)
.
getAbsolutePath
();
}
/**
* 获取此应用的 Obb 目录
* <pre>path: /storage/emulated/0/Android/obb/package</pre>
* <pre>一般用来存放游戏数据包</pre>
*
* @return 此应用的 Obb 目录
*/
public
static
String
getObbPath
()
{
return
Utils
.
getApp
().
getObbDir
().
getAbsolutePath
();
}
}
subutil/src/test/java/com/blankj/subutil/util/TestUtils.java
浏览文件 @
64c72c59
...
...
@@ -24,6 +24,5 @@ public class TestUtils {
@Test
public
void
test
()
throws
Exception
{
}
}
\ No newline at end of file
update_log.md
浏览文件 @
64c72c59
*
18/04/16 完善 AppUtils#installAppSilent 路径包含空格问题,发布 1.13.11 版本
*
18/04/10 完善 OnCrashListener 回调崩溃信息,发布 1.13.10 版本
*
18/04/09 修复静默安装重载错误,发布 1.13.9 版本
*
18/04/08 修复获取栈顶 Activity 链表为空的异常,获取栈顶 Activity 放到 Utils 中,发布 1.13.8 版本
...
...
@@ -8,7 +9,7 @@
*
18/03/20 修复 PermissionUtils 子进程的问题,发布 1.13.5 版本
*
18/03/16 新增 gradle 插件来格式化 README
*
18/03/14 修复 KeyboardUtils#getContentViewInvisibleHeight,发布 1.13.4 版本
*
18/03/10 完善 Utils#installAppSilent 和 DeviceUtils#getMacAddress,发布 1.13.3 版本
*
18/03/10 完善
App
Utils#installAppSilent 和 DeviceUtils#getMacAddress,发布 1.13.3 版本
*
18/03/09 完善 ActivityUtils#getTopActivity
*
18/03/08 新增反射获取栈顶 Activity 的方法,发布 1.13.2 版本
*
18/03/07 修复 PermissionUtils 请求权限为 0 的 崩溃
...
...
utilcode/README-CN.md
浏览文件 @
64c72c59
...
...
@@ -2,7 +2,7 @@
Gradle:
```
groovy
compile
'com.blankj:utilcode:1.13.10
'
implementation
'com.blankj:utilcode:1.13.11
'
```
...
...
utilcode/README.md
浏览文件 @
64c72c59
...
...
@@ -2,7 +2,7 @@
Gradle:
```
groovy
compile
'com.blankj:utilcode:1.13.10
'
implementation
'com.blankj:utilcode:1.13.11
'
```
...
...
utilcode/src/main/java/com/blankj/utilcode/util/AppUtils.java
浏览文件 @
64c72c59
...
...
@@ -151,7 +151,7 @@ public final class AppUtils {
public
static
boolean
installAppSilent
(
final
File
file
,
final
String
params
)
{
if
(!
isFileExists
(
file
))
return
false
;
boolean
isRoot
=
isDeviceRooted
();
String
filePath
=
file
.
getAbsolutePath
()
;
String
filePath
=
'"'
+
file
.
getAbsolutePath
()
+
'"'
;
String
command
=
"LD_LIBRARY_PATH=/vendor/lib*:/system/lib* pm install "
+
(
params
==
null
?
""
:
params
+
" "
)
+
filePath
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录