Initial commit

master
孔德腾 5 years ago committed by 孔德腾
parent 49d2ae74bb
commit a69f7732b0
  1. 6
      .idea/vcs.xml
  2. 19
      DKit.iml
  3. 19
      DebugKit.iml
  4. 1
      app/.gitignore
  5. 162
      app/app.iml
  6. 36
      app/build.gradle
  7. 21
      app/proguard-rules.pro
  8. 27
      app/src/androidTest/java/vip/devkit/DebugKit/Demo/ExampleInstrumentedTest.java
  9. 22
      app/src/main/AndroidManifest.xml
  10. 39
      app/src/main/java/vip/devkit/DebugKit/Demo/MainActivity.java
  11. 43
      app/src/main/java/vip/devkit/DebugKit/Demo/PDF.java
  12. 34
      app/src/main/res/drawable-v24/ic_launcher_foreground.xml
  13. 170
      app/src/main/res/drawable/ic_launcher_background.xml
  14. 7
      app/src/main/res/drawable/shape_debug.xml
  15. 33
      app/src/main/res/layout/activity_main.xml
  16. 29
      app/src/main/res/layout/activity_pdf.xml
  17. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
  18. 5
      app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
  19. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  20. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher_round.png
  21. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  22. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher_round.png
  23. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  24. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
  25. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  26. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
  27. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  28. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  29. 6
      app/src/main/res/values/colors.xml
  30. 3
      app/src/main/res/values/strings.xml
  31. 11
      app/src/main/res/values/styles.xml
  32. 17
      app/src/test/java/vip/devkit/DebugKit/Demo/ExampleUnitTest.java
  33. 28
      build.gradle
  34. 1
      dklib/.gitignore
  35. 34
      dklib/build.gradle
  36. 147
      dklib/dklib.iml
  37. 21
      dklib/proguard-rules.pro
  38. 27
      dklib/src/androidTest/java/vip/devkit/debugkit/ExampleInstrumentedTest.java
  39. 48
      dklib/src/main/AndroidManifest.xml
  40. 14
      dklib/src/main/aidl/android/content/pm/IPackageStatsObserver.aidl
  41. 3
      dklib/src/main/aidl/android/content/pm/PackageStats.aidl
  42. 14
      dklib/src/main/java/android/content/pm/IPackageStatsObserver.aidl
  43. 3
      dklib/src/main/java/android/content/pm/PackageStats.aidl
  44. 199
      dklib/src/main/java/vip/devkit/debugkit/DataSource.java
  45. 17
      dklib/src/main/java/vip/devkit/debugkit/DebugKitFileProvider.java
  46. 49
      dklib/src/main/java/vip/devkit/debugkit/KitAdapter.java
  47. 41
      dklib/src/main/java/vip/devkit/debugkit/KitManagerAdapter.java
  48. 67
      dklib/src/main/java/vip/devkit/debugkit/adapter/BaseUrlManagerAdapter.java
  49. 62
      dklib/src/main/java/vip/devkit/debugkit/adapter/CrashListAdapter.java
  50. 34
      dklib/src/main/java/vip/devkit/debugkit/adapter/FileFolderAdapter.java
  51. 56
      dklib/src/main/java/vip/devkit/debugkit/adapter/FileInfoAdapter.java
  52. 39
      dklib/src/main/java/vip/devkit/debugkit/adapter/PermissionManagerAdapter.java
  53. 281
      dklib/src/main/java/vip/devkit/debugkit/bean/AppInfoBean.java
  54. 26
      dklib/src/main/java/vip/devkit/debugkit/bean/CrashInfoBean.java
  55. 22
      dklib/src/main/java/vip/devkit/debugkit/bean/FileInfoBean.java
  56. 15
      dklib/src/main/java/vip/devkit/debugkit/bean/PermissionInfo.java
  57. 25
      dklib/src/main/java/vip/devkit/debugkit/kit/Category.java
  58. 30
      dklib/src/main/java/vip/devkit/debugkit/kit/GroupKitItem.java
  59. 31
      dklib/src/main/java/vip/devkit/debugkit/kit/IKit.java
  60. 23
      dklib/src/main/java/vip/devkit/debugkit/kit/KitItem.java
  61. 27
      dklib/src/main/java/vip/devkit/debugkit/kit/crash/CacheConfig.java
  62. 115
      dklib/src/main/java/vip/devkit/debugkit/kit/crash/CacheUtils.java
  63. 126
      dklib/src/main/java/vip/devkit/debugkit/kit/crash/CrashCaptureManager.java
  64. 49
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/AppInfo.java
  65. 50
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/BaseUrlManger.java
  66. 50
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/CachesManager.java
  67. 53
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/CrashManger.java
  68. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/DataExport.java
  69. 50
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/FileExplorer.java
  70. 47
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/LogManager.java
  71. 47
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/PermissionManager.java
  72. 47
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/Simulation.java
  73. 47
      dklib/src/main/java/vip/devkit/debugkit/kit/debug/WebBrowse.java
  74. 15
      dklib/src/main/java/vip/devkit/debugkit/kit/developer/Language.java
  75. 15
      dklib/src/main/java/vip/devkit/debugkit/kit/developer/RuningService.java
  76. 15
      dklib/src/main/java/vip/devkit/debugkit/kit/developer/SystemSetting.java
  77. 47
      dklib/src/main/java/vip/devkit/debugkit/kit/developer/USBKit.java
  78. 73
      dklib/src/main/java/vip/devkit/debugkit/kit/log/IPrinter.java
  79. 113
      dklib/src/main/java/vip/devkit/debugkit/kit/log/LogCat.java
  80. 45
      dklib/src/main/java/vip/devkit/debugkit/kit/log/LogConfig.java
  81. 39
      dklib/src/main/java/vip/devkit/debugkit/kit/log/LogLevel.java
  82. 327
      dklib/src/main/java/vip/devkit/debugkit/kit/log/LogPrinter.java
  83. 104
      dklib/src/main/java/vip/devkit/debugkit/kit/log/Util.java
  84. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/performance/Battery.java
  85. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/performance/CPU.java
  86. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/performance/FTPS.java
  87. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/performance/RAM.java
  88. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/performance/Time.java
  89. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/performance/Traffic.java
  90. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/system/CpuKit.java
  91. 47
      dklib/src/main/java/vip/devkit/debugkit/kit/system/HardwareKit.java
  92. 50
      dklib/src/main/java/vip/devkit/debugkit/kit/system/NetworkKit.java
  93. 50
      dklib/src/main/java/vip/devkit/debugkit/kit/system/ScreenKit.java
  94. 53
      dklib/src/main/java/vip/devkit/debugkit/kit/system/SysInfo.java
  95. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/ue/ColorPicker.java
  96. 46
      dklib/src/main/java/vip/devkit/debugkit/kit/ue/UE.java
  97. 36
      dklib/src/main/java/vip/devkit/debugkit/ui/AppDataCleanActivity.java
  98. 250
      dklib/src/main/java/vip/devkit/debugkit/ui/FileExplorer/FileExplorerActivity.java
  99. 95
      dklib/src/main/java/vip/devkit/debugkit/ui/KitManagerActivity.java
  100. 222
      dklib/src/main/java/vip/devkit/debugkit/ui/base/BaseActivity.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="DKit" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="DebugKit" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

1
app/.gitignore vendored

@ -0,0 +1 @@
/build

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources" />
<excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-libraries" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkDebugClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-core:3.2.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:runner:1.2.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test:monitor:1.2.0@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.0.1@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-idling-resource:3.2.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.joanzapata.pdfview:android-pdfview:1.0.4@aar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
<orderEntry type="module" module-name="dklib" />
</component>
</module>

@ -0,0 +1,36 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "vip.devkit.DebugKit.Demo"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':dklib')
api 'com.joanzapata.pdfview:android-pdfview:1.0.4@aar'
}

@ -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

@ -0,0 +1,27 @@
package vip.devkit.DebugKit.Demo;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <PermissionManagerActivity href="http://d.android.com/tools/testing">Testing documentation</PermissionManagerActivity>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("vip.devkit.DebugKit.Demo", appContext.getPackageName());
}
}

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="vip.devkit.DebugKit.Demo">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

@ -0,0 +1,39 @@
package vip.devkit.DebugKit.Demo;
import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import vip.devkit.debugkit.ui.KitManagerActivity;
public class MainActivity extends AppCompatActivity {
/**
* Debug
*/
private TextView mTvDebug;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
}
private void initView() {
mTvDebug = (TextView) findViewById(R.id.tv_debug);
mTvDebug.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, KitManagerActivity.class);
startActivity(intent);
String[] permissions=new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO};
}
});
}
}

@ -0,0 +1,43 @@
package vip.devkit.DebugKit.Demo;
import android.os.Bundle;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.joanzapata.pdfview.PDFView;
/**
* Package Name: vip.devkit.DebugKit.Demo
* File Name: PDF.java
* Create Date: 2019/7/5 16:51
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class PDF extends AppCompatActivity {
private PDFView mPdfView;
/**
* Debug
*/
private TextView mTvDebug;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pdf);
initView();
}
private void initView() {
mPdfView = (PDFView) findViewById(R.id.pdf_view);
mTvDebug = (TextView) findViewById(R.id.tv_debug);
}
}

