diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000000..750e8ac81a
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/donate.png
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000000..e29c2e45b6
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,52 @@
+---
+name: Bug report
+about: Make AndroidUtilCode more perfect!
+labels: bug
+assignees: Blankj
+
+---
+
+## Describe the bug
+
+A clear and concise description of what the bug is.
+
+- The version of AndroidUtilCode:
+- The device:
+- The version of device:
+
+## The code of bug
+
+
+```
+put your code here
+```
+
+## The stack of crash
+
+
+
+```
+put the stack of crash here
+```
+
+## Screenshots
+
+If applicable, add screenshots to help explain your problem.
+
+
+## Please delete the current line and the following.
+
+Thank you for supporting [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode).
diff --git a/.github/ISSUE_TEMPLATE/bug_report_cn.md b/.github/ISSUE_TEMPLATE/bug_report_cn.md
new file mode 100644
index 0000000000..02ea0223e3
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report_cn.md
@@ -0,0 +1,52 @@
+---
+name: 提交 Bug
+about: 让工具类更完美!
+labels: bug
+assignees: Blankj
+
+---
+
+## 描述 Bug
+
+简洁地描述下 Bug。
+
+- AndroidUtilCode 的版本:
+- 出现 Bug 的设备型号:
+- 设备的 Android 版本:
+
+## 相关代码
+
+
+```
+put your code here
+```
+
+## 异常堆栈
+
+
+
+```
+put the stack of crash here
+```
+
+## 截图
+
+如果有的话请添加屏幕截图以帮助解释问题。
+
+
+## 请删除当前行及以下内容
+
+感谢支持 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode).
diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md
new file mode 100644
index 0000000000..90a0fe1993
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature-request.md
@@ -0,0 +1,21 @@
+---
+name: Feature request
+about: Make AndroidUtilCode more perfect!
+labels: help wanted
+assignees: Blankj
+
+---
+
+## Describe the feature
+
+A clear and concise description of what the feature is.
+
+
+## Reference
+
+Hope to give some reference articles, links, code, if any.
+
+
+## Please delete the current line and the following
+
+Thank you for supporting [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode).
diff --git a/.github/ISSUE_TEMPLATE/feature-request_cn.md b/.github/ISSUE_TEMPLATE/feature-request_cn.md
new file mode 100644
index 0000000000..20862d047b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature-request_cn.md
@@ -0,0 +1,21 @@
+---
+name: 提交需求
+about: 让工具类更健全!
+labels: help wanted
+assignees: Blankj
+
+---
+
+## 描述需求
+
+简洁地描述下需求。
+
+
+## 可借鉴的
+
+如果有的话,可以给出一些参考文章、链接、代码
+
+
+## 请删除当前行及以下内容
+
+感谢支持 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode).
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
new file mode 100644
index 0000000000..311fc1deaa
--- /dev/null
+++ b/.github/workflows/android.yml
@@ -0,0 +1,17 @@
+name: Android CI
+
+on: [push]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: 1.8
+ - name: Build with Gradle
+ run: ./gradlew build aR
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..9d11f56a24
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+__api__.json
+__bus__.json
+.gradle
+local.properties
+.idea
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+/apk
+*.phrof
+/mavenLocal
+/reports
+*/reports
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000..73e8145bf1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,522 @@
+* `22/10/15` [add] Fix some issue. Publish v1.31.1
+* `21/12/06` [add] Publish v1.31.0
+* `21/05/13` [add] Support publish mavenCentral.
+* `21/02/22` [add] Fix ToastUtils rtl bug. Publish v1.30.6.
+* `20/11/16` [add] Add ImageUtils#save2Album support param of dirName.
+* `20/11/13` [add] Fix MessengerUtils ANR. Add NetworkUtils#getWifiScanResult, [add|remove]OnWifiChangedConsumer. Publish v1.30.5.
+* `20/10/29` [add] Fix MessengerUtils startService IllegalStateException. Publish v1.30.4.
+* `20/10/28` [add] Fix BusUtils ConcurrentModificationException. Publish v1.30.3.
+* `20/10/27` [add] Fix AppUtils#getAppSignatures. Add DeviceUtils#isDevelopmentSettingsEnabled. Publish v1.30.2.
+* `20/10/26` [add] Fix AppUtils#isAppForeground. Publish v1.30.1.
+* `20/10/24` [add] Publish v1.30.0.
+* `20/10/23` [fix] LanguageUtils crash on some device.
+* `20/10/21` [add] LogUtils.Config#setOnConsoleOutputListener, setOnFileOutputListener, addFileExtraHead. LogUtils.getCurrentLogFilePath.
+* `20/10/20` [opt] ToastUtils.
+* `20/10/12` [add] PermissionUtils#explain.
+* `20/10/10` [add] ClipboardUtils.
+* `20/10/08` [add] VolumeUtils.
+* `20/09/06` [add] DebouncingUtils#isValid.
+* `20/09/04` [fix] ToastUtils adapt SDK 30.
+* `20/05/28` [fix] IntentUtils#getInstallAppIntent file exist wrong. Publish v1.29.0.
+* `20/05/23` [fix] BusUtils#postSticky times not right. Publish v1.28.6.
+* `20/05/22` [add] IntentUtils#getInstallAppIntent support Uri param.
+* `20/05/21` [add] Publish bus plugin v2.6. Publish api plugin v1.4. Publish. Publish v1.28.5.
+* `20/05/19` [fix] FileUtils#copyOrMoveDird NPE.
+* `20/05/18` [add] IntentUtils#getLaunchAppDetailsSettingsIntent support isNewTask.
+* `20/05/17` [add] ImageUtils#save2Album, NetworkUtils#getSSID, UtilsTransActivity4MainProcess.
+* `20/05/03` [add] Publish bus plugin v2.5. Publish api plugin v1.3. Publish. Publish v1.28.4.
+* `20/04/30` [add] BaseItem support partialUpdate.
+* `20/04/29` [add] Publish plugin lib com.blankj:base-transform:1.0.
+* `20/04/28` [fix] LanguageUtils#applyLanguage.
+* `20/04/27` [fix] BarUtils#isNavBarVisible.
+* `20/04/26` [fix] Utils#init fit tinker. Publish v1.28.3.
+* `20/04/25` [fix] UriUtils#uri2File Unknown URI. Publish 1.28.2.
+* `20/04/24` [add] SnackbarUtils support show on the top; UriUtils#uri2InputStream.
+* `20/04/23` [fix] UriUtils#uri2File not support HW; TransActivity crash below 21.
+* `20/04/23` [fix] PhoneUtils#getSerial, PhoneUtils#getSerial crash on Android 10.
+* `20/04/20` [fix] ImageUtils#isImage.
+* `20/04/18` [fix] PermissionUtils#callback. Publish v1.28.1.
+* `20/04/17` [fix] ImageUtils#view2Bitmap, ImageUtils.getBitmap(InputStream).
+* `20/04/16` [add] ConvertUtils#int2HexString, hexString2Int.
+* `20/04/15` [add] UiMessageUtils' demo.
+* `20/04/13` [add] NumberUtils. Publish v1.28.0.
+* `20/04/12` [opt] TimeUtils#SDF_THREAD_LOCAL.
+* `20/04/11` [add] SDCardUtils#getXxTotalSize, SDCardUtils#getXxAvailableSize. FileUtils#getFsTotalSize, FileUtils#getFsAvailableSize.
+* `20/04/10` [fix] FileUtils#isFileExists; FragmentUtils#getTop bug. Publish v1.27.6.
+* `20/04/09` [add] UriUtils#res2Uri, UriUtils#uri2File support QQBrowser; ThreadUtils#getMainHandler; PathUtils#getxxPathExternalFirst.
+* `20/04/08` [fix] ActivityUtils#finish bug. Publish v1.27.5.
+* `20/04/08` [fix] CleanUtils clean dir not work. FileUtils#isFileExists. Publish v1.27.4.
+* `20/04/08` [fix] CrashUtils DefaultUncaughtExceptionHandler is wrong; LogUtils write file failed; Utils#getApp failed run on remote process. Publish v1.27.3.
+* `20/04/07` [mdf] GsonUtils#getGson() method public.
+* `20/04/04` [fix] ShadowUtils bug running on lower version devices. Publish v1.27.2.
+* `20/04/03` [fix] UtilsActivityLifecycleImpl#HashMap#remove IllegalStateException bug.
+* `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.
+* `20/03/24` [add] UtilsBridge to clean the utils.
+* `20/03/22` [upd] GsonUtils support custom gson.
+* `20/03/20` [add] ActivityUtils#addActivityLifecycleCallbacks, ActivityUtils#removeActivityLifecycleCallbacks.
+* `20/01/17` [upd] Leak Canary to v2.1.
+* `20/01/06` [add] ClickUtils#expandClickArea, ClickUtils#back2HomeFriendly
+* `19/11/30` [add] Publish bus plugin v2.4. Publish api plugin v1.2.
+* `19/11/28` [add] Publish v1.26.0.
+* `19/11/27` [add] Shadow demo.
+* `19/11/26` [add] MVP demo.
+* `19/11/22` [fix] Adapt the project for Gradle version of 6.0.
+* `19/10/30` [add] Publish bus plugin v2.3. Publish api plugin v1.1.
+* `19/10/24` [upd] Demo's UI.
+* `19/10/22` [add] NotificationUtils and demo.
+* `19/10/20` [add] UiMessageUtils.
+* `19/09/20` [add] ShadowUtils.
+* `19/08/27` [add] DebugUtils.
+* `19/08/26` [fix] PermissionUtils NPE.
+* `19/08/25` [upd] ImageUtils#getImageType. [add] LogUtils#getLogFiles. Publish v1.25.9.
+* `19/08/24` [fix] PhoneUtils#getIMEI crash on SDK 29.
+* `19/08/23` [add] ViewUtils#isLayoutRtl.
+* `19/08/22` [add] LogUtils#getLogFiles.
+* `19/08/13` [add] MapUtils and MapUtilsTest. Publish v1.25.8.
+* `19/08/12` [add] CollectionUtils and CollectionUtilsTest.
+* `19/08/11` [add] ArrayUtils and ArrayUtilsTest.
+* `19/08/09` [fix] https://www.virustotal.com/gui/home/upload with ESET-NOD32. Publish v1.25.7.
+* `19/08/08` [add] BusUtils#post tag support one-to-many. Publish v1.25.6.
+* `19/08/04` [add] ThreadUtils#Task support timeout.
+* `19/08/01` [upd] EncryptUtils#rsa.
+* `19/07/31` [add] DeviceUtils#getUniqueDeviceId, DeviceUtils#isSameDevice. Publish v1.25.5.
+* `19/07/30` [fix] ThreadUtils's task can only be executed once. PhoneUtils#getIMEI wrong.
+* `19/07/29` [fix] BusUtils post father class useless. KeyboardUtils#hideSoft bug. Publish v1.25.4.
+* `19/07/28` [add] NetworkUtils#(un)registerNetworkStatusChangedListener. Publish v1.25.3.
+* `19/07/27` [fix] ThreadUtils memory leak.
+* `19/07/26` [add] ContainerUtils. Publish v1.25.2.
+* `19/07/25` [fix] PermissionUtils' NullPointException.
+* `19/07/24` [fix] ZipUtils#unzipFile.
+* `19/07/23` [fix] ThreadUtils of cache pool. Publish v1.25.1.
+* `19/07/18` [add] README of ApiUtils and BusUtils.
+* `19/07/15` [add] Publish v1.25.0.
+* `19/07/14` [upd] Bus plugin for use BusUtils. Publish bus plugin v2.0.
+* `19/07/13` [add] Api plugin for use ApiUtils. Publish api plugin v1.0.
+* `19/07/09` [upd] The frame of project.
+* `19/07/06` [upd] BusUtils which behave same as EventBus.
+* `19/07/03` [add] ApiUtils which decoupling modules.
+* `19/06/30` [add] LanguageUtils support activity's class name.
+* `19/06/29` [add] ClickUtils#OnMultiClickListener, and remove dangerous function. Publish v1.24.6.
+* `19/06/28` [add] LanguageUtils. Publish v1.24.5.
+* `19/06/20` [fix] BusUtils' permission. Publish v1.24.4.
+* `19/06/19` [fix] UriUtils. Publish v1.24.3.
+* `19/06/18` [add] ClickUtils, ViewUtils.
+* `19/06/07` [fix] LogUtils file name contains ':'. Publish v1.24.2.
+* `19/06/06` [fix] LogUtils write to file. Publish v1.24.1.
+* `19/06/03` [fix] Refactoring framework. Publish v1.24.0.
+* `19/04/25` [fix] LogUtils delete due log.
+* `19/04/24` [upd] The swipe panel.
+* `19/03/17` [fix] The ugly UI.
+* `19/03/14` [fix] AdaptScreenUtils didn't work on some HaWei tablet.
+* `19/03/09` [fix] UriUtils#uri2File.
+* `19/03/08` [add] LogUtils support multi process. Publish v1.23.7.
+* `19/03/02` [fix] LogUtils#file.
+* `19/02/28` [fix] ImageUtils#calculateInSampleSize. Publish v1.23.6.
+* `19/02/26` [fix] UriUtils#uri2File. Publish v1.23.5.
+* `19/01/31` [add] HttpUtils.
+* `19/01/30` [add] RomUtils. Publish v1.23.4.
+* `19/01/29` [fix] LogUtils format json when json not start with '{'. Publish v1.23.3.
+* `19/01/28` [fix] KeyboardUtils#fixSoftInputLeaks don't work on the device of HuaWei.
+* `19/01/26` [fix] NetworkUtils#getNetworkType.
+* `19/01/25` [add] CloneUtils, PermissionUtils support request permission of WRITE_SETTINGS and DRAW_OVERLAYS. Publish v1.23.2.
+* `19/01/24` [add] BrightnessUtils and FlashlightUtils.
+* `19/01/23` [add] Modify the demo of utilcode use kotlin. Publish v1.23.1.
+* `19/01/22` [fix] AppUtils#installApp.
+* `19/01/17` [fix] Publish v1.23.0.
+* `19/01/16` [fix] BarUtils get Activity from view and delete the function of set status bar alpha.
+* `19/01/15` [add] ColorUtils.
+* `19/01/04` [add] CacheDiskStaticUtils, CacheDoubleStaticUtils, CacheMemoryStaticUtils.
+* `19/01/03` [add] SPStaticUtils.
+* `19/01/02` [fix] LogUtils log object. Publish v1.22.10.
+* `19/01/01` [add] GsonUtils.
+* `18/12/29` [add] AntiShakeUtils and VibrateUtils. Publish v1.22.9.
+* `18/12/28` [fix] ToastUtils show behind the dialog when close notification.
+* `18/12/27` [fix] LogUtils print StringBuilder failed.
+* `18/12/24` [fix] Utils$ActivityLifecycleImpl.consumeOnActivityDestroyedListener ConcurrentModificationException. Publish v1.22.7.
+* `18/12/22` [fix] AdaptScreenUtils#pt2px don't work when start webview. Publish v1.22.6.
+* `18/12/21` [add] LogUtils support print Map, Collection and Object to String.
+* `18/12/19` [fix] AdaptScreenUtils don't work in MIUI on Android 5.1.1. Publish v1.22.5.
+* `18/12/18` [fix] ToastUtils multi show crash when run API 25. Publish v1.22.4.
+* `18/12/18` [fix] ImageUtils recycle ret equals src. Publish v1.22.3.
+* `18/12/17` [fix] Utils$FileProvider4UtilCode not found. Publish v1.22.3.
+* `18/12/17` [fix] ToastUtils leak. Publish v1.22.2.
+* `18/12/09` [add] Component for the project.
+* `18/12/04` [add] BusUtils. Publish v1.22.1.
+* `18/11/18` [fix] ToastUtils don't show in the devices grater than API 24 when close the permission of notification. Publish v1.22.0.
+* `18/11/17` [fix] AppUtils#isAppInstalled don't work in no launcher app.
+* `18/11/16` [fix] ThreadUtils#cancel block the main thread.
+* `18/11/15` [add] module of bus-gradle-plugin and change style of gradle.
+* `18/11/14` [add] BusUtils.
+* `18/11/13` [add] AdaptScreenUtils.
+* `18/11/12` [fix] SPUtils bug when use in multi threads.
+* `18/10/25` [fix] SpanUtils#setLineHeight bug of multi lines. Publish v1.21.2.
+* `18/10/24` [fix] SpanUtils#appendImage on VIVO. Publish v1.21.1.
+* `18/10/16` [add] BusUtils, DeviceUtils#isAdbEnabled. Publish v1.21.0.
+* `18/09/29` [fix] ToastUtils which causes crash in the some devices of Xiaomi. Publish v1.20.4.
+* `18/09/13` 修复 ToastUtils 在小米手机显示 Toast 带有 App 名,发布 1.20.3
+* `18/09/12` 修复 KeyBoardUtils#fixAndroidBug5497,完善 ToastUtils,发布 1.20.2
+* `18/09/11` 新增 BarUtils#isSupportNavBar,删除 BarUtils#setNavBarImmersive
+* `18/09/10` 修复 KeyboardUtils 中 getWindowVisibleDisplayFrame 空指针异常,更新 BarUtils#isNavBarVisible
+* `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
+* `18/08/26` 新增 AppUtils#getAppSignatureSHA256 和 AppUtils#getAppSignatureMD5,发布 1.19.3
+* `18/08/24` 新增 ScreenUtils#restoreAdaptScreen,利用 FileProvider4UtilCode 不再需要初始化,发布 1.19.2
+* `18/08/23` 修复 适配后 ToastUtils 原生 Toast 尺寸发生改变的问题,修复 KeyboardUtils#fixSoftInputLeaks,发布 1.19.1
+* `18/08/10` 修复 ScreenUtils#adaptxx 导致获取状态栏和导航栏尺寸不对问题,发布 1.19.0
+* `18/08/09` 新增 IntentUtils#isIntentAvailable,ToastUtils 传入空显示 null,发布 1.18.6
+* `18/08/08` 修复 ScreenUtils#adaptxx 在第三方 SDK 会出现的问题,发布 1.18.5
+* `18/08/07` 修复 ScreenUtils#adaptxx 在 API 26 以下无效的 bug,发布 1.18.4
+* `18/08/06` 修复 ScreenUtils#screenShot 中 decorView.getDrawingCache() 为空的问题,发布 1.18.3
+* `18/08/05` 修复 1.18.0 版本删去 `if (activity.getClass() == PermissionUtils.PermissionActivity.class) return;` 造成 PermissionUtils 获取栈顶 Activity 问题,发布 1.18.2
+* `18/08/04` 新增 LogUtils#Config#setSaveDays,发布 1.18.1
+* `18/08/03` 新增 LogUtils#Config#addFormatter,并新增 Array, Throwable, Bundle, Intent 的格式化输出
+* `18/08/02` 修复 TimeUtils 中的 SimpleDateFormat 为 ThreadLocal 实现
+* `18/08/01` 删除 标记废弃的 CacheUtils, AppUtils#installApp, TimeUtils#getWeekIndex,发布 1.18.0
+* `18/07/30` 替换 ScreenUtils#adaptPortraitScreen 和 ScreenUtils#adaptLandscapeScreen,为 ScreenUtils#adaptScreen4VerticalSlide 和 ScreenUtils#adaptScreen4HorizontalSlide
+* `18/07/28` 修复 NetworkUtils#getIPAddress
+* `18/07/16` 新增 ScreenUtils#adaptPortraitScreen 和 ScreenUtils#adaptLandscapeScreen,发布 1.17.3
+* `18/07/13` 修复 IntentUtils 分享图片判断逻辑,CacheDiskUtils 可放入 byte[0]
+* `18/06/29` 修复 FragmentUtils 中 getFragmentManager 空指针错误,发布 1.17.2
+* `18/06/27` 新增 UriUtils#uri2File
+* `18/06/25` 新增 KeyboardUtils#fixAndroidBug5497,发布 1.17.1 版本
+* `18/06/21` 修复 FragmentUtils#add 死循环的 BUG
+* `18/06/14` 替换 CacheUtils 为 CacheDiskUtils,CacheUtils 标记 deprecated,发布 1.17.0 版本
+* `18/06/13` 新增 CacheMemoryUtils 和 CacheDoubleUtils
+* `18/06/12` 完善 FragmentUtils#add 和 replace 新增 tag
+* `18/05/30` 完善 DeviceUtils#getMacAddress,发布 1.16.4 版本
+* `18/05/30` 修复 ToastUtils 在 targetSdkVersion 为 27 在 api 25 机器快速 show 两次崩溃的异常,发布 1.16.3 版本
+* `18/05/29` 完善 TimeUtils 的 timeSpan 带符号位,ToastUtils 去除弱引用,发布 1.16.2 版本
+* `18/05/25` 新增 AppUtils#registerAppStatusChangedListener 和 AppUtils#unregisterAppStatusChangedListener,发布 1.16.1 版本
+* `18/05/22` 新增 ThreadUtils,发布 1.16.0 版本
+* `18/05/15` 新增 MetaDataUtils 和 ActivityUtils#startActivityForResult,发布 1.15.1 版本
+* `18/05/08` 新增 ResourceUtils,发布 1.15.0 版本
+* `18/05/07` 修复 ZipUtils 漏洞,发布 1.14.4 版本
+* `18/05/03` 修复 ToastUtils 默认字体大小问题,发布 1.14.3 版本
+* `18/05/02` 修复 PermissionUtils 空异常,发布 1.14.2 版本
+* `18/04/28` 新增 FlashlightUtils,发布 1.14.1 版本
+* `18/04/26` 修复 KeyboardUtils 全屏 NO_LIMIT 的 bug
+* `18/04/25` 修复 多个空异常
+* `18/04/24` 修复 多 FileProvider 带来的问题,发布 1.14.0 版本
+* `18/04/23` 新增 RSA 加解密,发布 1.13.16 版本
+* `18/04/22` 新增 LogUtils 设置栈偏移
+* `18/04/21` 新增 AppUtils#relaunchApp、DeviceUtils#getABIs,发布 1.13.15 版本
+* `18/04/20` 新增 BarUtils#setNavBarColor、BarUtils#getNavBarColor
+* `18/04/19` 新增 Process#isMainProcess、Process#getCurrentProcessName,发布 1.13.14 版本
+* `18/04/18` 修复 LogUtils 头部空指针异常,SPUtils、CacheUtils 存储空值异常,发布 1.13.13 版本
+* `18/04/17` 修复 ToastUtils 内存泄漏问题,感谢 [LambertCoding](https://github.com/LambertCoding),发布 1.13.12 版本
+* `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 版本
+* `18/04/06` 新增 GsonUtils 及单元测试
+* `18/04/05` 完善 README 文档
+* `18/04/03` 修复 LogUtils 在 Android Studio 3.1 版本日志丑陋的问题,发布 1.13.7 版本
+* `18/03/29` 兼容 Utils 的初始化传入 application,发布 1.13.6 版本
+* `18/03/20` 修复 PermissionUtils 子进程的问题,发布 1.13.5 版本
+* `18/03/16` 新增 gradle 插件来格式化 README
+* `18/03/14` 修复 KeyboardUtils#getContentViewInvisibleHeight,发布 1.13.4 版本
+* `18/03/10` 完善 AppUtils#installAppSilent 和 DeviceUtils#getMacAddress,发布 1.13.3 版本
+* `18/03/09` 完善 ActivityUtils#getTopActivity
+* `18/03/08` 新增 反射获取栈顶 Activity 的方法,发布 1.13.2 版本
+* `18/03/07` 修复 PermissionUtils 请求权限为 0 的 崩溃
+* `18/03/05` 修复 Library Source does not match the bytecode for class LogUtils 问题,发布 1.13.1 版本
+* `18/03/04` 完善 Javadoc 中文版为英文版,发布 1.13.0 版本
+* `18/03/04` 完善 Javadoc 中文版为英文版
+* `18/03/03` 完善 Javadoc 中文版为英文版
+* `18/03/02` 完善 Javadoc 中文版为英文版
+* `18/03/01` 完善 Javadoc 中文版为英文版
+* `18/02/28` 完善 Javadoc 中文版为英文版
+* `18/02/27` 完善 Javadoc 中文版为英文版
+* `18/02/26` 完善 Javadoc 中文版为英文版
+* `18/02/25` 完善 Javadoc 中文版为英文版
+* `18/02/24` 完善 Javadoc 中文版为英文版
+* `18/02/23` 完善 Javadoc 中文版为英文版
+* `18/02/22` 完善 Javadoc 中文版为英文版
+* `18/02/21` 完善 Javadoc 中文版为英文版
+* `18/02/10` 完善 Javadoc 中文版为英文版
+* `18/02/09` 完善 非空转换插件 traute 的使用方式
+* `18/02/08` 修复 ActivityUtils option 低版本为空的异常
+* `18/01/31` 修复 default 相关的逻辑错误,发布 1.12.4,修复 ToastUtils 在 kotlin 中转义失败,发布 1.12.5
+* `18/01/28` 修复 ToastUtils 默认样式问题,发布 1.12.2,新增 DeviceUtils#getSDKVersionName,发布 1.12.3
+* `18/01/27` 修复 PermissionUtils 某些机型闪烁问题,发布 1.12.1
+* `18/01/17` 完善 ReflectUtils 及单元测试,发布 1.12.0 版本
+* `18/01/16` 完善 ReflectUtils 及单元测试
+* `18/01/15` 完善 ReflectUtils 及单元测试
+* `18/01/14` 完善 ReflectUtils 及单元测试
+* `18/01/13` 完善 ReflectUtils 及单元测试
+* `18/01/12` 完善 ReflectUtils 及单元测试
+* `18/01/11` 修复 ImageUtils 的 fastBlur radius 为 1 recycle 的 bug,新增 CrashUtils 初始化崩溃监听事件,发布 1.11.1 版本
+* `18/01/10` 完善 PermissionUtils 及 readme,发布 1.11.0 版本
+* `18/01/09` 完善 demo 动态权限适配
+* `18/01/08` 新增 SPActivity,删除 SPUtils 的单元测试
+* `18/01/08` 修复 ToastUtils 在 SDK 为 18 的自定义 toast 崩溃问题
+* `18/01/07` 新增 PermissionUtils 的 Demo
+* `18/01/06` 修复 权限相关工具类内存泄漏问题
+* `18/01/05` 新增 获取 Activity icon 和 logo
+* `18/01/04` 完善 6.0 动态权限相关工具类
+* `18/01/03` 完善 6.0 动态权限相关工具类
+* `18/01/02` 完善 6.0 动态权限相关工具类
+* `18/01/01` 新增 6.0 动态权限相关工具类
+* `17/12/30` 删除 SpanUtils 中设置图标
+* `17/12/29` 完善 SpanUtils 的 appendImage 对齐方式
+* `17/12/28` 完善 ScreenUtils 设置全屏的方式,发布 1.10.0
+* `17/12/26` 新增 状态栏、导航栏设置是否可见和判断是否可见
+* `17/12/22` 新增 注册软键盘改变监听器、注册导航栏改变监听器方法
+* `17/12/21` 完善 获取屏幕宽高,修复行宽度大于 100 字符
+* `17/12/20` 修复 SpanUtils 图标的 bug,不高于 6.0 的版本不支持居中和底部对齐
+* `17/12/19` 修复 SpanUtils 多图的 bug
+* `17/12/15` 新增 ReflectUtils
+* `17/12/14` 完善 手机号(精确)正则,发布 1.9.12
+* `17/12/12` 完善 LogUtils,当最终日志长度为 0 时,输出 log nothing
+* `17/12/11` 完善 ActivityUtils 的 finish 系列,发布 1.9.11
+* `17/12/04` 完善 LogUtils 边框改为单线清爽型
+* `17/11/30` 修复 ToastUtils 背景问题,发布 1.9.10
+* `17/11/30` 修复 ToastUtils 获取背景为空,发布 1.9.9
+* `17/11/28` 修复 EmptyUtils 对 CharSequence 的判断,感谢 jiezigg
+* `17/11/24` 新增 readme 格式化的 gradle 脚本
+* `17/11/15` 完善 资源分包位置,使其更合理
+* `17/11/10` 完善 LogUtils 新增日志头部,感谢 Kanade
+* `17/11/07` 完善 LogUtils 无 tag 的多参数
+* `17/11/06` 修复 LogUtils 多参数打印失败的问题
+* `17/11/01` 完善 ShellUtil 的 Msg 换行,感谢香脆的大鸡排
+* `17/10/30` 完善 README
+* `17/10/29` 修复 6.0 内部存储安装失败问题
+* `17/10/28` 完善 compile 为 implementation, provided 为 compileOnly
+* `17/10/27` 修复 兼容 AS3.0
+* `17/10/27` 修复 LogUtils 在 kotlin 中使用的问题
+* `17/10/25` 修复 LogUtils 边框,修复 getBitmap 从流获取
+* `17/09/30` 完善 FragmentUtils,发布 1.9.2
+* `17/09/29` 完善 FragmentUtils 和 isInstallApp
+* `17/09/28` 完善 FragmentUtils
+* `17/09/27` 完善 FragmentUtils
+* `17/09/26` 完善 ActivityUtils 及 Demo,发布 1.9.1
+* `17/09/25` 完善 ActivityUtils 及 Demo
+* `17/09/24` 完善 ActivityUtils 及 Demo
+* `17/09/23` 完善 FragmentUtils
+* `17/09/19` 修复 CrashUtils 自定义路径错误
+* `17/09/18` 完善 ImageUtils 的 Demo
+* `17/09/17` 完善 ImageUtils 的 compress
+* `17/09/13` 完善 ImageUtils 的 addBorder
+* `17/09/13` 完善 ImageUtils 的 toRound
+* `17/09/13` 完善 ImageUtils 和 LogUtils
+* `17/09/12` 完善 ImageUtils
+* `17/09/10` 完善 单元测试
+* `17/09/08` 完善 单元测试
+* `17/09/06` 完善 SDCardUtils 获取 SD 卡路径,完善 SPUtils 新增 commit
+* `17/09/05` 完善 LogUtils,发布版本 1.9.0
+* `17/09/04` 完善 ToastUtils,去除相关 safe 函数,都改为 safe 实现,新增 CustomToast 的 Demo
+* `17/09/02` 完善 ToastUtils,去除引入 view 带来的问题,发布版本 1.8.6
+* `17/08/30` 修复 ToastUtils 弱引用带来的问题,修复 CacheUtils 异步问题,发布版本 1.8.5
+* `17/08/28` 修复 ToastUtils 内存泄露,新增 toast 可根据系统字体显示不同字体,发布版本 1.8.4
+* `17/08/20` 新增 监听 Activity 生命周期,退出 App,发布版本 1.8.3
+* `17/08/11` 完善 LogUtils 的 Builder 改为 Config,发布版本 1.8.2
+* `17/08/10` 完善 FileUtils 的 deleteFilesInDir 和 listFilesInDir
+* `17/08/08` 新增 反射工具类 ReflectUtils
+* `17/08/06` 完善 为按功能分包,增加 subutil 的 Demo
+* `17/07/31` 修复 NetworkUtils 的 isAvailableByPing 循环递归,发布 1.8.1
+* `17/07/31` 完善 BarUtils,发布 1.8.0
+* `17/07/31` 完善 BarUtils
+* `17/07/30` 完善 BarUtils
+* `17/07/29` 完善 BarUtils
+* `17/07/28` 完善 BarUtils
+* `17/07/27` 完善 BarUtils
+* `17/07/26` 完善 ActivityUtils
+* `17/07/25` 完善 BarUtils,更新布局文件
+* `17/07/24` 完善 BarUtils
+* `17/07/23` 完善 BarUtils
+* `17/07/22` 完善 BarUtils
+* `17/07/21` 完善 xml 文件的格式化
+* `17/07/17` 完善 NetworkUtils 的 isAvailableByPing 函数新增 ip 参数
+* `17/07/14` 修复 FragmentUtils 的 FragmentNode 为 public
+* `17/07/11` 完善 将不常用的工具类放在 subutil 中
+* `17/07/10` 新增 subutil 库
+* `17/07/07` 修复 TimeUtils 中获取当天零点的 bug
+* `17/07/02` 完善 BarUtils 的 Demo
+* `17/07/01` 完善 BarUtils 的 Demo
+* `17/06/30` 完善 BarUtils 的 Demo
+* `17/06/29` 新增 README logo
+* `17/06/28` 新增 返回键及右划返回
+* `17/06/27` 新增 Toolbar
+* `17/06/26` 新增 final 参数
+* `17/06/23` 完善 Demo 主页
+* `17/06/20` 完善 ToastUtil, SnackbarUtils 新增设置底边距
+* `17/06/17` 删除 HandlerUtils
+* `17/06/16` 新增 insight.io 的 bandage
+* `17/06/14` 完善 LogUtils 回退栈,发布 1.7.1 版本
+* `17/06/13` 完善 Snackbar 和 Toast 的 Demo
+* `17/06/12` 完善 Snackbar 为建造者模式
+* `17/06/11` 完善 SpanUtils,发布版本 1.7.0
+* `17/06/08` 完善 SpanUtils
+* `17/06/07` 完善 SpannableStringUtils 改名为 SpanUtils,即将完工
+* `17/06/06` 完善 SpannableStringUtils
+* `17/06/05` 完善 SpannableStringUtils
+* `17/06/04` 完善 SpannableStringUtils
+* `17/06/03` 完善 SpannableStringUtils
+* `17/06/02` 完善 SpannableStringUtils
+* `17/06/01` 完善 KeyBoardUtils 及 Demo
+* `17/05/30` 完善 CrashUtils,发布 1.6.4
+* `17/05/28` 修复 CacheUtils 的 bug,发布 1.6.3
+* `17/05/27` 修复 CacheUtils 的 bug,发布 1.6.2
+* `17/05/26` 完善 CacheUtils,发布 1.6.0 和 1.6.1
+* `17/05/25` 完善 FileIOUtils 和 CacheUtils
+* `17/05/23` 新增 读取文件到字符数组中两种方式
+* `17/05/19` 新增 LogUtils 文件过滤和控制台开关
+* `17/05/16` 新增 ActivityUtils 动画
+* `17/05/12` 新增 base 系列
+* `17/05/11` 修复 SpannableStringUtils 的 setDrawable 的 bug,发布 1.5.1
+* `17/05/10` 完善 7.0 安装 App,完善 AppActivity
+* `17/05/09` 完善 TimeUtils 单元测试
+* `17/05/08` 更新 BarUtils, LogUtils 新增配置文件,TimeUtils 将 pattern 改为 format,发布 1.5.0
+* `17/05/04` 新增 签名
+* `17/05/03` 修复 对齐头部日期
+* `17/05/02` 完善 Demo 的 string 字符串变更,完善 ToastUtils 和 SnackbarUtils
+* `17/04/27` 新增 Travis CI,使用 shields,发布 1.4.1
+* `17/04/26` 完善 HandlerUtils 使用 Handler#CallBack 的回调接口及 SpannableStringUtils 图片对齐
+* `17/04/24` 修复 拼写错误,修复 StringUtils 的 equalsIgnoreCase
+* `17/04/23` 完善 README
+* `17/04/21` 完善 TimeUtils,发布 1.4.0
+* `17/04/20` 新增 SpannableStringUtils 设置字体尺寸
+* `17/03/29` 修改 README
+* `17/03/27` 更新 LogUtils
+* `17/03/26` 更新 LogUtils
+* `17/03/25` 更新 LogUtils
+* `17/03/24` 完善 StringUtils
+* `17/03/20` 修复 链接错误
+* `17/03/19` 新增 LogUtils 栈回溯
+* `17/03/14` 新增 常量包
+* `17/02/14` 完善 FragmentUtils 中,Demo 测试中
+* `17/02/13` 完善 FragmentUtils 中
+* `17/02/12` 完善 FragmentUtils 中
+* `17/02/11` 完善 FragmentUtils 中
+* `17/02/10` 完善 FragmentUtils 中,LogUtils 对长度进行分割
+* `17/02/09` 完善 FragmentUtils 中
+* `17/02/08` 完善 FragmentUtils 中
+* `17/02/07` 完善 FragmentUtils 中
+* `17/02/06` 完善 FragmentUtils 中,炸断肠
+* `17/02/05` 完善 FragmentUtils 中
+* `17/02/04` 完善 FragmentUtils 中
+* `17/02/03` 完善 FragmentUtils 中
+* `17/02/02` 完善 FragmentUtils 中
+* `17/02/01` 完善 FragmentUtils 中
+* `17/01/24` 完善 并发布版本 1.3.6
+* `17/01/16` 新增 LogUtils 打印类名函数名及所在行
+* `17/12/26` 新增 阴历相关工具类
+* `17/12/21` 完善 SpannableStringUtils
+* `16/12/19` 完善 SpannableStringUtils
+* `16/12/18` 完善 SpannableStringUtils,采用构造者模式
+* `16/12/17` 完善 SpannableStringUtils
+* `16/12/16` 完善 拼音工具类
+* `16/12/15` 完善 拼音工具类
+* `16/12/14` 新增 不低于 7.0 的 Html 解码
+* `16/12/13` 新增 获取文件最后修改时间
+* `16/12/12` 新增 Utils 来做初始化 context
+* `16/12/10` 完善 权限中
+* `16/12/09` 新增 6.0 以上权限判断
+* `16/12/07` 修复升级到 6.0 bug 中
+* `16/12/06` 完善 FlashlightUtils 中
+* `16/12/05` 完善 FlashlightUtils 兼容 Api21 之后
+* `16/12/04` 新增 FlashlightUtils
+* `16/12/03` 完善 时间工具类
+* `16/12/02` 新增 获取合适型时间差
+* `16/12/01` 新增 获取生肖和星座
+* `16/11/30` 新增 获取友好型时间差
+* `16/11/23` 完善 LocationUtils 测试,发布 1.3.4
+* `16/11/22` 修复 LocationActivity 内存泄漏
+* `16/11/21` 完善 README
+* `16/11/20` 完善 LocationUtils
+* `16/11/19` 完善 SizeUtils
+* `16/11/18` 完善 LocationUtils
+* `16/11/17` 完善 LocationUtils
+* `16/11/16` 新增 拼音工具类,单独拎出来做了整理
+* `16/11/15` 完善 正则工具类
+* `16/11/14` 新增 启动服务
+* `16/11/13` 新增 判断 sim 卡是否准备好
+* `16/11/12` 新增 重启到 recovery 和 bootloader,新增获取 launcher activity,最近一直在博客搬家,所以更得有点少
+* `16/11/04` 修复 README 的缺少 process 的 bug
+* `16/11/03` 修复 SnackbarUtils 中 Snackbar 持有弱引用来消除内存泄漏
+* `16/11/02` 修复 内存泄漏中
+* `16/11/01` 完善 发布版本 1.3.3 内存泄漏检测中
+* `16/10/31` 完善 发布版本 1.3.1 和 1.3.2
+* `16/10/30` 修复 获取 IpAddress 对于小米手机的 Bug
+* `16/10/29` 新增 文件重命名和完善 root
+* `16/10/23` 完善 测试中
+* `16/10/22` 完善 测试中
+* `16/10/21` 完善 测试中
+* `16/10/20` 完善 测试中
+* `16/10/19` 修复 判断网络是否可用
+* `16/10/18` 完善 是否前台应用,完善网络状态
+* `16/10/17` 修复 获取签名,完善是否前台应用,完善网络状态
+* `16/10/16` 新增 SnackbarUtils
+* `16/10/15` 完善 AppUtils 的 isAppForeground
+* `16/10/14` 完善 README-CN 排版(强迫症一定要对齐)
+* `16/10/13` 完善 测试
+* `16/10/12` 新增 LogUtils 建造者模式,新增获取星期,发布版本 1.3.0,cheer
+* `16/10/11` 新增 EncryptUtils 的 Hmac 系列加密
+* `16/10/10` 完善 LogUtils
+* `16/10/09` 完善 ToastUtils
+* `16/10/08` 新增 AppUtils 静默安装和静默卸载
+* `16/10/07` 完善 EmptyUtils,新增很多判空
+* `16/10/05` 完善 Happy Wedding!
+* `16/10/04` 完善 Readme
+* `16/10/03` 修复 ConvertUtils
+* `16/10/02` 完善 CrashUtils 完毕
+* `16/10/01` 完善 Happy National Day!
+* `16/09/30` 完善 CrashUtils
+* `16/09/29` 完善 CleanUtils 测试完毕
+* `16/09/28` 新增 EmptyUtils,完善 AppUtils 完毕
+* `16/09/27` 新增 CleanUtils,完善 AppUtils
+* `16/09/26` 新增 根据域名获取 ip 地址(在此感谢 jp1017),新增 ClipboardUtils 单元测试,对 ImageUtils 进行了 bug 修复
+* `16/09/25` 新增 ClipboardUtils
+* `16/09/24` 完善 AppUtils
+* `16/09/23` 完善 工具类,新增 ActivityUtils、BarUtils、IntentUtils
+* `16/09/22` 完善 LogUtils 中
+* `16/09/21` 新增 LogUtils
+* `16/09/20` 完善 昨天的单元测试
+* `16/09/19` 新增 CameraUtils,新增获取中文首字母
+* `16/09/18` 修复 少许代码,发布 1.2.1
+* `16/09/15` 完善 Happy Mid-Autumn Festival!
+* `16/09/14` 完善 ImageUtils 完毕,完善了 6.0 及以上版本安装 App 的问题,发布版本 1.2.0
+* `16/09/13` 新增 英文版 README
+* `16/09/12` 完善 ZipUtils 及单元测试完美谢幕(支持空文件夹)
+* `16/09/11` 完善 不断更
+* `16/09/10` 完善 ZipUtils 和单元测试中
+* `16/09/09` 新增 字符串反转,ImageUtils 单元测试卡住中,暂时换为真机测试
+* `16/09/08` 修复 NetworkUtils 报空,ImageUtils 单元测试卡住中
+* `16/08/31` 完善 ImageUtils 单元测试中,之后 7 天鸡儿岭放假,停更
+* `16/08/30` 完善 ImageUtils 单元测试(获取保存图片有问题,卡卡卡住了)
+* `16/08/29` 完善 ImageUtils,新增 stack 模糊算法和快速模糊
+* `16/08/28` 完善 ImageUtils
+* `16/08/27` 完善 ConvertUtils,新增 ZipUtils
+* `16/08/26` 完善 ThreadPoolUtils 线程池相关工具类
+* `16/08/25` 完善 ConstUtils 时间和存储相关常量新增枚举,传参改为枚举更为友好,新增 ThreadPoolUtils 线程池相关工具类
+* `16/08/24` 新增 ConvertUtils 的 InputStream 与 byte[]和 String 相互转换,应用在 FileUtils 中读文件
+* `16/08/23` 修复 bug,接下来完善 SDCardUtils 和 ImageUtils
+* `16/08/22` 完善 SPUtils 将 commit 改为 apply 提高效率,将 SPUtils 改为构造函数法创建,FileUtils 新增查找函数,规范 JavaDoc
+* `16/08/21` 完善 FileUtils 单元测试,修复 FileUtils 的 bug,发布版本 1.1.2
+* `16/08/20` 完善 目录、FileUtils 单元测试,发布版本 1.1.1
+* `16/08/19` 完善 FileUtils 及单元测试,及其他小修小补(在此感谢 vpop 的三次 Pr)
+* `16/08/18` 完善 FileUtils 及单元测试,完善 ImageUtils
+* `16/08/17` 完善 FileUtils
+* `16/08/16` 新增 StringUtils 及单元测试,完善正则工具类,版本更新 1.1.0
+* `16/08/15` 新增 3DES 和 AES 加密及单元检测,加密解密工具类基本完善,目录更新
+* `16/08/14` 新增 DES 加密及单元检测
+* `16/08/13` 新增 MD2,SHA224,SHA256,SHA384,SHA512 加密及单元测试,正折腾 DES 加密
+* `16/08/12` 新增 Base64 和 Html 编码解码及他们的单元测试,新增 TimeUtils 单元测试,更新 md
+* `16/08/11` 新增 SDCardUtils, UnitUtils,单元测试慢慢完善中
+* `16/08/09` 修复 目录排版,新增 Download, Proguard 和 License
+* `16/08/08` 新增 Shell 工具类,已传 jcenter 遇到好多坑,javaDoc 惹的祸,注释一定要规范
+* `16/08/07` 新增 6.0 获取 Mac 地址方法,新增对 HTML 转义,新增编码解码工具类,新增 SP 工具类
+* `16/08/06` 完善 名包名,新增加密相关的单元测试,MD5 加密新增文件加密重载
+* `16/08/05` 新增 MD5 盐加密,完善 NetworkUtils,新增判断状态栏是否存在(在此感谢 tiandawu)
+* `16/08/04` 新增 时间工具类(在此感谢 yi520000 给的补充),手机正则分简单和精确(在此感谢 MIkeeJY),新增判断是否锁屏,注释分段落,目录按首字母排序
+* `16/08/03` 修复 onCreate 中获取 view 尺寸的 bug, MD5 和 SHA 的 Bug 修复完成(在此感谢 ssyijiu)
+* `16/08/02` 修复 wifi 设置界面 bug,注释排版还在修改,获取 mac 地址增加判空,新增 QQ群:74721490,欢迎加入,新增隐藏状态栏,注释更加全面,工具类已封装,写的时候真的是一个一个测试过去的,宝宝心里苦
+* `16/08/01` 新增 获取 SD 卡路径,手机和设备进行分类,代码 bug 修改部分,小修排版,正在封装类,新增目录中显示方法名,新增获取当前 App 版本 Code
+* `16/07/31` 新增 点击屏幕空白区域隐藏软键盘,未能成功增加本页目录跳转功能(不支持)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000..99d8833477
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017 Blankj
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README-CN.md b/README-CN.md
new file mode 100644
index 0000000000..5c85dca1fe
--- /dev/null
+++ b/README-CN.md
@@ -0,0 +1,87 @@
+[![logo][logo]](https://github.com/Blankj/AndroidUtilCode)
+
+[![frame][frame]](https://github.com/Blankj/AucFrameTemplate)
+
+[![auc][aucSvg]][auc] [![result][apiSvg]][result] [![build][buildSvg]][build] [![License][licenseSvg]][license]
+
+## [README of English][readme]
+
+## About
+
+**[AndroidUtilCode][readme]** :fire: 是一个强大易用的安卓工具类库,它合理地封装了安卓开发中常用的函数,具有完善的 Demo 和单元测试,利用其封装好的 APIs 可以大大提高开发效率,如今它主要包括两部分模块,其一是主工具类模块:**[utilcode][utilcode-cn]**,其中的工具类是开发中常用到的;其二是子工具类模块:**[subutil][subutil-cn]**,它包含的工具类并不是很常用,它的出现是为了防止主工具类的臃肿。 :fire:
+
+
+## Documentation
+
+### utilcode
+
+* [README of English][utilcode]
+* [README of Chinese][utilcode-cn]
+
+
+### subutil
+
+* [README of English][subutil]
+* [README of Chinese][subutil-cn]
+
+
+## Donations
+
+如果它对你帮助很大,并且你很想支持库的后续开发和维护,那么你可以扫下方二维码随意打赏我,就当是请我喝杯咖啡或是啤酒,我将不胜感激 :-)
+
+![donate][donate]
+
+
+## Contact
+
+[![Blog][blogSvg]][blog] [![jianshu][jianshuSvg]][jianshu] [![weibo][weiboSvg]][weibo] [![QQGroup][qqgroupSvg]][qqgroup]
+
+
+## [Change Log][changeLog.md]
+
+
+## 打个小广告
+
+欢迎加入我的小专栏「**[基你太美](https://xiaozhuanlan.com/Blankj)**」一起学习。
+
+
+[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
+
+[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame_cn.png
+
+[aucSvg]: https://github.com/Blankj/AndroidUtilCode/workflows/Android%20CI/badge.svg?branch=master
+[auc]: https://github.com/Blankj/AndroidUtilCode
+
+[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
+[result]: https://android-arsenal.com/result?level=14
+
+[buildSvg]: https://travis-ci.org/Blankj/AndroidUtilCode.svg?branch=master
+[build]: https://travis-ci.org/Blankj/AndroidUtilCode
+
+[licenseSvg]: https://img.shields.io/badge/License-Apache--2.0-brightgreen.svg
+[license]: https://github.com/Blankj/AndroidUtilCode/blob/master/LICENSE
+
+[readme]: https://github.com/Blankj/AndroidUtilCode
+[readme-cn]: https://github.com/Blankj/AndroidUtilCode/blob/master/README-CN.md
+
+[utilcode]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README.md
+[utilcode-cn]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README-CN.md
+
+[subutil]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/subutil/README.md
+[subutil-cn]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/subutil/README-CN.md
+
+[changeLog.md]: https://github.com/Blankj/AndroidUtilCode/blob/master/CHANGELOG.md
+
+[donate]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/donate.png
+
+[blogSvg]: https://img.shields.io/badge/Blog-@Blankj-34a48e.svg
+[blog]: http://blankj.com
+
+[jianshuSvg]: https://img.shields.io/badge/简书-@Blankj-34a48e.svg
+[jianshu]: http://www.jianshu.com/u/46702d5c6978
+
+[weiboSvg]: https://img.shields.io/badge/weibo-@__Blankj-34a48e.svg
+[weibo]: http://weibo.com/3076228982
+
+[qqgroupSvg]: https://img.shields.io/badge/QQ群-25206533-34a48e.svg
+[qqgroup]: https://shang.qq.com/wpa/qunwpa?idkey=d906789f84484465e2736f7b524366b4c23afeda38733d5c7b10fc3f6e406e9b
diff --git a/README.md b/README.md
index f87f11e875..9ae668e26e 100644
--- a/README.md
+++ b/README.md
@@ -1,104 +1,87 @@
-# Android开发人员不得不收集的代码(不断更新)
-为方便查找,已进行大致归类,其目录如下所示:
-> - [App相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_app.md)→[AppUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/AppUtils.java)
-> - 安装指定路径下的Apk *installApp*
-> - 卸载指定包名的App *uninstallApp*
-> - 获取当前App信息 *getAppInfo*
-> - 获取所有已安装App信息 *getAllAppsInfo*
-> - 打开指定包名的App *openAppByPackageName*
-> - 打开指定包名的App应用信息界面 *openAppInfo*
-> - 可用来做App信息分享 *shareAppInfo*
-> - 判断当前App处于前台还是后台 *isApplicationBackground*
-
-> - [设备相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_device.md)→[DeviceUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/DeviceUtils.java)
-> - 获取设备MAC地址 *getMacAddress*
-> - 获取设备厂商,如Xiaomi *getManufacturer*
-> - 获取设备型号,如MI2SC *getModel*
-> - 获取设备SD卡是否可用 *isSDCardEnable*
-> - 获取设备SD卡路径 *getSDCardPath*
-
-> - [加解密相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_encrypt.md)→[EncryptUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/EncryptUtils.java)
-> - MD5加密 *getMD5* *encryptMD5* *getMD5File*
-> - SHA加密 *getSHA* *encryptSHA*
-
-> - [键盘相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_keyboard.md)→[KeyboardUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/KeyboardUtils.java)
-> - 避免输入法面板遮挡
-> - 动态隐藏软键盘 *hideSoftInput*
-> - 点击屏幕空白区域隐藏软键盘(注释萌萌哒) *clickBlankArea2HideSoftInput0*
-> - 动态显示软键盘 *showSoftInput*
-> - 切换键盘显示与否状态 *toggleSoftInput*
-
-> - [网络相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_network.md)→[NetworkUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/NetworkUtils.java)
-> - 打开网络设置界面 *openWirelessSettings*
-> - 判断是否网络连接 *isConnected*
-> - 判断wifi是否连接状态 *isWifiConnected*
-> - 获取移动网络运营商名称 *getNetworkOperatorName*
-> - 获取移动终端类型 *getPhoneType*
-> - 获取连接的网络类型(2G,3G,4G) *getCurNetworkType*
-> - 获取当前手机的网络类型(WIFI,2G,3G,4G) *getNetWorkStatus*
-
-> - [手机相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_phone.md)→[PhoneUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/PhoneUtils.java)
-> - 判断设备是否是手机 *isPhone*
-> - 获取手机的IMIE *getDeviceIMEI*
-> - 获取手机状态信息 *getPhoneStatus*
-> - 跳至填充好phoneNumber的拨号界面 *dial*
-> - 拨打phoneNumber *call*
-> - 发送短信 *sendSms*
-> - 获取手机联系人 *getAllContactInfo*
-> - 打开手机联系人界面点击联系人后便获取该号码(注释萌萌哒) *getContantNum*
-> - 获取手机短信并保存到xml中 *getAllSMS*
-
-> - [正则相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_regular.md)→[RegularUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/RegularUtils.java)
-> - 正则工具类
-
-> - [屏幕相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_screen.md)→[ScreenUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/ScreenUtils.java)
-> - 获取手机分辨率 *getDeviceWidth*、*getDeviceHeight*
-> - 设置透明状态栏(api >= 19方可使用) *setTransparentStatusBar*
-> - 隐藏状态栏(注释萌萌哒) *hideStatusBar*
-> - 获取状态栏高度 *getStatusBarHeight*
-> - 获取ActionBar高度 *getActionBarHeight*
-> - 设置屏幕为横屏(注释萌萌哒) *setLandscape*
-> - 获取屏幕截图 *snapShotWithStatusBar*、*snapShotWithoutStatusBar*
-> - 判断是否锁屏 *isScreenLock*
-
-> - [尺寸相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_size.md)→[SizeUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/SizeUtils.java)
-> - dp与px转换 *dp2px*、*px2dp*
-> - sp与px转换 *sp2px*、*px2sp*
-> - 各种单位转换 *applyDimension*
-> - 在onCreate()即可强行获取View的尺寸 *forceGetViewSize*
-> - ListView中提前测量View尺寸(注释萌萌哒) *measureView*
-
-> - [时间相关](https://github.com/Blankj/AndroidUtilCode/blob/master/about_time.md)→[TimeUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/TimeUtils.java)
-> - 将时间戳转为时间字符串 *milliseconds2String*
-> - 将时间字符串转为时间戳 *string2Milliseconds*
-> - 将时间字符串转为Date类型 *string2Date*
-> - 将Date类型转为时间字符串 *date2String*
-> - 将Date类型转为时间戳 *date2Milliseconds*
-> - 将时间戳转为Date类型 *milliseconds2Date*
-> - 毫秒时间戳单位转换(单位:unit) *milliseconds2Unit*
-> - 获取两个时间差(单位:unit) *getIntervalTime*
-> - 获取当前时间 *getCurTimeMills* *getCurTimeString* *getCurTimeDate*
-> - 获取与当前时间的差(单位:unit) *getIntervalByNow*
-> - 判断闰年 *isLeapYear*
-
-> - [未归类](https://github.com/Blankj/AndroidUtilCode/blob/master/unclassified.md)→[UnclassifiedUtils.java](https://github.com/Blankj/AndroidUtilCode/blob/master/androidframework/src/main/java/com/blankj/androidframework/utils/UnclassifiedUtils.java)
-> - 获取服务是否开启 *isRunningService*
-> - [更新Log](https://github.com/Blankj/AndroidUtilCode/blob/master/update_log.md)
-
-***
-
- **做这份整理只是想把它作为Android的一本小字典,当遇到一些琐碎问题时,不用再面向百度或者谷歌查询API的使用,费时费力,这里有的话,大家尽管撸走。希望它能逐日壮大起来,期待你的Star和完善,用途的话大家想把它们整理成工具类或者什么的话都可以,之后我也会封装工具类并分享之,但本篇只是提供查阅,毕竟看md比看类文件要爽多了,其中好多代码我也是各种搜刮来的,也要谢谢各位的总结,大部分代码已验证过可行,如有错误,请及时告之,开设QQ群提供讨论,群号:74721490**
-
-# 更新Log
-#### 2016/07/31 新增点击屏幕空白区域隐藏软键盘
-#### 2016/07/31 新增目录跳转功能(然而简书不支持所以这里没更新)
-#### 2016/08/01 新增获取当前App版本Code
-#### 2016/08/01 新增目录中显示方法名
-#### 2016/08/01 新增获取SD卡路径,手机和设备进行分类,代码bug修改部分,小修排版,正在封装类
-#### 2016/08/02 wifi设置界面bug修复,注释排版还在修改,获取mac地址增加判空,新增QQ群:74721490,欢迎加入
-#### 2016/08/02 新增隐藏状态栏,注释更加全面,工具类已封装,写的时候真的是一个一个测试过去的,宝宝心里苦
-#### 2016/08/03 修复在onCreate中获取view尺寸的bug,MD5和SHA的Bug修复完成(在此感谢ssyijiu)
-#### 2016/08/04 新增时间工具类(在此感谢yi520000给的补充),手机正则分简单和精确(在此感谢MIkeeJY),新增判断是否锁屏,注释使用
分段落,目录按首字母排序
-
-
-##[关于Blankj](http://blankj.com/about)
\ No newline at end of file
+[![logo][logo]](https://github.com/Blankj/AndroidUtilCode)
+
+[![frame][frame]](https://github.com/Blankj/AucFrameTemplate)
+
+[![auc][aucSvg]][auc] [![result][apiSvg]][result] [![build][buildSvg]][build] [![License][licenseSvg]][license]
+
+## [README of Chinese][readme-cn]
+
+## About
+
+**[AndroidUtilCode][readme]** :fire: is a powerful & easy to use library for Android. This library encapsulates the functions that commonly used in Android development which have complete demo and unit test. By using it's encapsulated APIs, you can greatly improve the development efficiency. The program mainly consists of two modules which is **[utilcode][utilcode-cn]**, which is commonly used in development, and **[subutil][subutil-cn]** which is rarely used in development, but the utils can be beneficial to simplify the main module. :fire:
+
+
+## Documentation
+
+### utilcode
+
+* [README of English][utilcode]
+* [README of Chinese][utilcode-cn]
+
+
+### subutil
+
+* [README of English][subutil]
+* [README of Chinese][subutil-cn]
+
+
+## Donations
+
+If this project helps you a lot and you want to support the project's development and maintenance of this project, feel free to scan the following QR code for donation. Your donation is highly appreciated. Thank you!
+
+![donate][donate]
+
+
+## Contact
+
+[![Blog][blogSvg]][blog] [![jianshu][jianshuSvg]][jianshu] [![weibo][weiboSvg]][weibo] [![QQGroup][qqgroupSvg]][qqgroup]
+
+
+## [Change Log][changeLog.md]
+
+
+## 打个小广告
+
+欢迎加入我的小专栏「**[基你太美](https://xiaozhuanlan.com/Blankj)**」一起学习。
+
+
+[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
+
+[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
+
+[aucSvg]: https://github.com/Blankj/AndroidUtilCode/workflows/Android%20CI/badge.svg?branch=master
+[auc]: https://github.com/Blankj/AndroidUtilCode
+
+[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
+[result]: https://android-arsenal.com/result?level=14
+
+[buildSvg]: https://travis-ci.org/Blankj/AndroidUtilCode.svg?branch=master
+[build]: https://travis-ci.org/Blankj/AndroidUtilCode
+
+[licenseSvg]: https://img.shields.io/badge/License-Apache--2.0-brightgreen.svg
+[license]: https://github.com/Blankj/AndroidUtilCode/blob/master/LICENSE
+
+[readme]: https://github.com/Blankj/AndroidUtilCode
+[readme-cn]: https://github.com/Blankj/AndroidUtilCode/blob/master/README-CN.md
+
+[utilcode]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README.md
+[utilcode-cn]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README-CN.md
+
+[subutil]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/subutil/README.md
+[subutil-cn]: https://github.com/Blankj/AndroidUtilCode/blob/master/lib/subutil/README-CN.md
+
+[changeLog.md]: https://github.com/Blankj/AndroidUtilCode/blob/master/CHANGELOG.md
+
+[donate]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/donate.png
+
+[blogSvg]: https://img.shields.io/badge/Blog-@Blankj-34a48e.svg
+[blog]: http://blankj.com
+
+[jianshuSvg]: https://img.shields.io/badge/简书-@Blankj-34a48e.svg
+[jianshu]: http://www.jianshu.com/u/46702d5c6978
+
+[weiboSvg]: https://img.shields.io/badge/weibo-@__Blankj-34a48e.svg
+[weibo]: http://weibo.com/3076228982
+
+[qqgroupSvg]: https://img.shields.io/badge/QQ群-25206533-34a48e.svg
+[qqgroup]: https://shang.qq.com/wpa/qunwpa?idkey=d906789f84484465e2736f7b524366b4c23afeda38733d5c7b10fc3f6e406e9b
diff --git a/about_app.md b/about_app.md
deleted file mode 100644
index 28702610c5..0000000000
--- a/about_app.md
+++ /dev/null
@@ -1,270 +0,0 @@
-# App相关
-### 安装指定路径下的Apk
-``` java
-/**
- * 安装指定路径下的Apk
- *
联通的3G为UMTS或HSDPA,移动和联通的2G为GPRS或EGDE,电信的2G为CDMA,电信的3G为EVDO
- */
-public static int getNetTpye(Context context) {
- TelephonyManager telephonyManager = (TelephonyManager) context
- .getSystemService(Context.TELEPHONY_SERVICE);
- switch (telephonyManager.getNetworkType()) {
- case TelephonyManager.NETWORK_TYPE_GPRS:
- case TelephonyManager.NETWORK_TYPE_EDGE:
- case TelephonyManager.NETWORK_TYPE_CDMA:
- case TelephonyManager.NETWORK_TYPE_1xRTT:
- case TelephonyManager.NETWORK_TYPE_IDEN:
- return Constants.NETWORK_CLASS_2_G;
- case TelephonyManager.NETWORK_TYPE_UMTS:
- case TelephonyManager.NETWORK_TYPE_EVDO_0:
- case TelephonyManager.NETWORK_TYPE_EVDO_A:
- case TelephonyManager.NETWORK_TYPE_HSDPA:
- case TelephonyManager.NETWORK_TYPE_HSUPA:
- case TelephonyManager.NETWORK_TYPE_HSPA:
- case TelephonyManager.NETWORK_TYPE_EVDO_B:
- case TelephonyManager.NETWORK_TYPE_EHRPD:
- case TelephonyManager.NETWORK_TYPE_HSPAP:
- return Constants.NETWORK_CLASS_3_G;
- case TelephonyManager.NETWORK_TYPE_LTE:
- return Constants.NETWORK_CLASS_4_G;
- default:
- return Constants.NETWORK_CLASS_UNKNOWN;
- }
-}
-public class Constants {
- // Unknown network class
- public static final int NETWORK_CLASS_UNKNOWN = 0;
- // wifi network
- public static final int NETWORK_WIFI = 1;
- // "2G" networks
- public static final int NETWORK_CLASS_2_G = 2;
- // "3G" networks
- public static final int NETWORK_CLASS_3_G = 3;
- // "4G" networks
- public static final int NETWORK_CLASS_4_G = 4;
-}
-```
-
-### 获取当前手机的网络类型(WIFI,2G,3G,4G)
-``` java
-/**
- * 获取当前手机的网络类型(WIFI,2G,3G,4G)
- *
time1和time2格式都为format
- */
-public static long getIntervalByNow(String time, int unit, SimpleDateFormat format) {
- return getIntervalTime(getCurTimeString(), time, unit, format);
-}
-
-/**
- * 获取与当前时间的差(单位:unit)
- *
联通的3G为UMTS或HSDPA,移动和联通的2G为GPRS或EGDE,电信的2G为CDMA,电信的3G为EVDO
- */
- public static int getNetworkType(Context context) {
- TelephonyManager tm = (TelephonyManager) context
- .getSystemService(Context.TELEPHONY_SERVICE);
- switch (tm.getNetworkType()) {
- case TelephonyManager.NETWORK_TYPE_GPRS:
- case TelephonyManager.NETWORK_TYPE_EDGE:
- case TelephonyManager.NETWORK_TYPE_CDMA:
- case TelephonyManager.NETWORK_TYPE_1xRTT:
- case TelephonyManager.NETWORK_TYPE_IDEN:
- return Constants.NETWORK_CLASS_2_G;
- case TelephonyManager.NETWORK_TYPE_UMTS:
- case TelephonyManager.NETWORK_TYPE_EVDO_0:
- case TelephonyManager.NETWORK_TYPE_EVDO_A:
- case TelephonyManager.NETWORK_TYPE_HSDPA:
- case TelephonyManager.NETWORK_TYPE_HSUPA:
- case TelephonyManager.NETWORK_TYPE_HSPA:
- case TelephonyManager.NETWORK_TYPE_EVDO_B:
- case TelephonyManager.NETWORK_TYPE_EHRPD:
- case TelephonyManager.NETWORK_TYPE_HSPAP:
- return Constants.NETWORK_CLASS_3_G;
- case TelephonyManager.NETWORK_TYPE_LTE:
- return Constants.NETWORK_CLASS_4_G;
- default:
- return Constants.NETWORK_CLASS_UNKNOWN;
- }
- }
-
- public class Constants {
- // Unknown network class
- public static final int NETWORK_CLASS_UNKNOWN = 0;
- // wifi network
- public static final int NETWORK_WIFI = 1;
- // "2G" networks
- public static final int NETWORK_CLASS_2_G = 2;
- // "3G" networks
- public static final int NETWORK_CLASS_3_G = 3;
- // "4G" networks
- public static final int NETWORK_CLASS_4_G = 4;
- }
-
- /**
- * 获取当前手机的网络类型(WIFI,2G,3G,4G)
- *
- */
- public static final SimpleDateFormat DEFAULT_SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- /**
- * 各时间单位与毫秒的倍数
- */
- public static final int UNIT_MSEC = 1;
- public static final int UNIT_SEC = 1000;
- public static final int UNIT_MIN = 60000;
- public static final int UNIT_HOUR = 3600000;
- public static final int UNIT_DAY = 86400000;
-
- /**
- * 将时间戳转为时间字符串
- *
time1和time2格式都为format
- */
- public static long getIntervalByNow(String time, int unit, SimpleDateFormat format) {
- return getIntervalTime(getCurTimeString(), time, unit, format);
- }
-
- /**
- * 获取与当前时间的差(单位:unit)
- *
+ * author: blankj
+ * blog : http://blankj.com
+ * time : 2019/07/13
+ * desc :
+ *
+ */
+class GLog {
+
+ def static debugSwitch = true
+
+ static d(Object... contents) {
+ if (!debugSwitch) return contents
+ return l(contents)
+ }
+
+ static l(Object... contents) {
+ StringBuilder sb = new StringBuilder()
+ sb.append(LogConst.BORDER_TOP)
+ sb.append(borderMsg(processContents(contents)))
+ sb.append(LogConst.BORDER_BTM)
+ print sb.toString()
+ return contents
+ }
+
+ private static borderMsg(String msg) {
+ StringBuilder sb = new StringBuilder()
+ object2String(msg).split(LogConst.LINE_SEP).each { line ->
+ sb.append(LogConst.BORDER_LFT).append(line).append(LogConst.LINE_SEP)
+ }
+ return sb
+ }
+
+ private static processContents(final Object... contents) {
+ String body = LogConst.NULL
+ if (contents != null) {
+ if (contents.length == 1) {
+ body = object2String(contents[0])
+ } else {
+ StringBuilder sb = new StringBuilder()
+ int i = 0
+ for (int len = contents.length; i < len; ++i) {
+ Object content = contents[i]
+ sb.append("args[$i] = ")
+ .append(object2String(content))
+ .append(LogConst.LINE_SEP)
+ }
+ body = sb.toString()
+ }
+ }
+ return body.length() == 0 ? LogConst.NOTHING : body
+ }
+
+ static String object2String(Object object) {
+ if (object == null) return "null";
+ if (object.getClass().isArray()) return LogFormatter.array2String(object);
+ if (object instanceof List) return LogFormatter.list2String(object);
+ if (object instanceof Map) return LogFormatter.map2String(object);
+ if (object instanceof Throwable) return LogFormatter.throwable2String(object);
+ return object.toString();
+ }
+
+ static class LogFormatter {
+
+ private static array2String(Object object) {
+ if (object instanceof Object[]) {
+ return Arrays.deepToString((Object[]) object);
+ } else if (object instanceof boolean[]) {
+ return Arrays.toString((boolean[]) object);
+ } else if (object instanceof byte[]) {
+ return Arrays.toString((byte[]) object);
+ } else if (object instanceof char[]) {
+ return Arrays.toString((char[]) object);
+ } else if (object instanceof double[]) {
+ return Arrays.toString((double[]) object);
+ } else if (object instanceof float[]) {
+ return Arrays.toString((float[]) object);
+ } else if (object instanceof int[]) {
+ return Arrays.toString((int[]) object);
+ } else if (object instanceof long[]) {
+ return Arrays.toString((long[]) object);
+ } else if (object instanceof short[]) {
+ return Arrays.toString((short[]) object);
+ }
+ throw new IllegalArgumentException("Array has incompatible type: " + object.getClass());
+ }
+
+ private static list2String(List list) {
+ StringBuilder sb = new StringBuilder()
+ sb.append("[")
+ list.each { v ->
+ if (v instanceof Map || v instanceof List) {
+ sb.append(String.format("$LogConst.LINE_SEP%${deep++ * 8}s${object2String(v)},", ""))
+ deep--
+ } else {
+ sb.append(String.format("$LogConst.LINE_SEP%${deep * 8}s$v,", ""))
+ }
+ }
+ sb.deleteCharAt(sb.length() - 1)
+ if (deep - 1 == 0) {
+ sb.append("$LogConst.LINE_SEP]")
+ } else {
+ sb.append(String.format("$LogConst.LINE_SEP%${(deep - 1) * 8}s]", ""))
+ }
+ return sb.toString()
+ }
+
+ private static deep = 1;
+
+ private static map2String(Map map) {
+ StringBuilder sb = new StringBuilder()
+ sb.append("[")
+ map.each { k, v ->
+ if (v instanceof Map || v instanceof List) {
+ sb.append(String.format("$LogConst.LINE_SEP%${deep++ * 8}s%-26s: ${object2String(v)},", "", k))
+ deep--
+ } else {
+ sb.append(String.format("$LogConst.LINE_SEP%${deep * 8}s%-26s: $v,", "", k))
+ }
+ }
+ sb.deleteCharAt(sb.length() - 1)
+ if (deep - 1 == 0) {
+ sb.append("$LogConst.LINE_SEP]")
+ } else {
+ sb.append(String.format("$LogConst.LINE_SEP%${(deep - 1) * 8}s]", ""))
+ }
+ return sb.toString()
+ }
+
+ private static throwable2String(Throwable throwable) {
+ final List throwableList = new ArrayList<>();
+ while (throwable != null && !throwableList.contains(throwable)) {
+ throwableList.add(throwable);
+ throwable = throwable.getCause();
+ }
+ final int size = throwableList.size();
+ final List frames = new ArrayList<>();
+ List nextTrace = getStackFrameList(throwableList.get(size - 1));
+ for (int i = size; --i >= 0;) {
+ final List trace = nextTrace;
+ if (i != 0) {
+ nextTrace = getStackFrameList(throwableList.get(i - 1));
+ removeCommonFrames(trace, nextTrace);
+ }
+ if (i == size - 1) {
+ frames.add(throwableList.get(i).toString());
+ } else {
+ frames.add(" Caused by: " + throwableList.get(i).toString());
+ }
+ frames.addAll(trace);
+ }
+ StringBuilder sb = new StringBuilder();
+ for (final String element : frames) {
+ sb.append(element).append(LogConst.LINE_SEP);
+ }
+ return sb.toString();
+ }
+
+ private static List getStackFrameList(final Throwable throwable) {
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw, true);
+ throwable.printStackTrace(pw);
+ final String stackTrace = sw.toString();
+ final StringTokenizer frames = new StringTokenizer(stackTrace, LogConst.LINE_SEP);
+ final List list = new ArrayList<>();
+ boolean traceStarted = false;
+ while (frames.hasMoreTokens()) {
+ final String token = frames.nextToken();
+ // Determine if the line starts with at
+ final int at = token.indexOf("at");
+ if (at != -1 && token.substring(0, at).trim().isEmpty()) {
+ traceStarted = true;
+ list.add(token);
+ } else if (traceStarted) {
+ break;
+ }
+ }
+ return list;
+ }
+
+ private static void removeCommonFrames(final List causeFrames, final List wrapperFrames) {
+ int causeFrameIndex = causeFrames.size() - 1;
+ int wrapperFrameIndex = wrapperFrames.size() - 1;
+ while (causeFrameIndex >= 0 && wrapperFrameIndex >= 0) {
+ // Remove the frame from the cause trace if it is the same
+ // as in the wrapper trace
+ final String causeFrame = causeFrames.get(causeFrameIndex);
+ final String wrapperFrame = wrapperFrames.get(wrapperFrameIndex);
+ if (causeFrame.equals(wrapperFrame)) {
+ causeFrames.remove(causeFrameIndex);
+ }
+ causeFrameIndex--;
+ wrapperFrameIndex--;
+ }
+ }
+ }
+
+ static class LogConst {
+ static LINE_SEP = System.getProperty("line.separator");
+ static BORDER_TOP = "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────" + LINE_SEP
+ static BORDER_LFT = "│ ";
+ static BORDER_BTM = "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────" + LINE_SEP
+
+ static final NOTHING = "log nothing";
+ static final NULL = "null";
+ }
+}
diff --git a/buildSrc/src/main/groovy/LibConfig.groovy b/buildSrc/src/main/groovy/LibConfig.groovy
new file mode 100644
index 0000000000..6369553ba0
--- /dev/null
+++ b/buildSrc/src/main/groovy/LibConfig.groovy
@@ -0,0 +1,29 @@
+class LibConfig {
+
+ String path
+
+ String getGroupId() {
+ String[] splits = path.split(":")
+ return splits.length == 3 ? splits[0] : null
+ }
+
+ String getArtifactId() {
+ String[] splits = path.split(":")
+ return splits.length == 3 ? splits[1] : null
+ }
+
+ String getVersion() {
+ String[] splits = path.split(":")
+ return splits.length == 3 ? splits[2] : null
+ }
+
+ @Override
+ String toString() {
+ return "LibConfig { path = $path }"
+ }
+
+ static String getFlag(boolean b) {
+ return b ? "✅" : "❌"
+ }
+}
+
diff --git a/buildSrc/src/main/groovy/ModuleConfig.groovy b/buildSrc/src/main/groovy/ModuleConfig.groovy
new file mode 100644
index 0000000000..291abd8ffe
--- /dev/null
+++ b/buildSrc/src/main/groovy/ModuleConfig.groovy
@@ -0,0 +1,35 @@
+class ModuleConfig {
+
+ boolean isApply // 是否应用
+ boolean useLocal // 是否使用本地的
+ String localPath // 本地路径
+ String remotePath // 远程路径
+ def dep // 根据条件生成项目最终的依赖项
+
+ String getGroupId() {
+ String[] splits = remotePath.split(":")
+ return splits.length == 3 ? splits[0] : null
+ }
+
+ String getArtifactId() {
+ String[] splits = remotePath.split(":")
+ return splits.length == 3 ? splits[1] : null
+ }
+
+ String getVersion() {
+ String[] splits = remotePath.split(":")
+ return splits.length == 3 ? splits[2] : null
+ }
+
+ @Override
+ String toString() {
+ return "ModuleConfig { isApply = ${getFlag(isApply)}" +
+ ", dep = " + dep +
+ " }"
+ }
+
+ static String getFlag(boolean b) {
+ return b ? "✅" : "❌"
+ }
+}
+
diff --git a/buildSrc/src/main/groovy/PluginConfig.groovy b/buildSrc/src/main/groovy/PluginConfig.groovy
new file mode 100644
index 0000000000..3811c6a0ca
--- /dev/null
+++ b/buildSrc/src/main/groovy/PluginConfig.groovy
@@ -0,0 +1,35 @@
+final class PluginConfig {
+
+ boolean isApply = true // 是否应用
+ boolean useLocal // 是否使用本地的
+ String path // 插件路径
+ String id // 插件 ID
+
+ String getGroupId() {
+ String[] splits = path.split(":")
+ return splits.length == 3 ? splits[0] : null
+ }
+
+ String getArtifactId() {
+ String[] splits = path.split(":")
+ return splits.length == 3 ? splits[1] : null
+ }
+
+ String getVersion() {
+ String[] splits = path.split(":")
+ return splits.length == 3 ? splits[2] : null
+ }
+
+ @Override
+ String toString() {
+ return "PluginConfig { isApply = ${getFlag(isApply)}" +
+ ", useLocal = ${getFlag(useLocal)}" +
+ ", path = " + path +
+ ", id = " + id +
+ " }"
+ }
+
+ static String getFlag(boolean b) {
+ return b ? "✅" : "❌"
+ }
+}
\ No newline at end of file
diff --git a/buildSrc/src/main/groovy/TaskDurationUtils.groovy b/buildSrc/src/main/groovy/TaskDurationUtils.groovy
new file mode 100644
index 0000000000..6aacfcf30f
--- /dev/null
+++ b/buildSrc/src/main/groovy/TaskDurationUtils.groovy
@@ -0,0 +1,91 @@
+import org.gradle.BuildListener
+import org.gradle.BuildResult
+import org.gradle.api.Task
+import org.gradle.api.execution.TaskExecutionListener
+import org.gradle.api.initialization.Settings
+import org.gradle.api.invocation.Gradle
+import org.gradle.api.tasks.TaskState
+
+import java.text.SimpleDateFormat
+
+/**
+ *
+ * author: blankj
+ * blog : http://blankj.com
+ * time : 2019/11/22
+ * desc :
+ *
+ */
+class TaskDurationUtils {
+
+ static List taskInfoList = []
+ static long startMillis
+
+ static init(Gradle grd) {
+ startMillis = System.currentTimeMillis()
+ grd.addListener(new TaskExecutionListener() {
+ @Override
+ void beforeExecute(Task task) {
+ task.ext.startTime = System.currentTimeMillis()
+ }
+
+ @Override
+ void afterExecute(Task task, TaskState state) {
+ def exeDuration = System.currentTimeMillis() - task.ext.startTime
+ if (exeDuration >= 500) {
+ taskInfoList.add(new TaskInfo(task: task, exeDuration: exeDuration))
+ }
+ }
+ })
+ grd.addBuildListener(new BuildListener() {
+ @Override
+ void beforeSettings(Settings settings) {
+ super.beforeSettings(settings)
+ }
+
+ @Override
+ void buildStarted(Gradle gradle) {}
+
+ @Override
+ void settingsEvaluated(Settings settings) {}
+
+ @Override
+ void projectsLoaded(Gradle gradle) {}
+
+ @Override
+ void projectsEvaluated(Gradle gradle) {}
+
+ @Override
+ void buildFinished(BuildResult buildResult) {
+ if (!taskInfoList.isEmpty()) {
+ Collections.sort(taskInfoList, new Comparator() {
+ @Override
+ int compare(TaskInfo t, TaskInfo t1) {
+ return t1.exeDuration - t.exeDuration
+ }
+ })
+ StringBuilder sb = new StringBuilder()
+ int buildSec = (System.currentTimeMillis() - startMillis) / 1000;
+ int m = buildSec / 60;
+ int s = buildSec % 60;
+ def timeInfo = (m == 0 ? "${s}s" : "${m}m ${s}s (${buildSec}s)")
+ sb.append("BUILD FINISHED in $timeInfo\n")
+ taskInfoList.each {
+ sb.append(String.format("%7sms %s\n", it.exeDuration, it.task.path))
+ }
+ def content = sb.toString()
+ GLog.d(content)
+ File file = new File(grd.rootProject.buildDir.getAbsolutePath(),
+ "build_time_records_" + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date()) + ".txt")
+ file.getParentFile().mkdirs()
+ file.write(content)
+ }
+ }
+ })
+ }
+
+ private static class TaskInfo {
+ Task task
+ long exeDuration
+ }
+}
diff --git a/buildSrc/src/main/java/com/blankj/plugin/readme/FormatUtils.groovy b/buildSrc/src/main/java/com/blankj/plugin/readme/FormatUtils.groovy
new file mode 100644
index 0000000000..f617ff2eae
--- /dev/null
+++ b/buildSrc/src/main/java/com/blankj/plugin/readme/FormatUtils.groovy
@@ -0,0 +1,42 @@
+package com.blankj.plugin.readme
+
+class FormatUtils {
+
+ static def LINE_SEP = System.getProperty("line.separator")
+ static def LONG_SPACE = " "
+
+ static def format(File readmeCN) {
+ def sb = new StringBuilder(),
+ lines = readmeCN.readLines("UTF-8"),
+ i = 0,
+ size = lines.size()
+ for (; i < size; ++i) {
+ String line = lines.get(i)
+ if (line.contains("* ###")) {
+ sb.append(line).append(LINE_SEP)
+ .append("```").append(LINE_SEP)
+ def maxLen = 0
+ line = lines.get(i += 2)
+ // get the max length of space
+ for (def j = i; !line.equals("```"); line = lines.get(++j)) {
+ maxLen = Math.max(maxLen, line.replace(" ", "").replace(",", ", ").indexOf(':'))
+ }
+ line = lines.get(i)
+ for (; !line.equals("```"); line = lines.get(++i)) {
+ def noSpaceLine = line.replace(" ", "")
+ def spaceLen = maxLen - line.replace(" ", "").replace(",", ", ").indexOf(':')
+ sb.append(noSpaceLine.substring(0, noSpaceLine.indexOf(':')).replace(",", ", "))
+ .append(LONG_SPACE.substring(0, spaceLen))// add the space
+ .append(': ')
+ .append(line.substring(line.indexOf(':') + 1).trim())
+ .append(LINE_SEP)
+ }
+ sb.append("```")
+ } else {
+ sb.append(line)
+ }
+ sb.append(LINE_SEP)
+ }
+ readmeCN.write(sb.toString(), "UTF-8")
+ }
+}
diff --git a/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeCorePlugin.groovy b/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeCorePlugin.groovy
new file mode 100644
index 0000000000..8f3cf47780
--- /dev/null
+++ b/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeCorePlugin.groovy
@@ -0,0 +1,52 @@
+package com.blankj.plugin.readme
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+class ReadmeCorePlugin implements Plugin {
+
+ @Override
+ void apply(Project project) {
+ project.extensions.create('readme', ReadmeExtension)
+
+ project.task('readmeTask') {
+ doLast {
+ println "readmeTask start..."
+
+ def ext = project['readme'] as ReadmeExtension
+ def readmeCN = ext.readmeCnFile
+ def readmeEng = ext.readmeFile
+
+ readmeOfUtilCode2Eng(readmeCN, readmeEng)
+
+ println "readmeTask finished."
+ }
+ }
+ }
+
+ static def readmeOfUtilCode2Eng(File readmeCN, File readmeEng) {
+ FormatUtils.format(readmeCN)
+ def lines = readmeCN.readLines("UTF-8")
+ def sb = new StringBuilder()
+ readmeCN.eachLine { line ->
+ if (line.contains("* ###")) {
+ if (line.contains("UtilsTransActivity")) {
+ sb.append(line)
+ } else {
+ String utilsName = line.substring(line.indexOf("[") + 1, line.indexOf("Utils"))
+ sb.append("* ### About ").append(utilsName).append(line.substring(line.indexOf(" -> ")))
+ }
+ } else if (line.contains(": ") && !line.contains("[")) {
+ sb.append(line.substring(0, line.indexOf(':')).trim())
+ } else if (line.contains("打个小广告") || line.contains("基你太美")) {
+ return
+ } else {
+ sb.append(line)
+ }
+ sb.append(FormatUtils.LINE_SEP)
+ }
+ readmeEng.write(sb.toString(), "UTF-8")
+ }
+}
+
+
diff --git a/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeExtension.groovy b/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeExtension.groovy
new file mode 100644
index 0000000000..789e683c80
--- /dev/null
+++ b/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeExtension.groovy
@@ -0,0 +1,8 @@
+package com.blankj.plugin.readme
+
+class ReadmeExtension {
+
+ File readmeFile
+ File readmeCnFile
+
+}
diff --git a/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeSubPlugin.groovy b/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeSubPlugin.groovy
new file mode 100644
index 0000000000..bade51bbf4
--- /dev/null
+++ b/buildSrc/src/main/java/com/blankj/plugin/readme/ReadmeSubPlugin.groovy
@@ -0,0 +1,49 @@
+package com.blankj.plugin.readme
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+class ReadmeSubPlugin implements Plugin {
+
+ @Override
+ void apply(Project project) {
+ project.extensions.create('readme', ReadmeExtension)
+
+ project.task('readmeTask') {
+ doLast {
+ println "readmeTask start..."
+
+ def ext = project['readme'] as ReadmeExtension
+ def readmeCN = ext.readmeCnFile
+ def readmeEng = ext.readmeFile
+
+ readmeOfSubUtil2Eng(readmeCN, readmeEng)
+
+ println "readmeTask finished."
+ }
+ }
+ }
+
+ static def readmeOfSubUtil2Eng(File readmeCN, File readmeEng) {
+ FormatUtils.format(readmeCN)
+ def lines = readmeCN.readLines("UTF-8"),
+ sb = new StringBuilder("## How to use" + FormatUtils.LINE_SEP
+ + FormatUtils.LINE_SEP +
+ "You should copy the following classes which you want to use in your project." + FormatUtils.LINE_SEP),
+ i = 3,
+ size = lines.size()
+ for (; i < size; ++i) {
+ String line = lines.get(i)
+ if (line.contains("* ###")) {
+ String utilsName = line.substring(line.indexOf("[") + 1, line.indexOf("Utils"))
+ sb.append("* ### About ").append(utilsName).append(line.substring(line.indexOf(" -> ")))
+ } else if (line.contains(": ") && !line.contains("[")) {
+ sb.append(line.substring(0, line.indexOf(':')).trim())
+ } else {
+ sb.append(line)
+ }
+ sb.append(FormatUtils.LINE_SEP)
+ }
+ readmeEng.write(sb.toString(), "UTF-8")
+ }
+}
diff --git a/config/flavor.gradle b/config/flavor.gradle
new file mode 100644
index 0000000000..25c1801983
--- /dev/null
+++ b/config/flavor.gradle
@@ -0,0 +1,22 @@
+android {
+ flavorDimensions "env"
+ productFlavors {
+ dev {
+ dimension "env"
+ }
+
+ production {
+ dimension "env"
+ }
+ }
+
+ variantFilter { variant ->
+ def flavorNames = variant.flavors*.name
+ def buildTypeName = variant.buildType.name
+
+ // production 包不允许 debug 构建
+ if (flavorNames.contains("production") && buildTypeName.contains("debug")) {
+ variant.setIgnore(true)
+ }
+ }
+}
\ No newline at end of file
diff --git a/config/publish.gradle b/config/publish.gradle
new file mode 100644
index 0000000000..7608215123
--- /dev/null
+++ b/config/publish.gradle
@@ -0,0 +1,226 @@
+/*
+ 1. add
+ signing.keyId=xx
+ signing.password=xx
+ signing.secretKeyRingFile=/Users/xx/secring.gpg
+ ossrhUsername=xx
+ ossrhPassword=xx
+ in root local.properties
+
+ 2. copy the file to the directory of gradle, and apply the file in the module
+ ext {
+ groupId = Config.modules.lib_utilcode.groupId
+ artifactId = Config.modules.lib_utilcode.artifactId
+ version = Config.modules.lib_utilcode.version
+ website = "https://github.com/Blankj/AndroidUtilCode"
+}
+ apply from: "${rootDir.path}/config/publish.gradle"
+
+ 3. execute following command to publish
+ ./gradlew :xxmodule:publish2Local -> upload to mavenLocal
+ ./gradlew :xxmodule:publish2Remote -> upload to mavenCentral
+*/
+
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+ext.multiPublishMode = true
+
+File localPropertiesFile = project.rootProject.file("local.properties");
+if (!localPropertiesFile.exists()) {
+ return
+}
+
+Properties properties = new Properties()
+properties.load(new FileInputStream(localPropertiesFile))
+properties.each { name, value -> ext[name] = value }
+
+afterEvaluate {
+ def ext = project.ext
+ publishing {
+ publications {
+ release(MavenPublication) {
+ groupId ext.groupId
+ artifactId ext.artifactId
+ version ext.version
+
+ if (isAndroidEnv(project)) {
+ if (project.ext.multiPublishMode) {
+ artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
+ artifact sourcesJar
+ } else {
+ from project.components.release
+ }
+ } else {
+ from project.components.java
+ }
+
+ pom {
+ name = ext.artifactId
+ description = ext.artifactId
+ url = ext.website
+
+ licenses {
+ license {
+ name = 'The Apache Software License, Version 2.0'
+ url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+ developers {
+ developer {
+ id = ext.ossrhUsername
+ name = ext.ossrhUsername
+ }
+ }
+ scm {
+ url = ext.website
+ connection = ext.website
+ developerConnection = ext.website + ".git"
+ }
+
+ if (project.ext.multiPublishMode) {
+ withXml {
+ def dependenciesNode = asNode().getAt('dependencies')[0] ?:
+ asNode().appendNode('dependencies')
+
+ configurations.api.getDependencies().each {
+ dep -> addDependency(project, dependenciesNode, dep, "compile")
+ }
+ configurations.implementation.getDependencies().each {
+ dep -> addDependency(project, dependenciesNode, dep, "runtime")
+ }
+ }
+ }
+ }
+ }
+ }
+
+ repositories {
+ maven {
+ // s01 is newest
+ def releasesUrl = "https://s01.oss.sonatype.org/content/repositories/releases/"
+ def snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
+ url = version.toUpperCase().endsWith('SNAPSHOT') ? snapshotUrl : releasesUrl
+
+ credentials {
+ username ossrhUsername
+ password ossrhPassword
+ }
+ }
+ }
+ }
+
+ signing {
+ sign publishing.publications
+ }
+}
+
+private void addDependency(Project project, def dependenciesNode, Dependency dep, String scope) {
+ if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified") {
+ return
+ }
+
+ final dependencyNode = dependenciesNode.appendNode('dependency')
+ dependencyNode.appendNode('scope', scope)
+
+ if (dep.version == 'unspecified') {
+ // 检测 module 中的 dependencies 是否有源码依赖
+ // 如果是源码依赖,而且没有在 config 中配置 remotePath,
+ // 那么发布到仓库,其他地方依赖该库时会找不到源码的那个库
+ println "publish -> module(unspecified) <${dep.group}:${dep.name}:${dep.version}>"
+ if (project.ext.groupId || project.ext.version) {
+ throw new GradleException("The module of <" + dep.name + "> should set groupId & version.")
+ }
+ // 源码依赖,但配置了 remotePath,让 pom 中写入 remotePath
+ println("publish -> module(wrapped) <${project.ext.groupId}:${name}:${project.ext.version}>")
+
+ dependencyNode.appendNode('groupId', project.ext.pomGroupID)
+ dependencyNode.appendNode('artifactId', dep.name)
+ dependencyNode.appendNode('version', project.ext.pomVersion)
+ } else {
+ dependencyNode.appendNode('groupId', dep.group)
+ dependencyNode.appendNode('artifactId', dep.name)
+ dependencyNode.appendNode('version', dep.version)
+ println("publish -> library <${dep.group}:${dep.name}:${dep.version}>")
+ }
+
+ if (!dep.transitive) {
+ // In case of non transitive dependency,
+ // all its dependencies should be force excluded from them POM file
+ final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
+ exclusionNode.appendNode('groupId', '*')
+ exclusionNode.appendNode('artifactId', '*')
+ } else if (!dep.properties.excludeRules.empty) {
+ // For transitive with exclusions, all exclude rules should be added to the POM file
+ final exclusions = dependencyNode.appendNode('exclusions')
+ dep.properties.excludeRules.each { ExcludeRule rule ->
+ final exclusionNode = exclusions.appendNode('exclusion')
+ exclusionNode.appendNode('groupId', rule.group ?: '*')
+ exclusionNode.appendNode('artifactId', rule.module ?: '*')
+ }
+ }
+}
+
+if (isAndroidEnv(project)) {
+ // This generates sources.jar
+ task sourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.java.source
+ }
+
+ task javadoc(type: Javadoc) {
+ source = android.sourceSets.main.java.source
+ classpath += configurations.compile
+ classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
+ }
+
+ task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+ }
+} else {
+ task sourcesJar(type: Jar, dependsOn: classes) {
+ classifier = 'sources'
+ from sourceSets.main.allSource
+ }
+
+ task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier = 'javadoc'
+ from javadoc.destinationDir
+ }
+}
+
+if (project.hasProperty("kotlin")) {
+ // Disable creating javadocs
+ project.tasks.withType(Javadoc) {
+ enabled = false
+ }
+}
+
+javadoc {
+ options {
+ encoding "UTF-8"
+ charSet 'UTF-8'
+ author true
+ version project.ext.version
+ links "http://docs.oracle.com/javase/7/docs/api"
+ title "${project.ext.artifactId} ${project.ext.version}"
+ }
+}
+
+artifacts {
+ archives javadocJar
+ archives sourcesJar
+}
+
+static def isAndroidEnv(Project project) {
+ return project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')
+}
+
+task publish2Local(type: GradleBuild) {
+ tasks = ['assemble', 'publishReleasePublicationToMavenLocal']
+}
+
+task publish2Remote(type: GradleBuild) {
+ tasks = ['assemble', 'publishReleasePublicationToMavenRepository']
+}
\ No newline at end of file
diff --git a/feature/launcher/app/.gitignore b/feature/launcher/app/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/launcher/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/launcher/app/build.gradle b/feature/launcher/app/build.gradle
new file mode 100644
index 0000000000..8f2b6d205d
--- /dev/null
+++ b/feature/launcher/app/build.gradle
@@ -0,0 +1,5 @@
+apply plugin: 'kotlin-kapt'
+
+dependencies {
+ kapt Config.libs.eventbus_processor.path
+}
\ No newline at end of file
diff --git a/feature/launcher/app/proguard-rules.pro b/feature/launcher/app/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/launcher/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/launcher/app/src/main/AndroidManifest.xml b/feature/launcher/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..4f033c06a6
--- /dev/null
+++ b/feature/launcher/app/src/main/AndroidManifest.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/feature/launcher/app/src/main/java/com/blankj/launcher/app/LauncherApp.java b/feature/launcher/app/src/main/java/com/blankj/launcher/app/LauncherApp.java
new file mode 100644
index 0000000000..7dc22cee69
--- /dev/null
+++ b/feature/launcher/app/src/main/java/com/blankj/launcher/app/LauncherApp.java
@@ -0,0 +1,28 @@
+package com.blankj.launcher.app;
+
+import com.blankj.common.CommonApplication;
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/12
+ * desc :
+ *
+ */
+public class LauncherApp extends CommonApplication {
+
+ private static LauncherApp sInstance;
+
+ public static LauncherApp getInstance() {
+ return sInstance;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ sInstance = this;
+ }
+}
+
+
diff --git a/feature/main/app/.gitignore b/feature/main/app/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/main/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/main/app/build.gradle b/feature/main/app/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/main/app/proguard-rules.pro b/feature/main/app/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/main/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/main/app/src/main/AndroidManifest.xml b/feature/main/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..bb8c3398d4
--- /dev/null
+++ b/feature/main/app/src/main/AndroidManifest.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/feature/main/app/src/main/java/com/blankj/main/app/MainApp.java b/feature/main/app/src/main/java/com/blankj/main/app/MainApp.java
new file mode 100644
index 0000000000..7b083b92ba
--- /dev/null
+++ b/feature/main/app/src/main/java/com/blankj/main/app/MainApp.java
@@ -0,0 +1,35 @@
+package com.blankj.main.app;
+
+import android.content.Context;
+
+import com.blankj.common.CommonApplication;
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/12
+ * desc :
+ *
+ */
+public class MainApp extends CommonApplication {
+
+ private static MainApp sInstance;
+
+ public static MainApp getInstance() {
+ return sInstance;
+ }
+
+ @Override
+ protected void attachBaseContext(Context base) {
+ super.attachBaseContext(base);
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ sInstance = this;
+ }
+}
+
+
diff --git a/feature/main/pkg/.gitignore b/feature/main/pkg/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/main/pkg/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/main/pkg/build.gradle b/feature/main/pkg/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/main/pkg/proguard-rules.pro b/feature/main/pkg/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/main/pkg/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/main/pkg/src/main/AndroidManifest.xml b/feature/main/pkg/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..1cfdba8f69
--- /dev/null
+++ b/feature/main/pkg/src/main/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
diff --git a/feature/main/pkg/src/main/java/com/blankj/main/pkg/MainActivity.kt b/feature/main/pkg/src/main/java/com/blankj/main/pkg/MainActivity.kt
new file mode 100644
index 0000000000..b00aba9585
--- /dev/null
+++ b/feature/main/pkg/src/main/java/com/blankj/main/pkg/MainActivity.kt
@@ -0,0 +1,74 @@
+package com.blankj.main.pkg
+
+import android.graphics.Color
+import android.os.Bundle
+import android.view.View
+import androidx.appcompat.app.ActionBarDrawerToggle
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemClick
+import com.blankj.subutil.export.api.SubUtilApi
+import com.blankj.utilcode.export.api.UtilCodeApi
+import com.blankj.utilcode.util.ApiUtils
+import com.blankj.utilcode.util.BarUtils
+import com.blankj.utilcode.util.ClickUtils
+import com.blankj.utilcode.util.CollectionUtils
+import kotlinx.android.synthetic.main.activity_main.*
+
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/09/29
+ * desc : MainActivity
+ * ```
+ */
+class MainActivity : CommonActivity() {
+
+ override fun isSwipeBack(): Boolean {
+ return false
+ }
+
+ override fun bindDrawer(): Boolean {
+ return true
+ }
+
+ override fun bindLayout(): Int {
+ return R.layout.activity_main
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ window.setBackgroundDrawable(null)
+ super.onCreate(savedInstanceState)
+ }
+
+ override fun initView(savedInstanceState: Bundle?, contentView: View?) {
+ super.initView(savedInstanceState, contentView)
+ setCommonItems(mainRv, CollectionUtils.newArrayList>(
+ CommonItemClick(R.string.core_util, true) {
+ ApiUtils.getApi(UtilCodeApi::class.java)?.startUtilCodeActivity(this)
+ },
+ CommonItemClick(R.string.sub_util, true) {
+ ApiUtils.getApi(SubUtilApi::class.java)?.startSubUtilActivity(this)
+ }
+ ))
+
+ launcherMainCtl.setExpandedTitleColor(Color.TRANSPARENT)
+ setSupportActionBar(launcherMainToolbar)
+ val toggle = ActionBarDrawerToggle(this,
+ drawerView.mBaseDrawerRootLayout,
+ launcherMainToolbar,
+ R.string.navigation_drawer_open,
+ R.string.navigation_drawer_close)
+ drawerView.mBaseDrawerRootLayout.addDrawerListener(toggle)
+ toggle.syncState()
+
+ BarUtils.setStatusBarColor4Drawer(drawerView.mBaseDrawerRootLayout, launcherMainFakeStatusBar, Color.TRANSPARENT, false)
+ BarUtils.addMarginTopEqualStatusBarHeight(launcherMainToolbar)
+ }
+
+ override fun onBackPressed() {
+ ClickUtils.back2HomeFriendly("Press again to exit.")
+ }
+}
diff --git a/feature/main/pkg/src/main/java/com/blankj/main/pkg/SplashActivity.kt b/feature/main/pkg/src/main/java/com/blankj/main/pkg/SplashActivity.kt
new file mode 100644
index 0000000000..9f842cda06
--- /dev/null
+++ b/feature/main/pkg/src/main/java/com/blankj/main/pkg/SplashActivity.kt
@@ -0,0 +1,7 @@
+package com.blankj.main.pkg
+
+import com.blankj.common.activity.CommonActivity
+
+class SplashActivity : CommonActivity() {
+
+}
\ No newline at end of file
diff --git a/feature/main/pkg/src/main/res/layout/activity_main.xml b/feature/main/pkg/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000000..3a33dd0f8e
--- /dev/null
+++ b/feature/main/pkg/src/main/res/layout/activity_main.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/feature/main/pkg/src/main/res/values/strings.xml b/feature/main/pkg/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..7abc06d3ba
--- /dev/null
+++ b/feature/main/pkg/src/main/res/values/strings.xml
@@ -0,0 +1 @@
+
diff --git a/feature/mock/.gitignore b/feature/mock/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/mock/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/mock/build.gradle b/feature/mock/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/mock/proguard-rules.pro b/feature/mock/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/mock/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/mock/src/main/AndroidManifest.xml b/feature/mock/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..8c0f9aa047
--- /dev/null
+++ b/feature/mock/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/feature/mock/src/main/java/com/blankj/mock/subutil/SubUtilApiMock.java b/feature/mock/src/main/java/com/blankj/mock/subutil/SubUtilApiMock.java
new file mode 100644
index 0000000000..6c5af69924
--- /dev/null
+++ b/feature/mock/src/main/java/com/blankj/mock/subutil/SubUtilApiMock.java
@@ -0,0 +1,25 @@
+package com.blankj.mock.subutil;
+
+import android.content.Context;
+
+import com.blankj.subutil.export.api.SubUtilApi;
+import com.blankj.utilcode.util.ApiUtils;
+import com.blankj.utilcode.util.ToastUtils;
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2019/07/10
+ * desc :
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2019/07/10
+ * desc :
+ *
+ */
+@ApiUtils.Api(isMock = true)
+public class UtilCodeApiMock extends UtilCodeApi {
+
+ @Override
+ public void startUtilCodeActivity(Context context) {
+ ToastUtils.showShort("startUtilCodeActivity");
+ }
+
+ @Override
+ public void testCallback(Callback callback) {
+ if (callback != null) {
+ callback.call();
+ }
+ }
+
+}
diff --git a/feature/subutil/app/.gitignore b/feature/subutil/app/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/subutil/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/subutil/app/build.gradle b/feature/subutil/app/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/subutil/app/proguard-rules.pro b/feature/subutil/app/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/subutil/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/subutil/app/src/main/AndroidManifest.xml b/feature/subutil/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..2989dbfebf
--- /dev/null
+++ b/feature/subutil/app/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/feature/subutil/app/src/main/java/com/blankj/subutil/app/SubUtilApp.kt b/feature/subutil/app/src/main/java/com/blankj/subutil/app/SubUtilApp.kt
new file mode 100644
index 0000000000..9667490cf4
--- /dev/null
+++ b/feature/subutil/app/src/main/java/com/blankj/subutil/app/SubUtilApp.kt
@@ -0,0 +1,32 @@
+package com.blankj.subutil.app
+
+import android.content.Context
+import com.blankj.common.CommonApplication
+
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/12
+ * desc : app about utils
+ * ```
+ */
+class SubUtilApp : CommonApplication() {
+
+ companion object {
+ var instance: SubUtilApp? = null
+ private set
+ }
+
+ override fun attachBaseContext(base: Context) {
+ super.attachBaseContext(base)
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ instance = this
+ }
+}
+
+
diff --git a/feature/subutil/export/.gitignore b/feature/subutil/export/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/subutil/export/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/subutil/export/build.gradle b/feature/subutil/export/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/subutil/export/proguard-rules.pro b/feature/subutil/export/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/subutil/export/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/subutil/export/src/main/AndroidManifest.xml b/feature/subutil/export/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..de00a6d73e
--- /dev/null
+++ b/feature/subutil/export/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+
diff --git a/feature/subutil/export/src/main/java/com/blankj/subutil/export/api/SubUtilApi.java b/feature/subutil/export/src/main/java/com/blankj/subutil/export/api/SubUtilApi.java
new file mode 100644
index 0000000000..c0e4abe037
--- /dev/null
+++ b/feature/subutil/export/src/main/java/com/blankj/subutil/export/api/SubUtilApi.java
@@ -0,0 +1,20 @@
+package com.blankj.subutil.export.api;
+
+import android.content.Context;
+
+import com.blankj.utilcode.util.ApiUtils;
+
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2019/06/09
+ * desc :
+ *
+ */
+public abstract class SubUtilApi extends ApiUtils.BaseApi {
+
+ public abstract void startSubUtilActivity(Context context);
+
+}
diff --git a/feature/subutil/pkg/.gitignore b/feature/subutil/pkg/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/subutil/pkg/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/subutil/pkg/build.gradle b/feature/subutil/pkg/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/subutil/pkg/proguard-rules.pro b/feature/subutil/pkg/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/subutil/pkg/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/subutil/pkg/src/main/AndroidManifest.xml b/feature/subutil/pkg/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..198eb5c31b
--- /dev/null
+++ b/feature/subutil/pkg/src/main/AndroidManifest.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/Config.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/Config.kt
new file mode 100644
index 0000000000..82a8db84d3
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/Config.kt
@@ -0,0 +1,31 @@
+package com.blankj.subutil.pkg
+
+import android.os.Environment
+import com.blankj.utilcode.util.Utils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2017/05/10
+ * desc : config about constants
+ * ```
+ */
+object Config {
+
+ val FILE_SEP = System.getProperty("file.separator")
+ val LINE_SEP = System.getProperty("line.separator")
+ const val TEST_PKG = "com.blankj.testinstall"
+ private val CACHE_PATH: String
+ val TEST_APK_PATH: String
+
+ init {
+ val cacheDir = Utils.getApp().externalCacheDir
+ CACHE_PATH = if (cacheDir != null) {
+ cacheDir.absolutePath
+ } else {
+ Environment.getExternalStorageDirectory().absolutePath
+ } + FILE_SEP
+ TEST_APK_PATH = CACHE_PATH + "test_install.apk"
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/SubUtilApiImpl.java b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/SubUtilApiImpl.java
new file mode 100644
index 0000000000..0b978f1bcd
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/SubUtilApiImpl.java
@@ -0,0 +1,25 @@
+package com.blankj.subutil.pkg;
+
+import android.content.Context;
+
+import com.blankj.subutil.export.api.SubUtilApi;
+import com.blankj.subutil.pkg.feature.SubUtilActivity;
+import com.blankj.utilcode.util.ApiUtils;
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2019/07/02
+ * desc :
+ *
+ */
+@ApiUtils.Api
+public class SubUtilApiImpl extends SubUtilApi {
+
+ @Override
+ public void startSubUtilActivity(Context context) {
+ SubUtilActivity.Companion.start(context);
+ }
+
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/SubUtilActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/SubUtilActivity.kt
new file mode 100644
index 0000000000..2c6af650ef
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/SubUtilActivity.kt
@@ -0,0 +1,61 @@
+package com.blankj.subutil.pkg.feature
+
+import android.content.Context
+import android.content.Intent
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemClick
+import com.blankj.subutil.pkg.R
+import com.blankj.subutil.pkg.feature.appStore.AppStoreActivity
+import com.blankj.subutil.pkg.feature.battery.BatteryActivity
+import com.blankj.subutil.pkg.feature.country.CountryActivity
+import com.blankj.subutil.pkg.feature.dangerous.DangerousActivity
+import com.blankj.subutil.pkg.feature.location.LocationActivity
+import com.blankj.subutil.pkg.feature.pinyin.PinyinActivity
+import com.blankj.utilcode.util.CollectionUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/09/29
+ * desc : MainActivity
+ * ```
+ */
+class SubUtilActivity : CommonActivity() {
+
+ companion object {
+ fun start(context: Context) {
+ val starter = Intent(context, SubUtilActivity::class.java)
+ context.startActivity(starter)
+ }
+ }
+
+
+ override fun bindTitleRes(): Int {
+ return R.string.sub_util
+ }
+
+ override fun bindItems(): List> {
+ return CollectionUtils.newArrayList(
+ CommonItemClick(R.string.demo_app_store, true) {
+ AppStoreActivity.start(this)
+ },
+ CommonItemClick(R.string.demo_battery, true) {
+ BatteryActivity.start(this)
+ },
+ CommonItemClick(R.string.demo_country, true) {
+ CountryActivity.start(this)
+ },
+ CommonItemClick(R.string.demo_dangerous, true) {
+ DangerousActivity.start(this)
+ },
+ CommonItemClick(R.string.demo_location, true) {
+ LocationActivity.start(this)
+ },
+ CommonItemClick(R.string.demo_pinyin, true) {
+ PinyinActivity.start(this)
+ }
+ )
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/appStore/AppStoreActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/appStore/AppStoreActivity.kt
new file mode 100644
index 0000000000..e7c2953448
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/appStore/AppStoreActivity.kt
@@ -0,0 +1,43 @@
+package com.blankj.subutil.pkg.feature.appStore
+
+import android.content.Context
+import android.content.Intent
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemClick
+import com.blankj.subutil.pkg.R
+import com.blankj.subutil.util.AppStoreUtils
+import com.blankj.utilcode.util.ActivityUtils
+import com.blankj.utilcode.util.CollectionUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 17/02/01
+ * desc : demo about AppStore
+ * ```
+ */
+class AppStoreActivity : CommonActivity() {
+
+ companion object {
+ fun start(context: Context) {
+ val starter = Intent(context, AppStoreActivity::class.java)
+ context.startActivity(starter)
+ }
+ }
+
+ override fun bindTitleRes(): Int {
+ return R.string.demo_app_store
+ }
+
+ override fun bindItems(): MutableList> {
+ return CollectionUtils.newArrayList(
+ CommonItemClick(R.string.app_store_system, true) {
+ AppStoreUtils.getAppStoreIntent("com.tencent.mm").apply {
+ ActivityUtils.startActivity(this)
+ }
+ }
+ )
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/battery/BatteryActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/battery/BatteryActivity.kt
new file mode 100644
index 0000000000..8e04163c4f
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/battery/BatteryActivity.kt
@@ -0,0 +1,56 @@
+package com.blankj.subutil.pkg.feature.battery
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import android.view.View
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemTitle
+import com.blankj.subutil.pkg.R
+import com.blankj.subutil.util.BatteryUtils
+import com.blankj.utilcode.util.CollectionUtils
+import com.blankj.utilcode.util.ToastUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 20/03/31
+ * desc : demo about Battery
+ * ```
+ */
+class BatteryActivity : CommonActivity(), BatteryUtils.OnBatteryStatusChangedListener {
+
+ private val titleItem: CommonItemTitle = CommonItemTitle("", true);
+
+ companion object {
+ fun start(context: Context) {
+ val starter = Intent(context, BatteryActivity::class.java)
+ context.startActivity(starter)
+ }
+ }
+
+ override fun bindTitleRes(): Int {
+ return R.string.demo_battery
+ }
+
+ override fun bindItems(): MutableList> {
+ return CollectionUtils.newArrayList(titleItem)
+ }
+
+ override fun initView(savedInstanceState: Bundle?, contentView: View?) {
+ super.initView(savedInstanceState, contentView)
+ BatteryUtils.registerBatteryStatusChangedListener(this)
+ }
+
+ override fun onBatteryStatusChanged(status: BatteryUtils.Status) {
+ titleItem.title = status.toString()
+ ToastUtils.showShort(status.toString())
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ BatteryUtils.unregisterBatteryStatusChangedListener(this)
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/country/CountryActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/country/CountryActivity.kt
new file mode 100644
index 0000000000..c2daa6ef50
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/country/CountryActivity.kt
@@ -0,0 +1,41 @@
+package com.blankj.subutil.pkg.feature.country
+
+import android.content.Context
+import android.content.Intent
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemTitle
+import com.blankj.subutil.pkg.R
+import com.blankj.subutil.util.CountryUtils
+import com.blankj.utilcode.util.CollectionUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 17/02/01
+ * desc : demo about Country
+ * ```
+ */
+class CountryActivity : CommonActivity() {
+
+ companion object {
+ fun start(context: Context) {
+ val starter = Intent(context, CountryActivity::class.java)
+ context.startActivity(starter)
+ }
+ }
+
+ override fun bindTitleRes(): Int {
+ return R.string.demo_country
+ }
+
+ override fun bindItems(): MutableList> {
+ return CollectionUtils.newArrayList(
+ CommonItemTitle("getCountryCodeBySim", CountryUtils.getCountryCodeBySim("Default")),
+ CommonItemTitle("getCountryCodeByLanguage", CountryUtils.getCountryCodeByLanguage("Default")),
+ CommonItemTitle("getCountryBySim", CountryUtils.getCountryBySim()),
+ CommonItemTitle("getCountryByLanguage", CountryUtils.getCountryByLanguage())
+ )
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/dangerous/DangerousActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/dangerous/DangerousActivity.kt
new file mode 100644
index 0000000000..cc5c60f470
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/dangerous/DangerousActivity.kt
@@ -0,0 +1,123 @@
+package com.blankj.subutil.pkg.feature.dangerous
+
+import android.content.Context
+import android.content.Intent
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.helper.PermissionHelper
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemClick
+import com.blankj.common.item.CommonItemSwitch
+import com.blankj.subutil.pkg.Config
+import com.blankj.subutil.pkg.R
+import com.blankj.subutil.util.DangerousUtils
+import com.blankj.utilcode.constant.PermissionConstants
+import com.blankj.utilcode.util.*
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 17/02/01
+ * desc : demo about dangerous
+ * ```
+ */
+class DangerousActivity : CommonActivity() {
+
+ companion object {
+ fun start(context: Context) {
+ PermissionHelper.request(context, object : PermissionUtils.SimpleCallback {
+ override fun onGranted() {
+ val starter = Intent(context, DangerousActivity::class.java)
+ context.startActivity(starter)
+ }
+
+ override fun onDenied() {
+ }
+ }, PermissionConstants.STORAGE, PermissionConstants.SMS)
+ }
+ }
+
+ private val listener = object : OnReleasedListener {
+ override fun onReleased() {
+ if (DangerousUtils.installAppSilent(Config.TEST_APK_PATH)) {
+ ToastUtils.showShort(R.string.dangerous_install_successfully)
+ } else {
+ ToastUtils.showShort(R.string.dangerous_install_unsuccessfully)
+ }
+ }
+ }
+
+ override fun bindTitleRes(): Int {
+ return R.string.demo_dangerous
+ }
+
+ override fun bindItems(): MutableList> {
+ return CollectionUtils.newArrayList(
+ CommonItemClick(R.string.dangerous_install_silent) {
+ if (AppUtils.isAppInstalled(Config.TEST_PKG)) {
+ ToastUtils.showShort(R.string.dangerous_app_install_tips)
+ } else {
+ if (!FileUtils.isFileExists(Config.TEST_APK_PATH)) {
+ ReleaseInstallApkTask(listener).execute()
+ } else {
+ listener.onReleased()
+ }
+ }
+ },
+ CommonItemClick(R.string.dangerous_uninstall_silent) {
+ if (AppUtils.isAppInstalled(Config.TEST_PKG)) {
+ if (DangerousUtils.uninstallAppSilent(Config.TEST_PKG, false)) {
+ ToastUtils.showShort(R.string.dangerous_uninstall_successfully)
+ } else {
+ ToastUtils.showShort(R.string.dangerous_uninstall_unsuccessfully)
+ }
+ } else {
+ ToastUtils.showShort(R.string.dangerous_app_uninstall_tips)
+ }
+ },
+ CommonItemClick(R.string.dangerous_shutdown) {
+ ToastUtils.showShort(DangerousUtils.shutdown().toString())
+ },
+ CommonItemClick(R.string.dangerous_reboot) {
+ ToastUtils.showShort(DangerousUtils.reboot().toString())
+ },
+ CommonItemClick(R.string.dangerous_reboot_to_recovery) {
+ ToastUtils.showShort(DangerousUtils.reboot2Recovery().toString())
+ },
+ CommonItemClick(R.string.dangerous_reboot_to_bootloader) {
+ ToastUtils.showShort(DangerousUtils.reboot2Bootloader().toString())
+ },
+ CommonItemSwitch(
+ R.string.dangerous_data_enabled,
+ { NetworkUtils.getMobileDataEnabled() },
+ {
+ if (AppUtils.isAppSystem()) {
+ DangerousUtils.setMobileDataEnabled(it)
+ }
+ }
+ ),
+ CommonItemClick(R.string.dangerous_send_sms_silent) {
+ DangerousUtils.sendSmsSilent("10000", "sendSmsSilent")
+ }
+ )
+ }
+}
+
+class ReleaseInstallApkTask(private val mListener: OnReleasedListener) : ThreadUtils.SimpleTask() {
+
+ override fun doInBackground() {
+ ResourceUtils.copyFileFromAssets("test_install", Config.TEST_APK_PATH)
+ }
+
+ override fun onSuccess(result: Unit) {
+ mListener.onReleased()
+ }
+
+ fun execute() {
+ ThreadUtils.executeByIo(this)
+ }
+}
+
+interface OnReleasedListener {
+ fun onReleased()
+}
\ No newline at end of file
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationActivity.kt
new file mode 100755
index 0000000000..8f4217c96c
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationActivity.kt
@@ -0,0 +1,100 @@
+package com.blankj.subutil.pkg.feature.location
+
+import android.content.ComponentName
+import android.content.Context
+import android.content.Intent
+import android.content.ServiceConnection
+import android.os.IBinder
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.helper.PermissionHelper
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemTitle
+import com.blankj.subutil.pkg.R
+import com.blankj.utilcode.constant.PermissionConstants
+import com.blankj.utilcode.util.CollectionUtils
+import com.blankj.utilcode.util.PermissionUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/13
+ * desc : demo about LocationUtils
+ * ```
+ */
+class LocationActivity : CommonActivity() {
+
+ private var lastLatitude: String = "unknown"
+ private var lastLongitude: String = "unknown"
+ private var latitude: String = "unknown"
+ private var longitude: String = "unknown"
+ private var country: String = "unknown"
+ private var locality: String = "unknown"
+ private var street: String = "unknown"
+
+ companion object {
+ fun start(context: Context) {
+ PermissionHelper.request(context, object : PermissionUtils.SimpleCallback {
+ override fun onGranted() {
+ val starter = Intent(context, LocationActivity::class.java)
+ context.startActivity(starter)
+ }
+
+ override fun onDenied() {
+ }
+ }, PermissionConstants.LOCATION)
+ }
+ }
+
+ private lateinit var mLocationService: LocationService
+
+ private var conn: ServiceConnection = object : ServiceConnection {
+ override fun onServiceDisconnected(name: ComponentName) {}
+
+ override fun onServiceConnected(name: ComponentName, service: IBinder) {
+ mLocationService = (service as LocationService.LocationBinder).service
+ mLocationService.setOnGetLocationListener(object : LocationService.OnGetLocationListener {
+ override fun getLocation(lastLatitude: String, lastLongitude: String, latitude: String,
+ longitude: String, country: String, locality: String, street: String) {
+ this@LocationActivity.apply {
+ this.lastLatitude = lastLatitude
+ this.lastLongitude = lastLongitude
+ this.latitude = latitude
+ this.longitude = longitude
+ this.country = country
+ this.locality = locality
+ this.street = street
+ }
+ runOnUiThread {
+ itemsView.updateItems(bindItems())
+ }
+ }
+ })
+ }
+ }
+
+ override fun bindTitleRes(): Int {
+ return R.string.demo_location
+ }
+
+ override fun bindItems(): MutableList> {
+ return CollectionUtils.newArrayList(
+ CommonItemTitle("lastLatitude", lastLatitude),
+ CommonItemTitle("lastLongitude", lastLongitude),
+ CommonItemTitle("latitude", latitude),
+ CommonItemTitle("longitude", longitude),
+ CommonItemTitle("getCountryName", country),
+ CommonItemTitle("getLocality", locality),
+ CommonItemTitle("getStreet", street)
+ )
+ }
+
+ override fun doBusiness() {
+ bindService(Intent(this, LocationService::class.java), conn, Context.BIND_AUTO_CREATE)
+ }
+
+ override fun onDestroy() {
+ unbindService(conn)
+ super.onDestroy()
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationService.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationService.kt
new file mode 100755
index 0000000000..8322500d63
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationService.kt
@@ -0,0 +1,95 @@
+package com.blankj.subutil.pkg.feature.location
+
+import android.app.Service
+import android.content.Intent
+import android.location.Location
+import android.os.Binder
+import android.os.Bundle
+import android.os.IBinder
+import android.os.Looper
+
+import com.blankj.subutil.util.LocationUtils
+import com.blankj.utilcode.util.ToastUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/11/21
+ * desc : demo about LocationUtils
+ * ```
+ */
+class LocationService : Service() {
+
+ private var isSuccess: Boolean = false
+ private var lastLatitude = "loading..."
+ private var lastLongitude = "loading..."
+ private var latitude = "loading..."
+ private var longitude = "loading..."
+ private var country = "loading..."
+ private var locality = "loading..."
+ private var street = "loading..."
+
+ private var mOnGetLocationListener: OnGetLocationListener? = null
+
+ private val mOnLocationChangeListener = object : LocationUtils.OnLocationChangeListener {
+ override fun getLastKnownLocation(location: Location) {
+ lastLatitude = location.latitude.toString()
+ lastLongitude = location.longitude.toString()
+ mOnGetLocationListener?.getLocation(lastLatitude, lastLongitude, latitude, longitude, country, locality, street)
+ }
+
+ override fun onLocationChanged(location: Location) {
+ latitude = location.latitude.toString()
+ longitude = location.longitude.toString()
+ mOnGetLocationListener?.getLocation(lastLatitude, lastLongitude, latitude, longitude, country, locality, street)
+ country = LocationUtils.getCountryName(java.lang.Double.parseDouble(latitude), java.lang.Double.parseDouble(longitude))
+ locality = LocationUtils.getLocality(java.lang.Double.parseDouble(latitude), java.lang.Double.parseDouble(longitude))
+ street = LocationUtils.getStreet(java.lang.Double.parseDouble(latitude), java.lang.Double.parseDouble(longitude))
+ mOnGetLocationListener?.getLocation(lastLatitude, lastLongitude, latitude, longitude, country, locality, street)
+ }
+
+ override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {}
+ }
+
+ fun setOnGetLocationListener(onGetLocationListener: OnGetLocationListener) {
+ mOnGetLocationListener = onGetLocationListener
+ }
+
+ override fun onCreate() {
+ super.onCreate()
+ Thread(Runnable {
+ Looper.prepare()
+ isSuccess = LocationUtils.register(0, 0, mOnLocationChangeListener)
+ if (isSuccess) ToastUtils.showShort("init success")
+ Looper.loop()
+ }).start()
+ }
+
+ override fun onBind(intent: Intent): IBinder? {
+ return LocationBinder()
+ }
+
+ inner class LocationBinder : Binder() {
+ val service: LocationService
+ get() = this@LocationService
+ }
+
+ override fun onDestroy() {
+ LocationUtils.unregister()
+ // 一定要制空,否则内存泄漏
+ mOnGetLocationListener = null
+ super.onDestroy()
+ }
+
+ /**
+ * 获取位置监听器
+ */
+ interface OnGetLocationListener {
+ fun getLocation(
+ lastLatitude: String, lastLongitude: String,
+ latitude: String, longitude: String,
+ country: String, locality: String, street: String
+ )
+ }
+}
diff --git a/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/pinyin/PinyinActivity.kt b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/pinyin/PinyinActivity.kt
new file mode 100644
index 0000000000..648dcb295d
--- /dev/null
+++ b/feature/subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/pinyin/PinyinActivity.kt
@@ -0,0 +1,56 @@
+package com.blankj.subutil.pkg.feature.pinyin
+
+import android.content.Context
+import android.content.Intent
+import com.blankj.common.activity.CommonActivity
+import com.blankj.common.item.CommonItem
+import com.blankj.common.item.CommonItemTitle
+import com.blankj.subutil.pkg.R
+import com.blankj.subutil.util.PinyinUtils
+import com.blankj.utilcode.util.CollectionUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 17/02/01
+ * desc : demo about PinyinUtils
+ * ```
+ */
+class PinyinActivity : CommonActivity() {
+
+ companion object {
+ fun start(context: Context) {
+ val starter = Intent(context, PinyinActivity::class.java)
+ context.startActivity(starter)
+ }
+ }
+
+ override fun bindTitleRes(): Int {
+ return R.string.demo_pinyin
+ }
+
+ override fun bindItems(): MutableList> {
+ val surnames = "乐乘乜仇会便区单参句召员宓弗折曾朴查洗盖祭种秘繁缪能蕃覃解谌适都阿难黑"
+ val size = surnames.length
+ val sb = StringBuilder("澹台: " + PinyinUtils.getSurnamePinyin("澹台")
+ + "\n尉迟: " + PinyinUtils.getSurnamePinyin("尉迟")
+ + "\n万俟: " + PinyinUtils.getSurnamePinyin("万俟")
+ + "\n单于: " + PinyinUtils.getSurnamePinyin("单于"))
+ for (i in 0 until size) {
+ val surname = surnames[i].toString()
+ sb.append(String.format(
+ "\n%s 正确: %-8s 错误: %-8s",
+ surname,
+ PinyinUtils.getSurnamePinyin(surname),
+ PinyinUtils.ccs2Pinyin(surname)
+ ))
+ }
+ return CollectionUtils.newArrayList(
+ CommonItemTitle("汉字转拼音", PinyinUtils.ccs2Pinyin("汉字转拼音", " ")),
+ CommonItemTitle("获取首字母", PinyinUtils.getPinyinFirstLetters("获取首字母", " ")),
+ CommonItemTitle("测试姓氏", sb.toString())
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/feature/subutil/pkg/src/main/res/values/strings.xml b/feature/subutil/pkg/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..e758c294a0
--- /dev/null
+++ b/feature/subutil/pkg/src/main/res/values/strings.xml
@@ -0,0 +1,29 @@
+
+
+ App Store Demo
+ Battery Demo
+ Country Demo
+ Dangerous Demo
+ LocationUtils Demo
+ PinyinUtils Demo
+
+
+ Go System App Store In WeChat Page
+
+ Install Test App Silently
+ Uninstall App Silently
+ Test app have installed
+ Install successfully
+ Install unsuccessfully
+ Please install test app first
+ Uninstall successfully
+ Uninstall unsuccessfully
+ Shutdown
+ Reboot
+ Reboot To Recovery
+ Reboot To Bootloader
+ Send SMS Silent
+ Mobile Data Enabled
+
+
+
\ No newline at end of file
diff --git a/feature/utilcode/app/.gitignore b/feature/utilcode/app/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/utilcode/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/utilcode/app/build.gradle b/feature/utilcode/app/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/utilcode/app/proguard-rules.pro b/feature/utilcode/app/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/utilcode/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/utilcode/app/src/main/AndroidManifest.xml b/feature/utilcode/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..34308fcb79
--- /dev/null
+++ b/feature/utilcode/app/src/main/AndroidManifest.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/feature/utilcode/app/src/main/java/com/blankj/utilcode/app/UtilCodeApp.kt b/feature/utilcode/app/src/main/java/com/blankj/utilcode/app/UtilCodeApp.kt
new file mode 100644
index 0000000000..42d2909041
--- /dev/null
+++ b/feature/utilcode/app/src/main/java/com/blankj/utilcode/app/UtilCodeApp.kt
@@ -0,0 +1,30 @@
+package com.blankj.utilcode.app
+
+import com.blankj.common.CommonApplication
+import com.blankj.utilcode.util.Utils
+
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2016/10/12
+ * desc : app about utils
+ * ```
+ */
+class UtilCodeApp : CommonApplication() {
+
+ companion object {
+ lateinit var instance: UtilCodeApp
+ private set
+ }
+
+ override fun onCreate() {
+ Utils.init(this)
+ super.onCreate()
+ instance = this
+// BusUtils.register("com.blankj.androidutilcode")
+ }
+}
+
+
diff --git a/feature/utilcode/export/.gitignore b/feature/utilcode/export/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/utilcode/export/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/utilcode/export/build.gradle b/feature/utilcode/export/build.gradle
new file mode 100644
index 0000000000..30e59272ee
--- /dev/null
+++ b/feature/utilcode/export/build.gradle
@@ -0,0 +1,8 @@
+ext {
+ groupId = Config.modules.feature_utilcode_export.groupId
+ artifactId = Config.modules.feature_utilcode_export.artifactId
+ version = Config.modules.feature_utilcode_export.version
+ website = "https://github.com/Blankj/AndroidUtilCode"
+}
+//apply from: "${rootDir.path}/config/publish.gradle"
+//./gradlew :feature_utilcode_export:mavenLocal // 上传到本地 mavenLocal
\ No newline at end of file
diff --git a/feature/utilcode/export/proguard-rules.pro b/feature/utilcode/export/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/utilcode/export/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/utilcode/export/src/main/AndroidManifest.xml b/feature/utilcode/export/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..9bbbcc3210
--- /dev/null
+++ b/feature/utilcode/export/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
+
diff --git a/feature/utilcode/export/src/main/java/com/blankj/utilcode/export/api/UtilCodeApi.java b/feature/utilcode/export/src/main/java/com/blankj/utilcode/export/api/UtilCodeApi.java
new file mode 100644
index 0000000000..ea7d5291be
--- /dev/null
+++ b/feature/utilcode/export/src/main/java/com/blankj/utilcode/export/api/UtilCodeApi.java
@@ -0,0 +1,26 @@
+package com.blankj.utilcode.export.api;
+
+import android.content.Context;
+
+import com.blankj.utilcode.util.ApiUtils;
+
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2019/07/01
+ * desc :
+ *
+ */
+public abstract class UtilCodeApi extends ApiUtils.BaseApi {
+
+ public abstract void startUtilCodeActivity(Context context);
+
+ public abstract void testCallback(Callback callback);
+
+ public interface Callback {
+ void call();
+ }
+
+}
\ No newline at end of file
diff --git a/feature/utilcode/pkg/.gitignore b/feature/utilcode/pkg/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/feature/utilcode/pkg/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/feature/utilcode/pkg/build.gradle b/feature/utilcode/pkg/build.gradle
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/feature/utilcode/pkg/proguard-rules.pro b/feature/utilcode/pkg/proguard-rules.pro
new file mode 100644
index 0000000000..f1b424510d
--- /dev/null
+++ b/feature/utilcode/pkg/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/feature/utilcode/pkg/src/main/AndroidManifest.xml b/feature/utilcode/pkg/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..8da0667a23
--- /dev/null
+++ b/feature/utilcode/pkg/src/main/AndroidManifest.xml
@@ -0,0 +1,284 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/feature/utilcode/pkg/src/main/assets/fonts/dnmbhs.ttf b/feature/utilcode/pkg/src/main/assets/fonts/dnmbhs.ttf
new file mode 100644
index 0000000000..8ac8dadba1
Binary files /dev/null and b/feature/utilcode/pkg/src/main/assets/fonts/dnmbhs.ttf differ
diff --git a/feature/utilcode/pkg/src/main/assets/test/sub/test.txt b/feature/utilcode/pkg/src/main/assets/test/sub/test.txt
new file mode 100644
index 0000000000..f7bc1649eb
--- /dev/null
+++ b/feature/utilcode/pkg/src/main/assets/test/sub/test.txt
@@ -0,0 +1,2 @@
+1st line
+2nd line
\ No newline at end of file
diff --git a/feature/utilcode/pkg/src/main/assets/test/test.txt b/feature/utilcode/pkg/src/main/assets/test/test.txt
new file mode 100644
index 0000000000..f7bc1649eb
--- /dev/null
+++ b/feature/utilcode/pkg/src/main/assets/test/test.txt
@@ -0,0 +1,2 @@
+1st line
+2nd line
\ No newline at end of file
diff --git a/feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/Config.kt b/feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/Config.kt
new file mode 100644
index 0000000000..51bb0b7e66
--- /dev/null
+++ b/feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/Config.kt
@@ -0,0 +1,19 @@
+package com.blankj.utilcode.pkg
+
+import com.blankj.utilcode.util.PathUtils
+
+/**
+ * ```
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2017/05/10
+ * desc : config about constants
+ * ```
+ */
+object Config {
+ val FILE_SEP = System.getProperty("file.separator")
+ val LINE_SEP = System.getProperty("line.separator")
+ const val TEST_PKG = "com.blankj.testinstall"
+ val CACHE_PATH = PathUtils.getCachePathExternalFirst() + FILE_SEP
+ val TEST_APK_PATH: String = CACHE_PATH + "test_install.apk"
+}
diff --git a/feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/UtilCodeApiImpl.java b/feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/UtilCodeApiImpl.java
new file mode 100644
index 0000000000..076858b3d1
--- /dev/null
+++ b/feature/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/UtilCodeApiImpl.java
@@ -0,0 +1,31 @@
+package com.blankj.utilcode.pkg;
+
+import android.content.Context;
+
+import com.blankj.utilcode.export.api.UtilCodeApi;
+import com.blankj.utilcode.pkg.feature.CoreUtilActivity;
+import com.blankj.utilcode.util.ApiUtils;
+
+/**
+ *
+ * author: Blankj
+ * blog : http://blankj.com
+ * time : 2019/07/01
+ * desc :
+ *