Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiaoxuan_i809
AndroidUtilCode
提交
cdcb76ff
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,体验更适合开发者的 AI 搜索 >>
提交
cdcb76ff
编写于
9月 06, 2018
作者:
B
Blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 09/05 log
上级
6718e068
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
748 addition
and
451 deletion
+748
-451
README-CN.md
README-CN.md
+1
-1
README.md
README.md
+1
-1
app/src/main/java/com/blankj/androidutilcode/MainActivity.java
...rc/main/java/com/blankj/androidutilcode/MainActivity.java
+1
-0
app/src/main/java/com/blankj/androidutilcode/base/BaseActivity.java
...in/java/com/blankj/androidutilcode/base/BaseActivity.java
+1
-0
app/src/main/java/com/blankj/androidutilcode/feature/core/path/PathActivity.java
...lankj/androidutilcode/feature/core/path/PathActivity.java
+40
-1
app/src/main/java/com/blankj/androidutilcode/feature/core/permission/PermissionActivity.java
...dutilcode/feature/core/permission/PermissionActivity.java
+27
-0
app/src/main/java/com/blankj/androidutilcode/feature/core/toast/ToastActivity.java
...nkj/androidutilcode/feature/core/toast/ToastActivity.java
+2
-0
app/src/main/res_core/layout/activity_keyboard1.xml
app/src/main/res_core/layout/activity_keyboard1.xml
+0
-50
app/src/main/res_core/layout/activity_permission.xml
app/src/main/res_core/layout/activity_permission.xml
+7
-0
app/src/main/res_core/layout/activity_util_core.xml
app/src/main/res_core/layout/activity_util_core.xml
+7
-8
app/src/main/res_core/layout/dialog_keyboard.xml
app/src/main/res_core/layout/dialog_keyboard.xml
+123
-34
app/src/main/res_core/values/strings.xml
app/src/main/res_core/values/strings.xml
+1
-0
config.gradle
config.gradle
+5
-4
settings.gradle
settings.gradle
+34
-1
update_log.md
update_log.md
+3
-0
utilcode/README-CN.md
utilcode/README-CN.md
+44
-1
utilcode/README.md
utilcode/README.md
+44
-1
utilcode/build.gradle
utilcode/build.gradle
+1
-2
utilcode/src/main/java/com/blankj/utilcode/util/EncryptUtils.java
.../src/main/java/com/blankj/utilcode/util/EncryptUtils.java
+4
-4
utilcode/src/main/java/com/blankj/utilcode/util/PathUtils.java
...ode/src/main/java/com/blankj/utilcode/util/PathUtils.java
+402
-343
未找到文件。
README-CN.md
浏览文件 @
cdcb76ff
...
...
@@ -41,7 +41,7 @@
[
logo
]:
https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.20.
0
-brightgreen.svg
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.20.
1
-brightgreen.svg
[
auc
]:
https://github.com/Blankj/AndroidUtilCode
[
apisvg
]:
https://img.shields.io/badge/API-14+-brightgreen.svg
...
...
README.md
浏览文件 @
cdcb76ff
...
...
@@ -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.20.
0
-brightgreen.svg
[
aucsvg
]:
https://img.shields.io/badge/AndroidUtilCode-v1.20.
1
-brightgreen.svg
[
auc
]:
https://github.com/Blankj/AndroidUtilCode
[
apisvg
]:
https://img.shields.io/badge/API-14+-brightgreen.svg
...
...
app/src/main/java/com/blankj/androidutilcode/MainActivity.java
浏览文件 @
cdcb76ff
...
...
@@ -12,6 +12,7 @@ import com.blankj.androidutilcode.base.BaseDrawerActivity;
import
com.blankj.androidutilcode.feature.core.CoreUtilActivity
;
import
com.blankj.androidutilcode.feature.sub.SubUtilActivity
;
import
com.blankj.utilcode.util.BarUtils
;
import
com.blankj.utilcode.util.EncryptUtils
;
/**
* <pre>
...
...
app/src/main/java/com/blankj/androidutilcode/base/BaseActivity.java
浏览文件 @
cdcb76ff
...
...
@@ -31,6 +31,7 @@ public abstract class BaseActivity extends AppCompatActivity
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
ScreenUtils
.
adaptScreen4VerticalSlide
(
this
,
720
);
super
.
onCreate
(
savedInstanceState
);
mActivity
=
this
;
Bundle
bundle
=
getIntent
().
getExtras
();
...
...
app/src/main/java/com/blankj/androidutilcode/feature/core/path/PathActivity.java
浏览文件 @
cdcb76ff
...
...
@@ -9,6 +9,7 @@ import android.widget.TextView;
import
com.blankj.androidutilcode.R
;
import
com.blankj.androidutilcode.base.BaseBackActivity
;
import
com.blankj.utilcode.util.PathUtils
;
import
com.blankj.utilcode.util.SpanUtils
;
/**
...
...
@@ -42,7 +43,45 @@ public class PathActivity extends BaseBackActivity {
TextView
tvAboutMetaData
=
findViewById
(
R
.
id
.
tv_about_path
);
tvAboutMetaData
.
setText
(
new
SpanUtils
()
// .appendLine("getRootPath: " + PathUtils.getRootPath())
.
appendLine
(
"getRootPath: "
+
PathUtils
.
getRootPath
())
.
appendLine
(
"getDataPath: "
+
PathUtils
.
getDataPath
())
.
appendLine
(
"getDownloadCachePath: "
+
PathUtils
.
getDownloadCachePath
())
.
appendLine
(
"getInternalAppDataPath: "
+
PathUtils
.
getInternalAppDataPath
())
.
appendLine
(
"getInternalAppCodeCacheDir: "
+
PathUtils
.
getInternalAppCodeCacheDir
())
.
appendLine
(
"getInternalAppCachePath: "
+
PathUtils
.
getInternalAppCachePath
())
.
appendLine
(
"getInternalAppDbsPath: "
+
PathUtils
.
getInternalAppDbsPath
())
.
appendLine
(
"getInternalAppDbPath: "
+
PathUtils
.
getInternalAppDbPath
(
"demo"
))
.
appendLine
(
"getInternalAppFilesPath: "
+
PathUtils
.
getInternalAppFilesPath
())
.
appendLine
(
"getInternalAppSpPath: "
+
PathUtils
.
getInternalAppSpPath
())
.
appendLine
(
"getInternalAppNoBackupFilesPath: "
+
PathUtils
.
getInternalAppNoBackupFilesPath
())
.
appendLine
(
"getExternalStoragePath: "
+
PathUtils
.
getExternalStoragePath
())
.
appendLine
(
"getExternalMusicPath: "
+
PathUtils
.
getExternalMusicPath
())
.
appendLine
(
"getExternalPodcastsPath: "
+
PathUtils
.
getExternalPodcastsPath
())
.
appendLine
(
"getExternalRingtonesPath: "
+
PathUtils
.
getExternalRingtonesPath
())
.
appendLine
(
"getExternalAlarmsPath: "
+
PathUtils
.
getExternalAlarmsPath
())
.
appendLine
(
"getExternalNotificationsPath: "
+
PathUtils
.
getExternalNotificationsPath
())
.
appendLine
(
"getExternalPicturesPath: "
+
PathUtils
.
getExternalPicturesPath
())
.
appendLine
(
"getExternalMoviesPath: "
+
PathUtils
.
getExternalMoviesPath
())
.
appendLine
(
"getExternalDownloadsPath: "
+
PathUtils
.
getExternalDownloadsPath
())
.
appendLine
(
"getExternalDcimPath: "
+
PathUtils
.
getExternalDcimPath
())
.
appendLine
(
"getExternalDocumentsPath: "
+
PathUtils
.
getExternalDocumentsPath
())
.
appendLine
(
"getExternalAppDataPath: "
+
PathUtils
.
getExternalAppDataPath
())
.
appendLine
(
"getExternalAppCachePath: "
+
PathUtils
.
getExternalAppCachePath
())
.
appendLine
(
"getExternalAppFilesPath: "
+
PathUtils
.
getExternalAppFilesPath
())
.
appendLine
(
"getExternalAppMusicPath: "
+
PathUtils
.
getExternalAppMusicPath
())
.
appendLine
(
"getExternalAppPodcastsPath: "
+
PathUtils
.
getExternalAppPodcastsPath
())
.
appendLine
(
"getExternalAppRingtonesPath: "
+
PathUtils
.
getExternalAppRingtonesPath
())
.
appendLine
(
"getExternalAppAlarmsPath: "
+
PathUtils
.
getExternalAppAlarmsPath
())
.
appendLine
(
"getExternalAppNotificationsPath: "
+
PathUtils
.
getExternalAppNotificationsPath
())
.
appendLine
(
"getExternalAppPicturesPath: "
+
PathUtils
.
getExternalAppPicturesPath
())
.
appendLine
(
"getExternalAppMoviesPath: "
+
PathUtils
.
getExternalAppMoviesPath
())
.
appendLine
(
"getExternalAppDownloadPath: "
+
PathUtils
.
getExternalAppDownloadPath
())
.
appendLine
(
"getExternalAppDcimPath: "
+
PathUtils
.
getExternalAppDcimPath
())
.
appendLine
(
"getExternalAppDocumentsPath: "
+
PathUtils
.
getExternalAppDocumentsPath
())
.
appendLine
(
"getExternalAppObbPath: "
+
PathUtils
.
getExternalAppObbPath
())
.
append
(
""
)
.
create
());
}
...
...
app/src/main/java/com/blankj/androidutilcode/feature/core/permission/PermissionActivity.java
浏览文件 @
cdcb76ff
...
...
@@ -56,6 +56,7 @@ public class PermissionActivity extends BaseBackActivity {
findViewById
(
R
.
id
.
btn_open_app_settings
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
btn_request_calendar
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
btn_request_record_audio
).
setOnClickListener
(
this
);
findViewById
(
R
.
id
.
btn_request_calendar_and_record_audio
).
setOnClickListener
(
this
);
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
s
:
PermissionUtils
.
getPermissions
())
{
...
...
@@ -139,6 +140,32 @@ public class PermissionActivity extends BaseBackActivity {
})
.
request
();
break
;
case
R
.
id
.
btn_request_calendar_and_record_audio
:
PermissionUtils
.
permission
(
PermissionConstants
.
CALENDAR
,
PermissionConstants
.
MICROPHONE
)
.
rationale
(
new
PermissionUtils
.
OnRationaleListener
()
{
@Override
public
void
rationale
(
final
ShouldRequest
shouldRequest
)
{
DialogHelper
.
showRationaleDialog
(
shouldRequest
);
}
})
.
callback
(
new
PermissionUtils
.
FullCallback
()
{
@Override
public
void
onGranted
(
List
<
String
>
permissionsGranted
)
{
updateAboutPermission
();
LogUtils
.
d
(
permissionsGranted
);
}
@Override
public
void
onDenied
(
List
<
String
>
permissionsDeniedForever
,
List
<
String
>
permissionsDenied
)
{
if
(!
permissionsDeniedForever
.
isEmpty
())
{
DialogHelper
.
showOpenAppSettingDialog
();
}
LogUtils
.
d
(
permissionsDeniedForever
,
permissionsDenied
);
}
})
.
request
();
break
;
}
}
...
...
app/src/main/java/com/blankj/androidutilcode/feature/core/toast/ToastActivity.java
浏览文件 @
cdcb76ff
...
...
@@ -8,12 +8,14 @@ import android.support.annotation.Nullable;
import
android.support.v4.content.ContextCompat
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.blankj.androidutilcode.R
;
import
com.blankj.androidutilcode.base.BaseBackActivity
;
import
com.blankj.utilcode.util.SizeUtils
;
import
com.blankj.utilcode.util.SpanUtils
;
import
com.blankj.utilcode.util.ToastUtils
;
import
com.blankj.utilcode.util.Utils
;
/**
* <pre>
...
...
app/src/main/res_core/layout/activity_keyboard1.xml
已删除
100644 → 0
浏览文件 @
6718e068
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_about_keyboard"
style=
"@style/TextStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<Button
android:id=
"@+id/btn_hide_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_hide_soft_input"
/>
<Button
android:id=
"@+id/btn_show_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_show_soft_input"
/>
<Button
android:id=
"@+id/btn_toggle_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_toggle_soft_input"
/>
<Button
android:id=
"@+id/btn_keyboard_in_fragment"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_show_dialog"
/>
<EditText
android:id=
"@+id/et_input"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:inputType=
"text"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res_core/layout/activity_permission.xml
浏览文件 @
cdcb76ff
...
...
@@ -34,4 +34,11 @@
android:layout_height=
"wrap_content"
android:text=
"@string/permission_request_record_audio"
/>
<Button
android:id=
"@+id/btn_request_calendar_and_record_audio"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/permission_request_calendar"
/>
</LinearLayout>
app/src/main/res_core/layout/activity_util_core.xml
浏览文件 @
cdcb76ff
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
...
...
@@ -92,12 +91,12 @@
android:onClick=
"networkClick"
android:text=
"@string/demo_network"
/>
<
!--<Button-->
<!--style="@style/WideBtnStyle"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:onClick="pathClick"-->
<!--android:text="@string/demo_path" />--
>
<
Button
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:onClick=
"pathClick"
android:text=
"@string/demo_path"
/
>
<Button
style=
"@style/WideBtnStyle"
...
...
app/src/main/res_core/layout/dialog_keyboard.xml
浏览文件 @
cdcb76ff
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:padding=
"@dimen/spacing_16"
>
android:layout_height=
"match_parent"
>
<EditText
android:id=
"@+id/et_input"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:inputType=
"text"
/>
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
android:padding=
"@dimen/spacing_16"
>
<Button
android:id=
"@+id/btn_hide_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_hide_soft_input"
/>
<Button
android:id=
"@+id/btn_hide_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_hide_soft_input"
/>
<Button
android:id=
"@+id/btn_show_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_show_soft_input"
/>
<Button
android:id=
"@+id/btn_show_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_show_soft_input"
/>
<Button
android:id=
"@+id/btn_toggle_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_toggle_soft_input"
/>
<Button
android:id=
"@+id/btn_toggle_soft_input"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_toggle_soft_input"
/>
<Button
android:id=
"@+id/btn_close_dialog"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_close_dialog"
/>
<Button
android:id=
"@+id/btn_close_dialog"
style=
"@style/WideBtnStyle"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/keyboard_close_dialog"
/>
<EditText
android:id=
"@+id/et_input"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input1"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input2"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input3"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"bottom"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input4"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input5"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input6"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input7"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input8"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input9"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input10"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input11"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input12"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
<EditText
android:id=
"@+id/et_input13"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:inputType=
"text"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
app/src/main/res_core/values/strings.xml
浏览文件 @
cdcb76ff
...
...
@@ -205,6 +205,7 @@
<string
name=
"permission_open_app_settings"
>
Open App Settings
</string>
<string
name=
"permission_request_calendar"
>
Request Calendar
</string>
<string
name=
"permission_request_record_audio"
>
Request Record Audio
</string>
<string
name=
"permission_request_calendar_and_record_audio"
>
Request Calendar And Record Audio
</string>
<!--Phone 相关-->
...
...
config.gradle
浏览文件 @
cdcb76ff
...
...
@@ -6,8 +6,8 @@ ext {
compileSdkVersion:
27
,
minSdkVersion
:
14
,
targetSdkVersion
:
27
,
versionCode
:
1
_020_00
0
,
versionName
:
'1.20.
0
'
// E.g. 1.9.72 => 1,009,072
versionCode
:
1
_020_00
1
,
versionName
:
'1.20.
1
'
// E.g. 1.9.72 => 1,009,072
]
versionConfig
=
[
...
...
@@ -172,7 +172,7 @@ def configAppDependencies(Project pro) {
// LeakCanary
debugImplementation
depConfig
.
leakcanary
.
android
releaseImplementation
depConfig
.
leakcanary
.
android_no_op
// implementation 'com.blankj:utilcode:1.20.
0
'
// implementation 'com.blankj:utilcode:1.20.
1
'
}
}
...
...
@@ -201,4 +201,5 @@ def configSubUtilDependencies(Project pro) {
testImplementation
depConfig
.
junit
testImplementation
depConfig
.
robolectric
}
}
\ No newline at end of file
}
//./gradlew bintrayUpload
\ No newline at end of file
settings.gradle
浏览文件 @
cdcb76ff
include
':app'
,
':buildSrc'
,
':subutil'
,
':utilcode'
\ No newline at end of file
':utilcode'
//getRootPath: /system
//getDataPath: /data
//getInternalDownloadCachePath: /data/cache
//getInternalAppCachePath: /data/user/0/com.blankj.androidutilcode/cache
//getInternalAppFilesPath: /data/user/0/com.blankj.androidutilcode/files
//getInternalAppDbPath: /data/user/0/com.blankj.androidutilcode/databases/demo
//
//
//getExternalStoragePath: /storage/emulated/0
//getExternalAlarmsPath: /storage/emulated/0/Alarms
//getExternalDcimPath: /storage/emulated/0/DCIM
//getExternalDocumentsPath: /storage/emulated/0/Documents
//getExternalDownloadsPath: /storage/emulated/0/Download
//getExternalMoviesPath: /storage/emulated/0/Movies
//getExternalMusicPath: /storage/emulated/0/Music
//getExternalNotificationsPath: /storage/emulated/0/Notifications
//getExternalPicturesPath: /storage/emulated/0/Pictures
//getExternalPodcastsPath: /storage/emulated/0/Podcasts
//getExternalRingtonesPath: /storage/emulated/0/Ringtones
//getExternalAppCachePath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/cache
//getExternalAppFilePath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files
//getExternalAppAlarmsPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Alarms
//getExternalAppDcimPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/DCIM
//getExternalAppDocumentsPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Documents
//getExternalAppDownloadPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Download
//getExternalAppMoviesPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Movies
//getExternalAppMusicPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Music
//getExternalAppNotificationsPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Notifications
//getExternalAppPicturesPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Pictures
//getExternalAppPodcastsPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Podcasts
//getExternalAppRingtonesPath: /storage/emulated/0/Android/data/com.blankj.androidutilcode/files/Ringtones
//getObbPath: /storage/emulated/0/Android/obb/com.blankj.androidutilcode
\ No newline at end of file
update_log.md
浏览文件 @
cdcb76ff
*
`18/09/06`
新增 PathUtils,发布 1.20.1
*
`18/09/05`
新增 KeyboardUtils#showSoftInputUsingToggle 和 KeyboardUtils#hideSoftInputUsingToggle
*
`18/09/04`
修复 SHA 算法名
*
`18/09/03`
新增 MetaDataUtils,发布 1.20.0
*
`18/08/30`
修复 PermissionUtils$PermissionActivity 的 window 背景为黑色的问题,发布 1.19.4
*
`18/08/28`
新增 RegexUtils#isIDCard18Exact
...
...
utilcode/README-CN.md
浏览文件 @
cdcb76ff
...
...
@@ -2,7 +2,7 @@
Gradle:
```
groovy
implementation
'com.blankj:utilcode:1.20.
0
'
implementation
'com.blankj:utilcode:1.20.
1
'
```
...
...
@@ -440,6 +440,46 @@ getOrDefault : 获取非空或默认对象
hashCode : 获取对象哈希值
```
*
### 路径相关 ->
[
PathUtils.java
][
path.java
]
->
[
Demo
][
path.demo
]
```
getRootPath : 获取根路径
getDataPath : 获取数据路径
getDownloadCachePath : 获取下载缓存路径
getInternalAppDataPath : 获取内存应用数据路径
getInternalAppCodeCacheDir : 获取内存应用代码缓存路径
getInternalAppCachePath : 获取内存应用缓存路径
getInternalAppDbsPath : 获取内存应用数据库路径
getInternalAppDbPath : 获取内存应用数据库路径
getInternalAppFilesPath : 获取内存应用文件路径
getInternalAppSpPath : 获取内存应用 SP 路径
getInternalAppNoBackupFilesPath: 获取内存应用未备份文件路径
getExternalStoragePath : 获取外存路径
getExternalMusicPath : 获取外存音乐路径
getExternalPodcastsPath : 获取外存播客路径
getExternalRingtonesPath : 获取外存铃声路径
getExternalAlarmsPath : 获取外存闹铃路径
getExternalNotificationsPath : 获取外存通知路径
getExternalPicturesPath : 获取外存图片路径
getExternalMoviesPath : 获取外存影片路径
getExternalDownloadsPath : 获取外存下载路径
getExternalDcimPath : 获取外存数码相机图片路径
getExternalDocumentsPath : 获取外存文档路径
getExternalAppDataPath : 获取外存应用数据路径
getExternalAppCachePath : 获取外存应用缓存路径
getExternalAppFilesPath : 获取外存应用文件路径
getExternalAppMusicPath : 获取外存应用音乐路径
getExternalAppPodcastsPath : 获取外存应用播客路径
getExternalAppRingtonesPath : 获取外存应用铃声路径
getExternalAppAlarmsPath : 获取外存应用闹铃路径
getExternalAppNotificationsPath: 获取外存应用通知路径
getExternalAppPicturesPath : 获取外存应用图片路径
getExternalAppMoviesPath : 获取外存应用影片路径
getExternalAppDownloadPath : 获取外存应用下载路径
getExternalAppDcimPath : 获取外存应用数码相机图片路径
getExternalAppDocumentsPath : 获取外存应用文档路径
getExternalAppObbPath : 获取外存应用 OBB 路径
```
*
### 权限相关 ->
[
PermissionUtils.java
][
permission.java
]
->
[
Demo
][
permission.demo
]
```
getPermissions : 获取应用权限
...
...
@@ -827,6 +867,9 @@ getComments : 获取压缩文件中的注释链表
[
object.java
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/util/ObjectUtils.java
[
object.test
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/test/java/com/blankj/utilcode/util/ObjectUtilsTest.java
[
path.java
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/util/PathUtils.java
[
path.demo
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/app/src/main/java/com/blankj/androidutilcode/feature/core/path/PathActivity.java
[
permission.java
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/util/PermissionUtils.java
[
permission.demo
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/app/src/main/java/com/blankj/androidutilcode/feature/core/permission/PermissionActivity.java
...
...
utilcode/README.md
浏览文件 @
cdcb76ff
...
...
@@ -2,7 +2,7 @@
Gradle:
```
groovy
implementation
'com.blankj:utilcode:1.20.
0
'
implementation
'com.blankj:utilcode:1.20.
1
'
```
...
...
@@ -440,6 +440,46 @@ getOrDefault
hashCode
```
*
### About Path ->
[
PathUtils.java
][
path.java
]
->
[
Demo
][
path.demo
]
```
getRootPath
getDataPath
getDownloadCachePath
getInternalAppDataPath
getInternalAppCodeCacheDir
getInternalAppCachePath
getInternalAppDbsPath
getInternalAppDbPath
getInternalAppFilesPath
getInternalAppSpPath
getInternalAppNoBackupFilesPath
getExternalStoragePath
getExternalMusicPath
getExternalPodcastsPath
getExternalRingtonesPath
getExternalAlarmsPath
getExternalNotificationsPath
getExternalPicturesPath
getExternalMoviesPath
getExternalDownloadsPath
getExternalDcimPath
getExternalDocumentsPath
getExternalAppDataPath
getExternalAppCachePath
getExternalAppFilesPath
getExternalAppMusicPath
getExternalAppPodcastsPath
getExternalAppRingtonesPath
getExternalAppAlarmsPath
getExternalAppNotificationsPath
getExternalAppPicturesPath
getExternalAppMoviesPath
getExternalAppDownloadPath
getExternalAppDcimPath
getExternalAppDocumentsPath
getExternalAppObbPath
```
*
### About Permission ->
[
PermissionUtils.java
][
permission.java
]
->
[
Demo
][
permission.demo
]
```
getPermissions
...
...
@@ -827,6 +867,9 @@ getComments
[
object.java
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/util/ObjectUtils.java
[
object.test
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/test/java/com/blankj/utilcode/util/ObjectUtilsTest.java
[
path.java
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/util/PathUtils.java
[
path.demo
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/app/src/main/java/com/blankj/androidutilcode/feature/core/path/PathActivity.java
[
permission.java
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/src/main/java/com/blankj/utilcode/util/PermissionUtils.java
[
permission.demo
]:
https://github.com/Blankj/AndroidUtilCode/blob/master/app/src/main/java/com/blankj/androidutilcode/feature/core/permission/PermissionActivity.java
...
...
utilcode/build.gradle
浏览文件 @
cdcb76ff
...
...
@@ -10,5 +10,4 @@ configUtilCodeDependencies project
apply
{
from
(
'readme.gradle'
)
from
(
"../bintrayUpload.gradle"
)
}
//./gradlew bintrayUpload
\ No newline at end of file
}
\ No newline at end of file
utilcode/src/main/java/com/blankj/utilcode/util/EncryptUtils.java
浏览文件 @
cdcb76ff
...
...
@@ -229,7 +229,7 @@ public final class EncryptUtils {
* @return the bytes of SHA1 encryption
*/
public
static
byte
[]
encryptSHA1
(
final
byte
[]
data
)
{
return
hashTemplate
(
data
,
"SHA1"
);
return
hashTemplate
(
data
,
"SHA
-
1"
);
}
/**
...
...
@@ -291,7 +291,7 @@ public final class EncryptUtils {
* @return the bytes of SHA256 encryption
*/
public
static
byte
[]
encryptSHA256
(
final
byte
[]
data
)
{
return
hashTemplate
(
data
,
"SHA256"
);
return
hashTemplate
(
data
,
"SHA
-
256"
);
}
/**
...
...
@@ -322,7 +322,7 @@ public final class EncryptUtils {
* @return the bytes of SHA384 encryption
*/
public
static
byte
[]
encryptSHA384
(
final
byte
[]
data
)
{
return
hashTemplate
(
data
,
"SHA384"
);
return
hashTemplate
(
data
,
"SHA
-
384"
);
}
/**
...
...
@@ -353,7 +353,7 @@ public final class EncryptUtils {
* @return the bytes of SHA512 encryption
*/
public
static
byte
[]
encryptSHA512
(
final
byte
[]
data
)
{
return
hashTemplate
(
data
,
"SHA512"
);
return
hashTemplate
(
data
,
"SHA
-
512"
);
}
/**
...
...
utilcode/src/main/java/com/blankj/utilcode/util/PathUtils.java
浏览文件 @
cdcb76ff
//package com.blankj.utilcode.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 : utils about path
// * </pre>
// */
//public class PathUtils {
//
// private PathUtils() {
// throw new UnsupportedOperationException("u can't instantiate me...");
// }
//
// /**
// * Return the path of /system.
// *
// * @return the path of /system
// */
// public static String getRootPath() {
// return Environment.getRootDirectory().getAbsolutePath();
// }
//
// /**
// * Return the path of /data.
// *
// * @return the path of /data
// */
// public static String getDataPath() {
// return Environment.getDataDirectory().getAbsolutePath();
// }
//
// /**
// * Return the path of download/cache.
// *
// * @return the path of download/cache
// */
// public static String getInternalDownloadCachePath() {
// return Environment.getDownloadCacheDirectory().getAbsolutePath();
// }
//
// /**
// * Return the path of /data/data/package/cache.
// *
// * @return the path of /data/data/package/cache
// */
// public static String getInternalAppCachePath() {
// return Utils.getApp().getCacheDir().getAbsolutePath();
// }
//
// /**
// * Return the path of /data/data/package/files.
// *
// * @return the path of /data/data/package/files
// */
// public static String getInternalAppFilesPath() {
// return Utils.getApp().getFilesDir().getAbsolutePath();
// }
//
// /**
// * Return the path of /data/data/package/databases/name.
// *
// * @param name The name of database.
// * @return the path of /data/data/package/databases/name
// */
// public static String getInternalAppDbPath(String name) {
// return Utils.getApp().getDatabasePath(name).getAbsolutePath();
// }
//
// /**
// * Return the path of /storage/emulated/0.
// *
// * @return the path of /storage/emulated/0
// */
// public static String getExternalStoragePath() {
// return Environment.getExternalStorageDirectory().getAbsolutePath();
// }
//
// /**
// * Return the path of /storage/emulated/0/Alarms.
// *
// * @return the path of /storage/emulated/0/Alarms
// */
// public static String getExternalAlarmsPath() {
// return Environment
// .getExternalStoragePublicDirectory(Environment.DIRECTORY_ALARMS)
// .getAbsolutePath();
// }
//
// /**
// * Return the path of /storage/emulated/0/DCIM.
// *
// * @return the path of /storage/emulated/0/DCIM
// */
// public static String getExternalDcimPath() {
// return Environment
// .getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
// .getAbsolutePath();
// }
//
// /**
// * Return the path of /storage/emulated/0/Documents.
// *
// * @return the path of /storage/emulated/0/Documents
// */
// @RequiresApi(api = Build.VERSION_CODES.KITKAT)
// public static String getExternalDocumentsPath() {
// return Environment
// .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)
// .getAbsolutePath();
// }
//
// /**
// * Return the path of /storage/emulated/0/Download.
// *
// * @return the path of /storage/emulated/0/Download
// */
// 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();
// }
//}
package
com.blankj.utilcode.util
;
import
android.os.Build
;
import
android.os.Environment
;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/04/15
* desc : utils about path
* </pre>
*/
public
class
PathUtils
{
private
PathUtils
()
{
throw
new
UnsupportedOperationException
(
"u can't instantiate me..."
);
}
/**
* Return the path of /system.
*
* @return the path of /system
*/
public
static
String
getRootPath
()
{
return
Environment
.
getRootDirectory
().
getAbsolutePath
();
}
/**
* Return the path of /data.
*
* @return the path of /data
*/
public
static
String
getDataPath
()
{
return
Environment
.
getDataDirectory
().
getAbsolutePath
();
}
/**
* Return the path of /cache.
*
* @return the path of /cache
*/
public
static
String
getDownloadCachePath
()
{
return
Environment
.
getDownloadCacheDirectory
().
getAbsolutePath
();
}
/**
* Return the path of /data/data/package.
*
* @return the path of /data/data/package
*/
public
static
String
getInternalAppDataPath
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
N
)
{
return
Utils
.
getApp
().
getApplicationInfo
().
dataDir
;
}
return
Utils
.
getApp
().
getDataDir
().
getAbsolutePath
();
}
/**
* Return the path of /data/data/package/code_cache.
*
* @return the path of /data/data/package/code_cache
*/
public
static
String
getInternalAppCodeCacheDir
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
Utils
.
getApp
().
getApplicationInfo
().
dataDir
+
"/code_cache"
;
}
return
Utils
.
getApp
().
getCodeCacheDir
().
getAbsolutePath
();
}
/**
* Return the path of /data/data/package/cache.
*
* @return the path of /data/data/package/cache
*/
public
static
String
getInternalAppCachePath
()
{
return
Utils
.
getApp
().
getCacheDir
().
getAbsolutePath
();
}
/**
* Return the path of /data/data/package/databases.
*
* @return the path of /data/data/package/databases
*/
public
static
String
getInternalAppDbsPath
()
{
return
Utils
.
getApp
().
getApplicationInfo
().
dataDir
+
"/databases"
;
}
/**
* Return the path of /data/data/package/databases/name.
*
* @param name The name of database.
* @return the path of /data/data/package/databases/name
*/
public
static
String
getInternalAppDbPath
(
String
name
)
{
return
Utils
.
getApp
().
getDatabasePath
(
name
).
getAbsolutePath
();
}
/**
* Return the path of /data/data/package/files.
*
* @return the path of /data/data/package/files
*/
public
static
String
getInternalAppFilesPath
()
{
return
Utils
.
getApp
().
getFilesDir
().
getAbsolutePath
();
}
/**
* Return the path of /data/data/package/shared_prefs.
*
* @return the path of /data/data/package/shared_prefs
*/
public
static
String
getInternalAppSpPath
()
{
return
Utils
.
getApp
().
getApplicationInfo
().
dataDir
+
"shared_prefs"
;
}
/**
* Return the path of /data/data/package/no_backup.
*
* @return the path of /data/data/package/no_backup
*/
public
static
String
getInternalAppNoBackupFilesPath
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
return
Utils
.
getApp
().
getApplicationInfo
().
dataDir
+
"no_backup"
;
}
return
Utils
.
getApp
().
getNoBackupFilesDir
().
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0.
*
* @return the path of /storage/emulated/0
*/
public
static
String
getExternalStoragePath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Music.
*
* @return the path of /storage/emulated/0/Music
*/
public
static
String
getExternalMusicPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MUSIC
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Podcasts.
*
* @return the path of /storage/emulated/0/Podcasts
*/
public
static
String
getExternalPodcastsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PODCASTS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Ringtones.
*
* @return the path of /storage/emulated/0/Ringtones
*/
public
static
String
getExternalRingtonesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_RINGTONES
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Alarms.
*
* @return the path of /storage/emulated/0/Alarms
*/
public
static
String
getExternalAlarmsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_ALARMS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Notifications.
*
* @return the path of /storage/emulated/0/Notifications
*/
public
static
String
getExternalNotificationsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_NOTIFICATIONS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Pictures.
*
* @return the path of /storage/emulated/0/Pictures
*/
public
static
String
getExternalPicturesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_PICTURES
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Movies.
*
* @return the path of /storage/emulated/0/Movies
*/
public
static
String
getExternalMoviesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_MOVIES
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Download.
*
* @return the path of /storage/emulated/0/Download
*/
public
static
String
getExternalDownloadsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOWNLOADS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/DCIM.
*
* @return the path of /storage/emulated/0/DCIM
*/
public
static
String
getExternalDcimPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DCIM
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Documents.
*
* @return the path of /storage/emulated/0/Documents
*/
public
static
String
getExternalDocumentsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
return
Environment
.
getExternalStorageDirectory
().
getAbsolutePath
()
+
"/Documents"
;
}
return
Environment
.
getExternalStoragePublicDirectory
(
Environment
.
DIRECTORY_DOCUMENTS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package.
*
* @return the path of /storage/emulated/0/Android/data/package
*/
public
static
String
getExternalAppDataPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalCacheDir
().
getParentFile
().
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/cache.
*
* @return the path of /storage/emulated/0/Android/data/package/cache
*/
public
static
String
getExternalAppCachePath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalCacheDir
().
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files.
*
* @return the path of /storage/emulated/0/Android/data/package/files
*/
public
static
String
getExternalAppFilesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
null
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Music.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Music
*/
public
static
String
getExternalAppMusicPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_MUSIC
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Podcasts.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Podcasts
*/
public
static
String
getExternalAppPodcastsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PODCASTS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Ringtones.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Ringtones
*/
public
static
String
getExternalAppRingtonesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_RINGTONES
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Alarms.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Alarms
*/
public
static
String
getExternalAppAlarmsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_ALARMS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Notifications.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Notifications
*/
public
static
String
getExternalAppNotificationsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_NOTIFICATIONS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Pictures.
*
* @return path of /storage/emulated/0/Android/data/package/files/Pictures
*/
public
static
String
getExternalAppPicturesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PICTURES
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Movies.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Movies
*/
public
static
String
getExternalAppMoviesPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_MOVIES
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Download.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Download
*/
public
static
String
getExternalAppDownloadPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/DCIM.
*
* @return the path of /storage/emulated/0/Android/data/package/files/DCIM
*/
public
static
String
getExternalAppDcimPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DCIM
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/data/package/files/Documents.
*
* @return the path of /storage/emulated/0/Android/data/package/files/Documents
*/
public
static
String
getExternalAppDocumentsPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
KITKAT
)
{
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
null
).
getAbsolutePath
()
+
"/Documents"
;
}
//noinspection ConstantConditions
return
Utils
.
getApp
().
getExternalFilesDir
(
Environment
.
DIRECTORY_DOCUMENTS
).
getAbsolutePath
();
}
/**
* Return the path of /storage/emulated/0/Android/obb/package.
*
* @return the path of /storage/emulated/0/Android/obb/package
*/
public
static
String
getExternalAppObbPath
()
{
if
(
isExternalStorageDisable
())
return
""
;
return
Utils
.
getApp
().
getObbDir
().
getAbsolutePath
();
}
private
static
boolean
isExternalStorageDisable
()
{
return
!
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录