@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#111"/>
<corners android:radius="50dp"/>
</shape>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_debug"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="50dp"
android:gravity="center"
android:textSize="12sp"
android:layout_marginBottom="150dp"
android:background="@drawable/shape_debug"
android:text="Debug"
android:textColor="#ffffff" />
</RelativeLayout>

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.joanzapata.pdfview.PDFView
android:id="@+id/pdf_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/tv_debug"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="50dp"
android:layout_marginBottom="150dp"
android:background="@drawable/shape_debug"
android:gravity="center"
android:text="Debug"
android:textColor="#ffffff"
android:textSize="12sp" />
</RelativeLayout>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>

@ -0,0 +1,3 @@
<resources>
<string name="app_name">DebugKit</string>
</resources>

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

@ -0,0 +1,17 @@
package vip.devkit.DebugKit.Demo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <PermissionManagerActivity href="http://d.android.com/tools/testing">Testing documentation</PermissionManagerActivity>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

@ -0,0 +1,28 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

1
dklib/.gitignore vendored

@ -0,0 +1 @@
/build

@ -0,0 +1,34 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation('com.android.support:recyclerview-v7:29.0.0') {
exclude group: 'com.android.support'
}
implementation 'com.android.support:design:29.0.0'
}
//https://github.com/nisrulz/easydeviceinfo/wiki/Usage#easyappmod

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":dklib" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":dklib" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources" />
<excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/aapt_friendly_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/aidl_parcelable" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediate-jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.transition:transition:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.material:material:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cardview:cardview:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
</component>
</module>

@ -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

@ -0,0 +1,27 @@
package vip.devkit.debugkit;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <PermissionManagerActivity href="http://d.android.com/tools/testing">Testing documentation</PermissionManagerActivity>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("vip.devkit.debugkit.test", appContext.getPackageName());
}
}

@ -0,0 +1,48 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="vip.devkit.debugkit">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<!-- 富媒体需要声明的权限 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- 适配Android N系统必需的ContentProvider写权限声明,写权限包含应用包名-->
<uses-permission android:name="vip.devkit.permission.WRITE_PUSHINFOPROVIDER.com.idyoga.live" />
<permission
android:name="vip.devkit.permission.WRITE_PUSHINFOPROVIDER.com.idyoga.live"
android:description="@string/dk_debug"
android:protectionLevel="signature" />
<application
android:allowBackup="true"
android:label="@string/app_name">
<activity android:name=".ui.KitManagerActivity" />
<activity android:name=".ui.base_url.BaseUrlManagerActivity" />
<activity android:name=".ui.permission.PermissionManagerActivity" />
<activity android:name=".ui.crash.CrashManagerActivity" />
<activity android:name=".ui.AppDataCleanActivity"/>
<activity android:name=".ui.FileExplorer.FileExplorerActivity"/>
</application>
</manifest>

@ -0,0 +1,14 @@
// PackageStats.aidl
package android.content.pm;
import android.content.pm.PackageStats;
/**
* API for package data change related callbacks from the Package Manager.
* Some usage scenarios include deletion of cache directory, generate
* statistics related to code, data, cache usage(TODO)
* {@hide}
*/
oneway interface IPackageStatsObserver {
void onGetStatsCompleted(in PackageStats pStats, boolean succeeded);
}

@ -0,0 +1,3 @@
package android.content.pm;
parcelable PackageStats;

@ -0,0 +1,14 @@
// PackageStats.aidl
package android.content.pm;
import android.content.pm.PackageStats;
/**
* API for package data change related callbacks from the Package Manager.
* Some usage scenarios include deletion of cache directory, generate
* statistics related to code, data, cache usage(TODO)
* {@hide}
*/
oneway interface IPackageStatsObserver {
void onGetStatsCompleted(in PackageStats pStats, boolean succeeded);
}

@ -0,0 +1,3 @@
package android.content.pm;
parcelable PackageStats;

@ -0,0 +1,199 @@
package vip.devkit.debugkit;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import vip.devkit.debugkit.kit.GroupKitItem;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.kit.KitItem;
import vip.devkit.debugkit.kit.debug.AppInfo;
import vip.devkit.debugkit.kit.debug.BaseUrlManger;
import vip.devkit.debugkit.kit.debug.CachesManager;
import vip.devkit.debugkit.kit.debug.CrashManger;
import vip.devkit.debugkit.kit.debug.DataExport;
import vip.devkit.debugkit.kit.debug.FileExplorer;
import vip.devkit.debugkit.kit.debug.WebBrowse;
import vip.devkit.debugkit.kit.debug.LogManager;
import vip.devkit.debugkit.kit.debug.PermissionManager;
import vip.devkit.debugkit.kit.debug.Simulation;
import vip.devkit.debugkit.kit.performance.Battery;
import vip.devkit.debugkit.kit.performance.CPU;
import vip.devkit.debugkit.kit.performance.FTPS;
import vip.devkit.debugkit.kit.performance.RAM;
import vip.devkit.debugkit.kit.performance.Time;
import vip.devkit.debugkit.kit.performance.Traffic;
import vip.devkit.debugkit.kit.system.CpuKit;
import vip.devkit.debugkit.kit.system.HardwareKit;
import vip.devkit.debugkit.kit.system.NetworkKit;
import vip.devkit.debugkit.kit.system.ScreenKit;
import vip.devkit.debugkit.kit.system.SysInfo;
import vip.devkit.debugkit.kit.ue.ColorPicker;
import vip.devkit.debugkit.kit.ue.UE;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit
* File Name: DataSource.java
* Create Date: 2019/7/1 17:24
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class DataSource {
private List<GroupKitItem> mItemList = new ArrayList<>();
private List<KitItem> mDiyKitItems = new ArrayList<>();
private Context mContext;
public List<GroupKitItem> getKitList() {
return mItemList;
}
public DataSource(Context context) {
mContext = context;
initKit();
}
private void initKit() {
sysKit();
debugKit();
developerKit();
performanceKit();
ueKit();
diyKit();
}
public void sysKit() {
GroupKitItem sys = new GroupKitItem();
sys.mGroupName = ResUtil.getString(mContext, R.string.dk_sys_system);
List<IKit> d = new ArrayList<>();
d.add(new SysInfo());
d.add(new ScreenKit());
d.add(new NetworkKit());
d.add(new HardwareKit());
d.add(new CpuKit());
List<KitItem> kitItems = new ArrayList<>();
for (IKit kit : d) {
kitItems.add(new KitItem(kit));
}
sys.mKitList = kitItems;
mItemList.add(sys);
}
public void debugKit() {
GroupKitItem mGroupBean = new GroupKitItem();
mGroupBean.mGroupName = ResUtil.getString(mContext, R.string.dk_debug);
List<IKit> d = new ArrayList<>();
d.add(new AppInfo());
d.add(new FileExplorer());
d.add(new LogManager());
d.add(new PermissionManager());
d.add(new BaseUrlManger());
d.add(new CachesManager());
d.add(new CrashManger());
d.add(new Simulation());
d.add(new DataExport());
d.add(new WebBrowse());
List<KitItem> kitItems = new ArrayList<>();
for (IKit kit : d) {
kitItems.add(new KitItem(kit));
}
mGroupBean.mKitList = kitItems;
mItemList.add(mGroupBean);
}
public void developerKit() {
GroupKitItem mGroupBean = new GroupKitItem();
mGroupBean.mGroupName = ResUtil.getString(mContext, R.string.dk_developer);
List<IKit> d = new ArrayList<>();
d.add(new SysInfo());
d.add(new ScreenKit());
d.add(new NetworkKit());
d.add(new HardwareKit());
d.add(new CpuKit());
List<KitItem> kitItems = new ArrayList<>();
for (IKit kit : d) {
kitItems.add(new KitItem(kit));
}
mGroupBean.mKitList = kitItems;
mItemList.add(mGroupBean);
}
public void performanceKit() {
GroupKitItem mGroupBean = new GroupKitItem();
mGroupBean.mGroupName = ResUtil.getString(mContext, R.string.dk_performance);
List<IKit> d = new ArrayList<>();
d.add(new FTPS());
d.add(new CPU());
d.add(new RAM());
d.add(new Traffic());
d.add(new Battery());
d.add(new Time());
List<KitItem> kitItems = new ArrayList<>();
for (IKit kit : d) {
kitItems.add(new KitItem(kit));
}
mGroupBean.mKitList = kitItems;
mItemList.add(mGroupBean);
}
public void ueKit() {
GroupKitItem mGroupBean = new GroupKitItem();
mGroupBean.mGroupName = ResUtil.getString(mContext, R.string.dk_ue);
List<IKit> d = new ArrayList<>();
d.add(new ColorPicker());
d.add(new UE());
List<KitItem> kitItems = new ArrayList<>();
for (IKit kit : d) {
kitItems.add(new KitItem(kit));
}
mGroupBean.mKitList = kitItems;
mItemList.add(mGroupBean);
}
public void diyKit() {
if (mDiyKitItems.size() > 0) {
GroupKitItem mGroupBean = new GroupKitItem();
mGroupBean.mGroupName = ResUtil.getString(mContext, R.string.dk_diy);
mGroupBean.mKitList = mDiyKitItems;
}
}
public void add(IKit mIKit) {
mDiyKitItems.add(new KitItem(mIKit));
}
public void add(List<IKit> list) {
for (IKit kit : list) {
mDiyKitItems.add(new KitItem(kit));
}
}
}

@ -0,0 +1,17 @@
package vip.devkit.debugkit;
import androidx.core.content.FileProvider;
/**
* Package Name: vip.devkit.debugkit
* File Name: DebugKitFileProvider.java
* Create Date: 2019/6/28 11:06
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class DebugKitFileProvider extends FileProvider {
}

@ -0,0 +1,49 @@
package vip.devkit.debugkit;
import android.view.View;
import androidx.annotation.Nullable;
import java.util.List;
import vip.devkit.debugkit.kit.KitItem;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit
* File Name: KitAdapter.java
* Create Date: 2019/7/1 14:59
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class KitAdapter extends BaseRecyclerAdapter<KitItem, BaseViewHolder> {
public KitAdapter(int layoutResId, @Nullable List<KitItem> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper,final KitItem mItem) {
helper.setText(R.id.tv_name, mItem.kit.getName())
.setImageResource(R.id.iv_icon, mItem.kit.getIcon());
helper.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mItem.kit.onClick(mContext);
}
});
}
@Override
public void setOnItemClick(View v, int position) {
super.setOnItemClick(v, position);
}
}

@ -0,0 +1,41 @@
package vip.devkit.debugkit;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import vip.devkit.debugkit.kit.GroupKitItem;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit
* File Name: KitManagerAdapter.java
* Create Date: 2019/7/1 11:16
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class KitManagerAdapter extends BaseRecyclerAdapter<GroupKitItem, BaseViewHolder> {
public KitManagerAdapter(int layoutResId, @Nullable List<GroupKitItem> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, GroupKitItem mItem) {
helper.setText(R.id.tv_group_name, mItem.mGroupName);
RecyclerView mKitList = (RecyclerView) helper.getView(R.id.rv_group_kit);
mKitList.setLayoutManager(new GridLayoutManager(mContext, 4));
KitAdapter mKitAdapter = new KitAdapter(R.layout.dk_item_kit, mItem.mKitList);
mKitList.setAdapter(mKitAdapter);
}
}

@ -0,0 +1,67 @@
package vip.devkit.debugkit.adapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import androidx.annotation.Nullable;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.log.LogCat;
import vip.devkit.debugkit.ui.base_url.UrlInfo;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit.adapter
* File Name: BaseUrlManagerAdapter.java
* Create Date: 2019/7/3 10:34
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class BaseUrlManagerAdapter extends BaseRecyclerAdapter<UrlInfo, BaseViewHolder> {
public interface OnUrlCheckedListener {
void onChecked(UrlInfo urlInfo);
}
private OnUrlCheckedListener mOnUrlCheckedListener;
private int checkPosition=-1;
public void setOnUrlCheckedListener(OnUrlCheckedListener onUrlCheckedListener) {
mOnUrlCheckedListener = onUrlCheckedListener;
}
public BaseUrlManagerAdapter(int layoutResId, @Nullable List<UrlInfo> data) {
super(layoutResId, data);
}
@Override
protected void convert(final BaseViewHolder helper, final UrlInfo mItem) {
helper.setText(R.id.tv_url, mItem.getBaseUrl());
CheckBox checkBox = (CheckBox) helper.getView(R.id.cb_check);
LogCat.i("----------"+helper.getAdapterPosition());
if (helper.getAdapterPosition()==checkPosition){
checkBox.setChecked(true);
}else {
checkBox.setChecked(false);
}
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
LogCat.i("----------"+helper.getAdapterPosition()+"/"+isChecked);
if (isChecked && mOnUrlCheckedListener != null) {
checkPosition=helper.getAdapterPosition();
mOnUrlCheckedListener.onChecked(mItem);
} else {
checkPosition=-1;
}
}
});
}
}

@ -0,0 +1,62 @@
package vip.devkit.debugkit.adapter;
import android.util.Log;
import androidx.annotation.Nullable;
import java.lang.reflect.UndeclaredThrowableException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.bean.CrashInfoBean;
import vip.devkit.debugkit.kit.log.LogCat;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit.adapter
* File Name: CrashListAdapter.java
* Create Date: 2019/7/9 10:00
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CrashListAdapter extends BaseRecyclerAdapter<CrashInfoBean, BaseViewHolder> {
public CrashListAdapter(int layoutResId, @Nullable List<CrashInfoBean> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, CrashInfoBean mItem) {
LogCat.i(" 1" + mItem.tr.toString());
Throwable throwable = mItem.tr;
String type = throwable.toString();
// LogCat.i("throwable 99999 "+type.substring(0,type.indexOf(":")));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
helper.setText(R.id.tv_time,""+dateFormat.format(new Date(mItem.time)))
.setText(R.id.tv_crash_name,type.substring(0,type.indexOf(":")));
if (helper.getAdapterPosition()==0){
LogCat.i(Log.getStackTraceString(throwable));
}
// StackTraceElement[] elements= throwable .getStackTrace();
// for (int i = 0; i <elements.length ; i++) {
// StackTraceElement stackTraceElement = elements[i];
// LogCat.i(
// helper.getAdapterPosition()
// +"堆栈 getLineNumber:"+stackTraceElement.getClassName()
// +"("
// +stackTraceElement.getFileName()
// +":"
// +stackTraceElement.getLineNumber()+")");
// }
}
}

@ -0,0 +1,34 @@
package vip.devkit.debugkit.adapter;
import androidx.annotation.Nullable;
import java.io.File;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.bean.FileInfoBean;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit.adapter
* File Name: FileInfoAdapter.java
* Create Date: 2019/7/9 14:27
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class FileFolderAdapter extends BaseRecyclerAdapter<FileInfoBean, BaseViewHolder> {
public FileFolderAdapter(int layoutResId, @Nullable List<FileInfoBean> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, FileInfoBean mItem) {
helper.setText(R.id.tv_folder,mItem.file.getName()+" >");
}
}

@ -0,0 +1,56 @@
package vip.devkit.debugkit.adapter;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.bean.FileInfoBean;
import vip.devkit.debugkit.kit.log.LogCat;
import vip.devkit.debugkit.util.FileUtil;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit.adapter
* File Name: FileInfoAdapter.java
* Create Date: 2019/7/9 14:27
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class FileInfoAdapter extends BaseRecyclerAdapter<FileInfoBean, BaseViewHolder> {
public FileInfoAdapter(int layoutResId, @Nullable List<FileInfoBean> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, FileInfoBean fileInfo) {
helper.setText(R.id.tv_name, fileInfo.file.getName())
.setVisible(R.id.iv_more, !fileInfo.file.isFile());
ImageView mIcon = (ImageView) helper.getView(R.id.iv_icon);
if (fileInfo.file.isFile()) {
String suffix = FileUtil.getSuffix(fileInfo.file);
LogCat.i("---------------"+suffix);
if (suffix.equals("gif") || suffix.equals("jpg") || suffix.equals("jpeg") || suffix.equals("png") || suffix.equals("bmp")) {
mIcon.setImageResource(R.mipmap.dk_file_img);
} else if (suffix.equals(FileUtil.TXT)||suffix.equals("json")||suffix.equals("xml")) {
mIcon.setImageResource(R.mipmap.dk_file_txt);
} else if (suffix.equals(FileUtil.SHARED_PREFS)) {
} else if (suffix.equals(FileUtil.DB)) {
mIcon.setImageResource(R.mipmap.dk_file_db);
} else {
mIcon.setImageResource(R.mipmap.dk_file_ohter);
}
} else {
mIcon.setImageResource(R.mipmap.dk_file_folder);
}
}
}

@ -0,0 +1,39 @@
package vip.devkit.debugkit.adapter;
import android.content.pm.PermissionInfo;
import androidx.annotation.Nullable;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.ui.permission.PermissionData;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
import vip.devkit.debugkit.widget.recyclerview.BaseViewHolder;
/**
* Package Name: vip.devkit.debugkit.adapter
* File Name: PermissionManagerAdapter.java
* Create Date: 2019/7/3 11:58
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class PermissionManagerAdapter extends BaseRecyclerAdapter<String, BaseViewHolder> {
public PermissionManagerAdapter(int layoutResId, @Nullable List<String> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, String name) {
helper.setText(R.id.tv_permission, name)
.setText(R.id.tv_desc,""+PermissionData.getPermissionName(name))
.setChecked(R.id.cb_check, PermissionData.hasSelfPermission(mContext, name));
}
}

@ -0,0 +1,281 @@
package vip.devkit.debugkit.bean;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Build;
import androidx.annotation.Keep;
import vip.devkit.debugkit.util.AppUtil;
import vip.devkit.debugkit.util.DeviceUtils;
import vip.devkit.debugkit.util.FileUtil;
/**
* Package Name: vip.devkit.debugkit.bean
* File Name: AppInfoBean.java
* Create Date: 2019/7/8 13:56
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class AppInfoBean {
@Keep // App 包名
private String appPackName;
@Keep // App 应用名
private String appName;
@Keep // App 图标
private transient Drawable appIcon;
@Keep // App 类型
private AppType appType;
@Keep // App 版本号
private int versionCode;
@Keep // App 版本名
private String versionName;
@Keep // App 首次安装时间
private long firstInstallTime;
@Keep // App 最后一次更新时间
private long lastUpdateTime;
@Keep // App 地址
private String sourceDir;
@Keep // APK 大小
private long apkSize;
@Keep //Sign MD5
private String apkSign;
@Keep //最小支持
private int minSdkVersion = -1;
@Keep //兼容
private int targetSdkVersion = -1;
@Keep //activity 数量
private int activityCount;
@Keep //service 数量
private int serviceCount;
@Keep //receiver 数量
private int receiverCount;
@Keep //provider 数量
private int providerCount;
@Keep //permission 数量
private int permissionCount;
private Context context;
/**
* 初始化 AppInfoBean
*/
protected AppInfoBean() {
init();
}
public AppInfoBean(Context context) {
this.context = context;
init();
}
private void init() {
//GET_CONFIGURATIONS
PackageInfo packageInfo = DeviceUtils.getPackageInfo(context);
PackageManager packageManager = context.getPackageManager();
// App 包名
appPackName = packageInfo.applicationInfo.packageName;
// App 应用名
appName = packageManager.getApplicationLabel(packageInfo.applicationInfo).toString();
// App 图标
appIcon = packageManager.getApplicationIcon(packageInfo.applicationInfo);
// App 类型
appType = AppInfoBean.getAppType(packageInfo);
// App 版本号
versionCode = packageInfo.versionCode;
// App 版本名
versionName = packageInfo.versionName;
// App 首次安装时间
firstInstallTime = packageInfo.firstInstallTime;
// App 最后一次更新时间
lastUpdateTime = packageInfo.lastUpdateTime;
// App 地址
sourceDir = packageInfo.applicationInfo.sourceDir;
// APK 大小
// apkSize = FileUtil.getFileSize(context,sourceDir);
// APK sign
apkSign = AppUtil.getSign(context, packageInfo.packageName);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
minSdkVersion = context.getApplicationInfo().minSdkVersion;
}
targetSdkVersion = context.getApplicationInfo().targetSdkVersion;
PackageInfo pia = DeviceUtils.getPackageInfo(context, PackageManager.GET_ACTIVITIES);
if (pia.activities != null) {
activityCount = pia.activities.length;
}
PackageInfo pis = DeviceUtils.getPackageInfo(context, PackageManager.GET_SERVICES);
if (pis.services != null) {
serviceCount = pis.services.length;
}
PackageInfo pir = DeviceUtils.getPackageInfo(context, PackageManager.GET_RECEIVERS);
if (pir.receivers != null) {
receiverCount = pir.receivers.length;
}
PackageInfo pip = DeviceUtils.getPackageInfo(context, PackageManager.GET_PROVIDERS);
if (pip.providers != null) {
providerCount = pip.providers.length;
}
PackageInfo permissions = DeviceUtils.getPackageInfo(context, PackageManager.GET_PERMISSIONS);
if (permissions.requestedPermissions != null) {
permissionCount = permissions.requestedPermissions.length;
}
}
/**
* detail: 应用类型
*/
public enum AppType {
USER, // 用户 App
SYSTEM, // 系统 App
ALL // 全部 App
}
public String getAppPackName() {
return appPackName;
}
public String getAppName() {
return appName;
}
public Drawable getAppIcon() {
return appIcon;
}
public AppType getAppType() {
return appType;
}
public int getVersionCode() {
return versionCode;
}
public String getVersionName() {
return versionName;
}
public long getFirstInstallTime() {
return firstInstallTime;
}
public long getLastUpdateTime() {
return lastUpdateTime;
}
public String getSourceDir() {
return sourceDir;
}
public long getApkSize() {
return apkSize;
}
public String getApkSign() {
return apkSign;
}
public int getMinSdkVersion() {
return minSdkVersion;
}
public int getTargetSdkVersion() {
return targetSdkVersion;
}
public int getActivityCount() {
return activityCount;
}
public int getServiceCount() {
return serviceCount;
}
public int getReceiverCount() {
return receiverCount;
}
public int getProviderCount() {
return providerCount;
}
public int getPermissionCount() {
return permissionCount;
}
/**
* 获取 App 类型
*
* @param packageInfo {@link PackageInfo}
* @return {@link AppType} 应用类型
*/
public static AppType getAppType(final PackageInfo packageInfo) {
if (!isSystemApp(packageInfo) && !isSystemUpdateApp(packageInfo)) {
return AppType.USER;
}
return AppType.SYSTEM;
}
/**
* 是否系统程序
*
* @param packageInfo {@link PackageInfo}
* @return {@code true} yes, {@code false} no
*/
public static boolean isSystemApp(final PackageInfo packageInfo) {
return ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
}
/**
* 是否系统程序被手动更新后, 也成为第三方应用程序
*
* @param packageInfo {@link PackageInfo}
* @return {@code true} yes, {@code false} no
*/
public static boolean isSystemUpdateApp(final PackageInfo packageInfo) {
return ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
}
@Override
public String toString() {
return "AppInfoBean{" +
"appPackName='" + appPackName + '\'' +
", appName='" + appName + '\'' +
", appIcon=" + appIcon +
", appType=" + appType +
", versionCode=" + versionCode +
", versionName='" + versionName + '\'' +
", firstInstallTime=" + firstInstallTime +
", lastUpdateTime=" + lastUpdateTime +
", sourceDir='" + sourceDir + '\'' +
", apkSize=" + apkSize +
", apkSign='" + apkSign + '\'' +
", minSdkVersion='" + targetSdkVersion + '\'' +
", activityCount=" + activityCount +
", serviceCount=" + serviceCount +
", receiverCount=" + receiverCount +
", providerCount=" + providerCount +
", permissionCount=" + permissionCount +
'}';
}
}

@ -0,0 +1,26 @@
package vip.devkit.debugkit.bean;
import java.io.Serializable;
/**
* Package Name: vip.devkit.debugkit.bean
* File Name: CrashInfoBean.java
* Create Date: 2019/7/9 9:24
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CrashInfoBean implements Serializable {
public final Throwable tr;
public final long time;
public CrashInfoBean(Throwable tr, long l) {
this.tr = tr;
this.time = l;
}
}

@ -0,0 +1,22 @@
package vip.devkit.debugkit.bean;
import java.io.File;
/**
* Package Name: vip.devkit.debugkit.bean
* File Name: FileInfoBean.java
* Create Date: 2019/7/9 14:23
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class FileInfoBean {
public final File file;
public FileInfoBean(File file) {
this.file = file;
}
}

@ -0,0 +1,15 @@
package vip.devkit.debugkit.bean;
/**
* Package Name: vip.devkit.debugkit.bean
* File Name: PermissionData.java
* Create Date: 2019/7/3 11:59
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class PermissionInfo {
}

@ -0,0 +1,25 @@
package vip.devkit.debugkit.kit;
/**
* Package Name: vip.devkit.debugkit.kit
* File Name: Category.java
* Create Date: 2019/6/28 10:57
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public interface Category {
int BIZ = 0;
int TOOLS = 1;
int PERFORMANCE = 2;
int UI = 3;
int CLOSE = 5;
}

@ -0,0 +1,30 @@
package vip.devkit.debugkit.kit;
import java.security.acl.Group;
import java.util.List;
/**
* Package Name: vip.devkit.debugkit.kit
* File Name: GroupKitItem.java
* Create Date: 2019/7/1 14:53
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class GroupKitItem {
public String mGroupName;
public List<KitItem> mKitList;
public GroupKitItem() {
}
public GroupKitItem(String groupName, List<KitItem> kitList) {
mGroupName = groupName;
mKitList = kitList;
}
}

@ -0,0 +1,31 @@
package vip.devkit.debugkit.kit;
import android.content.Context;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
/**
* Package Name: vip.devkit.debugkit.kit
* File Name: IKit.java
* Create Date: 2019/6/28 10:57
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public interface IKit {
int getCategory();
@StringRes
int getName();
@DrawableRes
int getIcon();
void onClick(Context context);
void onAppInit(Context context);
}

@ -0,0 +1,23 @@
package vip.devkit.debugkit.kit;
/**
* Package Name: vip.devkit.debugkit.kit
* File Name: KitItem.java
* Create Date: 2019/7/1 15:00
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class KitItem {
public IKit kit;
public KitItem(){
}
public KitItem(IKit kit) {
this.kit = kit;
}
}

@ -0,0 +1,27 @@
package vip.devkit.debugkit.kit.crash;
/**
* Package Name: vip.devkit.debugkit.kit.crash
* File Name: CacheConfig.java
* Create Date: 2019/7/9 9:33
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CacheConfig {
static String CRASH_HISTORY_DIR = "crash";
static int CRASH_FILE_SZIE = 5;
static boolean isCrashCapture = false;
}

@ -0,0 +1,115 @@
package vip.devkit.debugkit.kit.crash;
import android.content.Context;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import vip.devkit.debugkit.kit.log.LogCat;
/**
* Package Name: vip.devkit.debugkit.kit.crash
* File Name: CacheUtils.java
* Create Date: 2019/7/9 9:30
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CacheUtils {
private CacheUtils() {
}
public static boolean saveObject(Context context, String key, Serializable ser) {
File file = new File(context.getCacheDir() + "/" + key);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
LogCat.e(e.toString());
}
}
return saveObject(ser, file);
}
public static Serializable readObject(Context context, String key) {
File file = new File(context.getCacheDir() + "/" + key);
return readObject(file);
}
public static boolean saveObject(Serializable ser, File file) {
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream(file);
oos = new ObjectOutputStream(fos);
oos.writeObject(ser);
oos.flush();
return true;
} catch (IOException e) {
LogCat.e(e.toString());
return false;
} finally {
if (oos != null) {
try {
oos.close();
} catch (IOException e) {
LogCat.e(e.toString());
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
LogCat.e(e.toString());
}
}
}
}
public static Serializable readObject(File file) {
if (file == null || !file.exists() || file.isDirectory()) {
return null;
}
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
return (Serializable) ois.readObject();
} catch (IOException e) {
if (e instanceof InvalidClassException) {
file.delete();
}
LogCat.e(e.toString());
return null;
} catch (ClassNotFoundException e) {
LogCat.e(e.toString());
return null;
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
LogCat.e(e.toString());
}
}
if (ois != null) {
try {
ois.close();
} catch (IOException e) {
LogCat.e(e.toString());
}
}
}
}
}

@ -0,0 +1,126 @@
package vip.devkit.debugkit.kit.crash;
import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.bean.CrashInfoBean;
import vip.devkit.debugkit.kit.log.LogCat;
import vip.devkit.debugkit.util.FileUtil;
/**
* Package Name: vip.devkit.debugkit.kit.crash
* File Name: CrashCaptureManager.java
* Create Date: 2019/7/9 9:26
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CrashCaptureManager implements Thread.UncaughtExceptionHandler {
private static final String TAG = "CrashCaptureManager";
private final Thread.UncaughtExceptionHandler mDefaultHandler;
private final Handler mHandler;
private Context mContext;
private CrashCaptureManager() {
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
HandlerThread handlerThread = new HandlerThread(TAG);
handlerThread.start();
mHandler = new Handler(handlerThread.getLooper());
}
private static class Holder {
private static final CrashCaptureManager INSTANCE = new CrashCaptureManager();
}
public static CrashCaptureManager getInstance() {
return Holder.INSTANCE;
}
public void init(Context context) {
mContext = context.getApplicationContext();
}
public void start() {
Thread.setDefaultUncaughtExceptionHandler(this);
}
public void stop() {
Thread.setDefaultUncaughtExceptionHandler(mDefaultHandler);
}
@Override
public void uncaughtException(final Thread t, final Throwable e) {
LogCat.d(t.toString());
LogCat.d(Log.getStackTraceString(e));
CacheUtils.saveObject(e, getCrashCacheFile());
post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, mContext.getString(R.string.dk_crash_capture_tips), Toast.LENGTH_SHORT).show();
}
});
postDelay(new Runnable() {
@Override
public void run() {
if (mDefaultHandler != null) {
mDefaultHandler.uncaughtException(t, e);
}
}
}, 2000);
}
private void post(Runnable r) {
mHandler.post(r);
}
private void postDelay(Runnable r, long delayMillis) {
mHandler.postDelayed(r, delayMillis);
}
public File getCrashCacheDir() {
File dir = new File(mContext.getCacheDir() + File.separator + "crash");
if (!dir.exists()) {
dir.mkdir();
}
return dir;
}
private File getCrashCacheFile() {
String fileName = new Date().toString();
return new File(getCrashCacheDir() + File.separator + fileName);
}
public void clearCacheHistory() {
FileUtil.deleteDirectory(getCrashCacheDir());
}
public List<CrashInfoBean> getCrashCaches() {
File[] caches = getCrashCacheDir().listFiles();
List<CrashInfoBean> result = new ArrayList<>();
if (caches == null) {
return result;
}
for (File cache : caches) {
Serializable serializable = CacheUtils.readObject(cache);
if (serializable instanceof Throwable) {
CrashInfoBean info = new CrashInfoBean((Throwable) serializable, cache.lastModified());
result.add(info);
}
}
return result;
}
}

@ -0,0 +1,49 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.bean.AppInfoBean;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.kit.log.LogCat;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class AppInfo implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_info;
}
@Override
public int getIcon() {
return R.mipmap.dk_app_info;
}
@Override
public void onClick(Context context) {
AppInfoBean appInfoBean = new AppInfoBean(context);
// LogCat.i("build netInfo:"+appInfoBean.toString());
LogCat.i("dk_log:"+123);
LogCat.i("dk_log----------------","build netInfo:"+appInfoBean.toString());
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,50 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.base_url.BaseUrlManagerActivity;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class BaseUrlManger implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_base_url;
}
@Override
public int getIcon() {
return R.mipmap.dk_base_url;
}
@Override
public void onClick(Context context) {
Intent intent = new Intent(context, BaseUrlManagerActivity.class);
context.startActivity(intent);
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,50 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.AppDataCleanActivity;
import vip.devkit.debugkit.ui.crash.CrashManagerActivity;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CachesManager implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_clean;
}
@Override
public int getIcon() {
return R.mipmap.dk_data_clean;
}
@Override
public void onClick(Context context) {
Intent intent = new Intent(context, AppDataCleanActivity.class);
context.startActivity(intent);
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,53 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.kit.crash.CrashCaptureManager;
import vip.devkit.debugkit.ui.crash.CrashManagerActivity;
import vip.devkit.debugkit.ui.permission.PermissionManagerActivity;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CrashManger implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_crash;
}
@Override
public int getIcon() {
return R.mipmap.dk_crash_catch;
}
@Override
public void onClick(Context context) {
CrashCaptureManager.getInstance().init(context);
CrashCaptureManager.getInstance().start();
Intent intent = new Intent(context, CrashManagerActivity.class);
context.startActivity(intent);
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class DataExport implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_data_export;
}
@Override
public int getIcon() {
return R.mipmap.dk_data_export;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,50 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.FileExplorer.FileExplorerActivity;
import vip.devkit.debugkit.ui.crash.CrashManagerActivity;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class FileExplorer implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_file;
}
@Override
public int getIcon() {
return R.mipmap.dk_file_explorer;
}
@Override
public void onClick(Context context) {
Intent intent = new Intent(context, FileExplorerActivity.class);
context.startActivity(intent);
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,47 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: PermissionManager.java
* Create Date: 2019/7/1 17:48
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class LogManager implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_log;
}
@Override
public int getIcon() {
return R.mipmap.dk_log_info;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,47 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.content.Intent;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.permission.PermissionManagerActivity;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: PermissionManager.java
* Create Date: 2019/7/1 17:48
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class PermissionManager implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_permission;
}
@Override
public int getIcon() {
return R.mipmap.dk_crash_permission;
}
@Override
public void onClick(Context context) {
Intent intent = new Intent(context, PermissionManagerActivity.class);
context.startActivity(intent);
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,47 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: Simulation.java
* Create Date: 2019/7/1 17:52
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class Simulation implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_simulation;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,47 @@
package vip.devkit.debugkit.kit.debug;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class WebBrowse implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_web;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,15 @@
package vip.devkit.debugkit.kit.developer;
/**
* Package Name: vip.devkit.debugkit.kit.developer
* File Name: Language.java
* Create Date: 2019/7/1 18:04
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class Language {
}

@ -0,0 +1,15 @@
package vip.devkit.debugkit.kit.developer;
/**
* Package Name: vip.devkit.debugkit.kit.developer
* File Name: SystemSetting.java
* Create Date: 2019/7/1 18:00
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class RuningService {
}

@ -0,0 +1,15 @@
package vip.devkit.debugkit.kit.developer;
/**
* Package Name: vip.devkit.debugkit.kit.developer
* File Name: SystemSetting.java
* Create Date: 2019/7/1 18:00
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class SystemSetting {
}

@ -0,0 +1,47 @@
package vip.devkit.debugkit.kit.developer;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.debug
* File Name: AppInfoM.java
* Create Date: 2019/7/1 17:47
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class USBKit implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_debug_info;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,73 @@
package vip.devkit.debugkit.kit.log;
/**
* Package Name: vip.devkit.debugkit.kit.log
* File Name: IPrinter.java
* Create Date: 2019/7/8 15:16
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public interface IPrinter {
/**
* 获取日志配置信息
*
* @return {@link LogConfig} 日志配置
*/
LogConfig getLogConfig();
/**
* 初始化日志配置信息 ( 使用默认配置 )
*
* @return {@link LogConfig} 日志配置
*/
LogConfig init();
/**
* 自定义日志配置信息
*
* @param logConfig 日志配置
*/
void init(LogConfig logConfig);
void d(String log);
void i(Object... log);
void w(String log);
void e(String log);
void e(Throwable throwable);
void a(String log);
void json(String log);
void xml(String log);
void d(String tag, String log);
void i(String tag, Object... log);
void w(String tag, String log);
void e(String tag, String log);
void e(String tag, Throwable throwable);
void a(String tag, String log);
void json(String tag, String log);
void xml(String tag, String log);
}

@ -0,0 +1,113 @@
package vip.devkit.debugkit.kit.log;
import android.text.TextUtils;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Map;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
/**
* Package Name: vip.devkit.debugkit.util
* File Name: LogCat.java
* Create Date: 2019/7/1 11:51
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class LogCat {
private static final IPrinter sPrinter = new LogPrinter();
private LogCat() {
}
/**
* @return {@link LogConfig} config
*/
public static LogConfig getLogConfig() {
return sPrinter.getLogConfig();
}
/**
* default
* @return {@link LogConfig} log config
*/
public static LogConfig init() {
return sPrinter.init();
}
/**
* @param logConfig config
*/
public static void init(final LogConfig logConfig) {
sPrinter.init(logConfig);
}
public static void d(String msg) {
sPrinter.d(msg);
}
public static void i(Object... msg) {
sPrinter.i(msg);
}
public static void w(String msg) {
sPrinter.w(msg);
}
public static void e(String msg) {
sPrinter.e(msg);
}
public static void e(Throwable msg) {
sPrinter.e(msg);
}
public static void a(String msg) {
sPrinter.a(msg);
}
public static void d(String tag, String msg) {
sPrinter.d(tag,msg);
}
public static void i(String tag, String msg) {
sPrinter.i(tag,msg);
}
public static void w(String tag, String msg) {
sPrinter.w(tag,msg);
}
public static void e(String tag, String msg) {
sPrinter.e(tag,msg);
}
public static void e(String tag,Throwable msg) {
sPrinter.e(tag,msg);
}
public static void a(String tag, String msg) {
sPrinter.a(tag,msg);
}
}

@ -0,0 +1,45 @@
package vip.devkit.debugkit.kit.log;
/**
* Package Name: vip.devkit.debugkit.kit.log
* File Name: LogConfig.java
* Create Date: 2019/7/8 15:00
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class LogConfig {
public static final int VERBOSE = 2;
public static final int DEBUG = 3;
public static final int INFO = 4;
public static final int WARN = 5;
public static final int ERROR = 6;
public static final int ASSERT = 7;
public static final int JSON = 8;
public static final int XML = 9;
public static final int JSON_INDENT = 4;
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static String LOG_TAG = "dk_log";
public static LogLevel DEFAULT_LOG_LEVEL = LogLevel.DEBUG;
public static LogLevel logLevel=DEFAULT_LOG_LEVEL;
public static void setLogTag(String logTag) {
LOG_TAG = logTag;
}
public void setLogLevel(LogLevel logLevel) {
this.logLevel = logLevel;
}
}

@ -0,0 +1,39 @@
package vip.devkit.debugkit.kit.log;
/**
* Package Name: vip.devkit.debugkit.kit.log
* File Name: LogLevel.java
* Create Date: 2019/7/8 14:59
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public enum LogLevel {
/**
* 全部不打印
*/
NONE,
/**
* 调试级别 v, d - 全部打印
*/
DEBUG,
/**
* 正常级别 i
*/
INFO,
/**
* 警告级别 w
*/
WARN,
/**
* 异常级别 e, wtf
*/
ERROR
}

@ -0,0 +1,327 @@
package vip.devkit.debugkit.kit.log;
import android.text.TextUtils;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import static vip.devkit.debugkit.kit.log.LogConfig.ASSERT;
import static vip.devkit.debugkit.kit.log.LogConfig.DEBUG;
import static vip.devkit.debugkit.kit.log.LogConfig.ERROR;
import static vip.devkit.debugkit.kit.log.LogConfig.INFO;
import static vip.devkit.debugkit.kit.log.LogConfig.JSON_INDENT;
import static vip.devkit.debugkit.kit.log.LogConfig.LINE_SEPARATOR;
import static vip.devkit.debugkit.kit.log.LogConfig.VERBOSE;
import static vip.devkit.debugkit.kit.log.LogConfig.WARN;
import static vip.devkit.debugkit.kit.log.LogConfig.JSON;
import static vip.devkit.debugkit.kit.log.LogConfig.XML;
import static vip.devkit.debugkit.kit.log.Util.getObjectsString;
import static vip.devkit.debugkit.kit.log.Util.printLine;
/**
* Package Name: vip.devkit.debugkit.kit.log
* File Name: LogLevel.java
* Create Date: 2019/7/8 14:59
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class LogPrinter implements IPrinter {
LogConfig mLogConfig;
@Override
public LogConfig getLogConfig() {
return mLogConfig;
}
@Override
public LogConfig init() {
if (mLogConfig == null) {
mLogConfig = new LogConfig();
}
return mLogConfig;
}
@Override
public void init(LogConfig logConfig) {
mLogConfig = logConfig;
}
@Override
public void d(String log) {
d(mLogConfig.LOG_TAG, log);
}
@Override
public void i(Object... log) {
StringBuilder sb = new StringBuilder();
for (Object obj : log) {
sb.append(obj + ",");
}
log(INFO,mLogConfig.LOG_TAG,String.valueOf(sb));
}
@Override
public void w(String log) {
log(WARN,mLogConfig.LOG_TAG,log);
}
@Override
public void e(String log) {
log(INFO,mLogConfig.LOG_TAG,log);
}
@Override
public void e(Throwable throwable) {
log(ERROR,mLogConfig.LOG_TAG,throwable.toString());
}
@Override
public void a(String log) {
log(ASSERT,mLogConfig.LOG_TAG,log);
}
@Override
public void json(String log) {
log(JSON,mLogConfig.LOG_TAG,log);
}
@Override
public void xml(String log) {
log(XML,mLogConfig.LOG_TAG,log);
}
@Override
public void d(String tag, String log) {
log(DEBUG,tag,log);
}
@Override
public void i(String tag, Object... log) {
StringBuilder sb = new StringBuilder();
for (Object obj : log) {
sb.append(obj + ",");
}
log(INFO,tag,String.valueOf(sb));
}
@Override
public void w(String tag, String log) {
log(WARN,tag,log);
}
@Override
public void e(String tag, String log) {
log(ERROR,tag,log);
}
@Override
public void e(String tag, Throwable throwable) {
log(ERROR,tag,throwable.toString());
}
@Override
public void a(String tag, String log) {
log(ASSERT,tag,log);
}
@Override
public void json(String tag, String log) {
log(JSON,tag,log);
}
@Override
public void xml(String tag, String log) {
log(XML,tag,log);
}
private void log(int logType, String tagStr, Object objects) {
String[] contents = wrapperContent(tagStr, objects);
String tag = contents[0];
String msg = contents[1];
String headString = contents[2];
if (mLogConfig.logLevel != LogLevel.NONE) {
switch (logType) {
case VERBOSE:
case DEBUG:
case INFO:
case WARN:
case ERROR:
case ASSERT:
printDefault(logType, tag, headString + msg);
break;
case JSON:
printJson(tag, msg, headString);
break;
case XML:
printXml(tag, msg, headString);
break;
default:
break;
}
}
}
public String[] wrapperContent(String tag, Object... objects) {
if (TextUtils.isEmpty(tag)) {
tag = LogConfig.LOG_TAG;
}
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
StackTraceElement targetElement = stackTrace[6];
if (TextUtils.isEmpty(tag)) {
targetElement = stackTrace[6];
}
String className = targetElement.getClassName();
String[] classNameInfo = className.split("\\.");
if (classNameInfo.length > 0) {
className = classNameInfo[classNameInfo.length-1] + ".java";
}
String methodName = targetElement.getMethodName();
int lineNumber = targetElement.getLineNumber();
if (lineNumber < 0) {
lineNumber = 0;
}
String methodNameShort = methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
String msg = (objects == null) ? "Log with null object" : getObjectsString(objects);
String headString = "[(" + className + ":" + lineNumber + ")#" + methodNameShort + " ] ";
return new String[]{tag, msg, headString};
}
private void printDefault(int type, String tag, String msg) {
if (!Util.isPrintLog(mLogConfig, type)) {
return;
}
if (TextUtils.isEmpty(tag)) {
tag = mLogConfig.LOG_TAG;
}
int index = 0;
int maxLength = 4000;
int countOfSub = msg.length() / maxLength;
if (countOfSub > 0) { // The log is so long
for (int i = 0; i < countOfSub; i++) {
String sub = msg.substring(index, index + maxLength);
printSub(type, tag, sub);
index += maxLength;
}
//printSub(type, msg.substring(index, msg.length()));
} else {
printSub(type, tag, msg);
}
}
private void printSub(int type, String tag, String sub) {
if (tag == null) {
tag = mLogConfig.LOG_TAG;
}
switch (type) {
case VERBOSE:
Log.v(tag, sub);
break;
case DEBUG:
Log.d(tag, sub);
break;
case INFO:
Log.i(tag, sub);
break;
case WARN:
Log.w(tag, sub);
break;
case ERROR:
Log.e(tag, sub);
break;
case ASSERT:
Log.wtf(tag, sub);
break;
}
}
private void printJson(String tag, String json, String headString) {
if (TextUtils.isEmpty(json)) {
d("Empty/Null json content");
return;
}
if (TextUtils.isEmpty(tag)) {
tag = mLogConfig.LOG_TAG;
}
String message;
try {
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
message = jsonObject.toString(JSON_INDENT);
} else if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
message = jsonArray.toString(JSON_INDENT);
} else {
message = json;
}
} catch (JSONException e) {
message = json;
}
printLine(tag, true);
message = headString + LINE_SEPARATOR + message;
String[] lines = message.split(LINE_SEPARATOR);
for (String line : lines) {
Log.d(tag, "|" + line);
}
printLine(tag, false);
}
private void printXml(String tag, String xml, String headString) {
if (TextUtils.isEmpty(tag)) {
tag = mLogConfig.LOG_TAG;
}
if (xml != null) {
try {
Source xmlInput = new StreamSource(new StringReader(xml));
StreamResult xmlOutput = new StreamResult(new StringWriter());
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.transform(xmlInput, xmlOutput);
xml = xmlOutput.getWriter().toString().replaceFirst(">", ">\n");
} catch (Exception e) {
e.printStackTrace();
}
xml = headString + "\n" + xml;
} else {
xml = headString + "Log with null object";
}
printLine(tag, true);
String[] lines = xml.split(LINE_SEPARATOR);
for (String line : lines) {
if (!TextUtils.isEmpty(line)) {
Log.d(tag, "|" + line);
}
}
printLine(tag, false);
}
}

@ -0,0 +1,104 @@
package vip.devkit.debugkit.kit.log;
import android.text.TextUtils;
import android.util.Log;
/**
* Package Name: vip.devkit.debugkit.kit.log
* File Name: Util.java
* Create Date: 2019/7/8 15:38
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class Util {
public static String getObjectsString(Object... objects) {
if (objects.length > 1) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("\n");
for (int i = 0; i < objects.length; i++) {
Object object = objects[i];
if (object == null) {
stringBuilder.append("param").append("[").append(i).append("]").append(" = ").append("null").append("\n");
} else {
stringBuilder.append("param").append("[").append(i).append("]").append(" = ").append(object.toString()).append("\n");
}
}
return stringBuilder.toString();
} else {
Object object = objects[0];
return object == null ? "null" : object.toString();
}
}
public static void printLine(String tag, boolean isTop) {
if (isTop) {
Log.d(tag, "╔═══════════════════════════════════════════════════════════════════════════════════════");
} else {
Log.d(tag, "╚═══════════════════════════════════════════════════════════════════════════════════════");
}
}
/**
* 是否打印日志
* @param logConfig 日志配置
* @param logType 日志类型
* @return {@code true} yes, {@code false} no
*/
public static boolean isPrintLog(final LogConfig logConfig, final int logType) {
boolean isPrint = false;
LogLevel logLevel = logConfig.logLevel;
switch (logLevel) {
case NONE: //
break;
case DEBUG: // v, d - all
isPrint = true;
break;
case INFO: // i
case WARN: // w
case ERROR: // e, wtf
isPrint = checkLogLevel(logLevel, logType);
break;
default:
break;
}
return isPrint;
}
/**
* 判断日志级别是否允许输出
* @param logLevel 日志级别
* @param logType 日志类型
* @return {@code true} yes, {@code false} no
*/
private static boolean checkLogLevel(final LogLevel logLevel, final int logType) {
switch (logLevel) {
case INFO: // i
if (logType != Log.VERBOSE && logType != Log.DEBUG) {
return true;
}
break;
case WARN: // w
if (logType != Log.VERBOSE && logType != Log.DEBUG && logType != Log.INFO) {
return true;
}
break;
case ERROR: // e, wtf
if (logType == Log.ERROR || logType == Log.ASSERT) {
return true;
}
break;
default:
break;
}
return false;
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.performance;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.performance
* File Name: Battery.java
* Create Date: 2019/7/1 18:05
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class Battery implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_performance_battery;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.performance;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.performance
* File Name: FTPS.java
* Create Date: 2019/7/1 18:04
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CPU implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_performance_cpu;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.performance;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.performance
* File Name: FTPS.java
* Create Date: 2019/7/1 18:04
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class FTPS implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_performance_fps;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.performance;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.performance
* File Name: RAM.java
* Create Date: 2019/7/2 9:14
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class RAM implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_performance_ram;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.performance;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.performance
* File Name: Time.java
* Create Date: 2019/7/2 9:15
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class Time implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_performance_open_time;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.performance;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.performance
* File Name: Traffic.java
* Create Date: 2019/7/2 9:14
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class Traffic implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_performance_traffic;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.system;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.system
* File Name: HardwareKit.java
* Create Date: 2019/7/1 15:44
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class CpuKit implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_sys_cpu;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,47 @@
package vip.devkit.debugkit.kit.system;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.system
* File Name: HardwareKit.java
* Create Date: 2019/7/1 15:44
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class HardwareKit implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_sys_hardware;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,50 @@
package vip.devkit.debugkit.kit.system;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.sysinfo.SysInfoKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.system
* File Name: HardwareKit.java
* Create Date: 2019/7/1 15:44
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class NetworkKit implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_sys_network;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
SysInfoKit sysInfoKit =new SysInfoKit();
Log.i("build netInfo:",0+sysInfoKit.getNetInfo(context).toString());
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,50 @@
package vip.devkit.debugkit.kit.system;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.sysinfo.SysInfoKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.system
* File Name: HardwareKit.java
* Create Date: 2019/7/1 15:44
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class ScreenKit implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_sys_screen;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
SysInfoKit sysInfoKit =new SysInfoKit();
Log.i("build getScreen:",0+sysInfoKit.getScreen(context).toString());
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,53 @@
package vip.devkit.debugkit.kit.system;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.ui.sysinfo.SysInfoKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit
* File Name: SysInfo.java
* Create Date: 2019/7/1 15:30
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class SysInfo implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_sys_system;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
SysInfoKit sysInfoKit =new SysInfoKit();
Log.i("build SysInfo:",0+sysInfoKit.getInfo().toString());
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.ue;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.ue
* File Name: ColorPicker.java
* Create Date: 2019/7/2 9:09
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class ColorPicker implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_ue_color_picker;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,46 @@
package vip.devkit.debugkit.kit.ue;
import android.content.Context;
import android.widget.Toast;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.IKit;
import vip.devkit.debugkit.util.ResUtil;
/**
* Package Name: vip.devkit.debugkit.kit.ue
* File Name: ColorPicker.java
* Create Date: 2019/7/2 9:09
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class UE implements IKit {
@Override
public int getCategory() {
return 0;
}
@Override
public int getName() {
return R.string.dk_ue_ue;
}
@Override
public int getIcon() {
return android.R.mipmap.sym_def_app_icon;
}
@Override
public void onClick(Context context) {
Toast.makeText(context, ResUtil.getString(context,getName()), Toast.LENGTH_SHORT).show();
}
@Override
public void onAppInit(Context context) {
}
}

@ -0,0 +1,36 @@
package vip.devkit.debugkit.ui;
import vip.devkit.debugkit.ui.base.BaseActivity;
/**
* Package Name: vip.devkit.debugkit.ui
* File Name: AppDataCleanActivity.java
* Create Date: 2019/7/9 11:41
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class AppDataCleanActivity extends BaseActivity {
@Override
protected void initData() {
}
@Override
protected int setLayoutId() {
return 0;
}
@Override
protected void initView() {
}
@Override
protected void setListener() {
}
}

@ -0,0 +1,250 @@
package vip.devkit.debugkit.ui.FileExplorer;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.adapter.FileFolderAdapter;
import vip.devkit.debugkit.adapter.FileInfoAdapter;
import vip.devkit.debugkit.bean.FileInfoBean;
import vip.devkit.debugkit.kit.log.LogCat;
import vip.devkit.debugkit.ui.base.BaseActivity;
import vip.devkit.debugkit.widget.recyclerview.BaseRecyclerAdapter;
/**
* Package Name: vip.devkit.debugkit.ui.FileExplorer
* File Name: FileExplorerActivity.java
* Create Date: 2019/7/9 14:17
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class FileExplorerActivity extends BaseActivity implements View.OnClickListener, FileInfoAdapter.OnItemClickListener {
private LinearLayout mLlTitleBack;
private TextView mTvTitle;
private TextView mTvTitleRight;
private LinearLayout mLlTitleRight;
private LinearLayout mLlCommonLayout;
private RecyclerView mRlList;
private RecyclerView mRlFileFolder;
private LinearLayout mLlFolder;
private File mCurDir;
private FileInfoAdapter mAdapter;
private List<FileInfoBean> mBeanList = new ArrayList<>();
private FileFolderAdapter mFolderAdapter;
private List<FileInfoBean> mFolderList = new ArrayList<>();
@Override
protected void initData() {
}
@Override
protected int setLayoutId() {
return R.layout.dk_activity_file_explorer;
}
@Override
protected void initView() {
mLlTitleBack = (LinearLayout) findViewById(R.id.ll_title_back);
mLlTitleBack.setOnClickListener(this);
mTvTitle = (TextView) findViewById(R.id.tv_title);
mTvTitleRight = (TextView) findViewById(R.id.tv_title_right);
mLlTitleRight = (LinearLayout) findViewById(R.id.ll_title_right);
mLlCommonLayout = (LinearLayout) findViewById(R.id.ll_common_layout);
mRlList = (RecyclerView) findViewById(R.id.rl_list);
mRlFileFolder = (RecyclerView) findViewById(R.id.rl_file_folder);
mLlFolder = (LinearLayout) findViewById(R.id.ll_folder);
mTvTitle.setOnClickListener(this);
mTvTitleRight.setOnClickListener(this);
mLlFolder.setOnClickListener(this);
mFolderAdapter = new FileFolderAdapter(R.layout.dk_item_file_folder, mFolderList);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(RecyclerView.HORIZONTAL);
mRlFileFolder.setLayoutManager(layoutManager);
mRlFileFolder.setAdapter(mFolderAdapter);
mBeanList.addAll(initRootFileInfos(this));
mAdapter = new FileInfoAdapter(R.layout.dk_item_file, mBeanList);
mAdapter.setOnItemClickListener(this);
mRlList.setLayoutManager(new LinearLayoutManager(this));
mRlList.setAdapter(mAdapter);
}
@Override
protected void setListener() {
mFolderAdapter.setOnItemClickListener(new BaseRecyclerAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseRecyclerAdapter adapter, View view, int position) {
FileInfoBean fileInfoBean = mFolderAdapter.getItem(position);
if (fileInfoBean.file == mCurDir) {
LogCat.i("当前文件夹");
return;
}
setAdapterData(getFileInfos(fileInfoBean.file));
for (int i = 0; i < mFolderList.size(); i++) {
LogCat.i("当前文件夹" + i);
if (i > position) {
mFolderList.remove(i);
}
}
mFolderAdapter.notifyDataSetChanged();
}
});
}
@Override
public void onItemClick(BaseRecyclerAdapter adapter, View view, int position) {
FileInfoBean fileInfoBean = mAdapter.getItem(position);
if (fileInfoBean.file.isFile()) {
openFile(this,fileInfoBean.file);
} else {
mCurDir = fileInfoBean.file;
setAdapterData(getFileInfos(fileInfoBean.file));
mFolderList.add(fileInfoBean);
mFolderAdapter.notifyDataSetChanged();
}
}
private void setAdapterData(List<FileInfoBean> fileInfos) {
mBeanList.clear();
if (!fileInfos.isEmpty()) {
mBeanList.addAll(fileInfos);
}
mAdapter.notifyDataSetChanged();
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.ll_title_back) {
finish();
} else if (v.getId() == R.id.ll_folder) {
mFolderList.clear();
mFolderAdapter.notifyDataSetChanged();
mBeanList.clear();
mBeanList.addAll(initRootFileInfos(this));
mAdapter.notifyDataSetChanged();
}
}
/**
* 调用系统应用打开图片
*
* @param context context
* @param file file
*/
public static void openFile(Context context, File file) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
Uri uri = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// 方式一
uri = getImageContentUri(context, file);
// 方式二
// uri = FileProvider.getUriForFile(context, ".fileProvider", file);
// intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
} else {
uri = Uri.fromFile(file);
}
String type = null;
intent.setDataAndType(uri, type);
try {
context.startActivity(intent);
} catch (Exception e) {
LogCat.e("FileUtil"+ e.getMessage());
Toast.makeText(context, "找不到打开此文件的应用!", Toast.LENGTH_SHORT).show();
}
}
/**
* 转换 content:// uri
*
* @param imageFile imageFile
* @return
*/
public static Uri getImageContentUri(Context context, File imageFile) {
String filePath = imageFile.getAbsolutePath();
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[] { MediaStore.Images.Media._ID },
MediaStore.Images.Media.DATA + "=? ",
new String[] { filePath }, null);
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor
.getColumnIndex(MediaStore.MediaColumns._ID));
Uri baseUri = Uri.parse("content://media/external/images/media");
return Uri.withAppendedPath(baseUri, "" + id);
} else {
if (imageFile.exists()) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, filePath);
return context.getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} else {
return null;
}
}
}
private List<FileInfoBean> getFileInfos(File dir) {
List<FileInfoBean> fileInfos = new ArrayList<>();
if (dir.listFiles() == null) {
return fileInfos;
}
for (File file : dir.listFiles()) {
FileInfoBean fileInfo = new FileInfoBean(file);
fileInfos.add(fileInfo);
}
return fileInfos;
}
private List<FileInfoBean> initRootFileInfos(Context context) {
List<FileInfoBean> fileInfos = new ArrayList<>();
fileInfos.add(new FileInfoBean(context.getFilesDir().getParentFile()));
fileInfos.add(new FileInfoBean(context.getExternalCacheDir()));
fileInfos.add(new FileInfoBean(context.getExternalFilesDir(null)));
return fileInfos;
}
private boolean isRootFile(Context context, File file) {
if (file == null) {
return false;
}
return file.equals(context.getExternalCacheDir())
|| file.equals(context.getExternalFilesDir(null))
|| file.equals(context.getFilesDir().getParentFile());
}
}

@ -0,0 +1,95 @@
package vip.devkit.debugkit.ui;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.PackageStats;
import android.os.RemoteException;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import vip.devkit.debugkit.DataSource;
import vip.devkit.debugkit.KitManagerAdapter;
import vip.devkit.debugkit.R;
import vip.devkit.debugkit.kit.GroupKitItem;
import vip.devkit.debugkit.kit.KitItem;
import vip.devkit.debugkit.kit.log.LogCat;
import vip.devkit.debugkit.ui.base.BaseActivity;
import vip.devkit.debugkit.ui.base_url.BaseUrlManager;
/**
* Package Name: vip.devkit.debugkit.ui
* File Name: KitManagerActivity.java
* Create Date: 2019/7/1 10:43
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public class KitManagerActivity extends BaseActivity {
private RecyclerView mRvList;
private KitManagerAdapter mManagerAdapter;
List<GroupKitItem> mItemList = new ArrayList<>();
List<KitItem> mKitItems = new ArrayList<>();
private BaseUrlManager mBaseUrlManager;
@Override
protected void initData() {
}
@Override
protected int setLayoutId() {
return R.layout.act_kit_manager;
}
@Override
protected void initView() {
mRvList = (RecyclerView) findViewById(R.id.rv_list);
mRvList.setLayoutManager(new LinearLayoutManager(this));
mManagerAdapter = new KitManagerAdapter(R.layout.dk_item_group_kit, mItemList);
mRvList.setAdapter(mManagerAdapter);
DataSource dataSource = new DataSource(this);
mItemList.addAll(dataSource.getKitList());
mManagerAdapter.notifyDataSetChanged();
mBaseUrlManager = new BaseUrlManager(this);
LogCat.i("mBaseUrlManager:"+mBaseUrlManager.getBaseUrl());
}
@Override
protected void onResume() {
super.onResume();
mBaseUrlManager.refreshData();
LogCat.i("mBaseUrlManager:"+mBaseUrlManager.getBaseUrl());
}
@Override
protected void setListener() {
}
//aidl文件形成的Bindler机制服务类
public class PkgSizeObserver extends IPackageStatsObserver.Stub{
/*** 回调函数
* @param pStats ,返回数据封装在PackageStats对象中
* @param succeeded 代表回调成功
*/
@Override
public void onGetStatsCompleted(PackageStats pStats, boolean succeeded)
throws RemoteException {
// TODO Auto-generated method stub
}
}
}

@ -0,0 +1,222 @@
package vip.devkit.debugkit.ui.base;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
/**
* Package Name: vip.devkit.debugkit.ui.base
* File Name: BaseActivity.java
* Create Date: 2019/7/1 10:44
* Author : K
* E-mail : vip@devkit.vip
* VersionCode : V 1.0
* Describe
* Code Update :author - time
* Update Describe
*/
public abstract class BaseActivity extends AppCompatActivity {
private long lastBackKeyDownTick = 0;
public static final long MAX_DOUBLE_BACK_DURATION = 1500;
protected Context mContext;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);//隐藏应用的标题栏
setContentView(setLayoutId());
mContext = this;
initBase();
initData();
initView();
setListener();
}
protected boolean isOrientation() {
return true;
}
private void initBase() {
}
protected abstract void initData();
protected abstract int setLayoutId();
protected abstract void initView();
protected abstract void setListener();
/**
* @return RootView FrameLayout
*/
protected FrameLayout getRootView() {
View re = this.findViewById(android.R.id.content);
if (re != null && re instanceof FrameLayout) {
return (FrameLayout) re;
}
ViewGroup viewGroup = (ViewGroup) this.getWindow().getDecorView();
re = viewGroup.getChildAt(viewGroup.getChildCount() - 1);
if (re != null && re instanceof FrameLayout) {
return (FrameLayout) re;
} else {
re = new FrameLayout(this);
this.getActionBar().getHeight();
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT
, ViewGroup.LayoutParams.MATCH_PARENT);
viewGroup.addView(re, lp);
return (FrameLayout) re;
}
}
protected <T extends View> T getView(int id) {
return (T) super.findViewById(id);
}
/**
* startActivity
*
* @param clazz
*/
protected void startActivity(Class<?> clazz) {
Intent intent = new Intent(this, clazz);
startActivity(intent);
}
/**
* startActivity putExtrasBundle
*
* @param clazz
* @param extras
*/
protected void startActivity(Class<?> clazz, Bundle extras) {
Intent intent = new Intent(this, clazz);
intent.putExtras(extras);
startActivity(intent);
}
/**
* startActivity putExtrasBundle
*
* @param clazz
* @param requestCode
* @param extras
*/
protected void startActivity(Class<?> clazz, int requestCode, Bundle extras) {
Intent intent = new Intent(this, clazz);
intent.putExtras(extras);
startActivityForResult(intent, requestCode);
}
/**
* startActivity putExtrasBundle
*
* @param clazz
* @param code
*/
protected void startActivity(Class<?> clazz, int code) {
Intent intent = new Intent(this, clazz);
startActivityForResult(intent, code);
}
/**
* 重启当前Activity
*/
private void reStartActivity() {
Intent intent = getIntent();
finish();
startActivity(intent);
}
/**
* 初始化是否全屏
*/
protected void initFlagFullscreen() {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏
}
/**
* @return 设置android app 的字体大小不受系统字体大小改变的影响
*/
@Override
public Resources getResources() {
Resources res = super.getResources();
Configuration config = new Configuration();
config.setToDefaults();
res.updateConfiguration(config, res.getDisplayMetrics());
return res;
}
@Override
public void onBackPressed() {
super.onBackPressed();
long currentTick = System.currentTimeMillis();
if (currentTick - lastBackKeyDownTick > MAX_DOUBLE_BACK_DURATION) {
lastBackKeyDownTick = currentTick;
} else {
finish();
System.exit(0);
}
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
public void finish() {
hideSoftInput();
super.finish();
}
private void hideSoftInput() {
View view = getCurrentFocus();
if (view == null) view = new View(this);
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save