File tree Expand file tree Collapse file tree 5 files changed +25
-17
lines changed
java/com/wrbug/developerhelper/ui Expand file tree Collapse file tree 5 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ android {
1717 applicationId " com.wrbug.developerhelper"
1818 minSdkVersion 21
1919 targetSdkVersion 28
20- versionCode 100000
21- versionName " 1.0.0 .0"
20+ versionCode 100010
21+ versionName " 1.0.1 .0"
2222 testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
2323 }
2424 buildTypes {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.wrbug.developerhelper.ui.activity.databaseedit
33import android.content.Context
44import android.content.Intent
55import android.os.Bundle
6+ import android.os.Environment
67import android.view.View
78import android.view.ViewGroup
89import android.widget.LinearLayout
@@ -32,7 +33,11 @@ class DatabaseEditActivity : BaseActivity() {
3233 private val adapter = DatabaseTableAdapter (this )
3334 private var selectedIndex = 0
3435 private val dstDir: File by lazy {
35- File (cacheDir, " db" )
36+ val file = File (externalCacheDir, " db" )
37+ if (file.exists()) {
38+ file.mkdir()
39+ }
40+ file
3641 }
3742
3843 companion object {
@@ -102,6 +107,7 @@ class DatabaseEditActivity : BaseActivity() {
102107 }
103108 val file = File (dstDir, dbPath.name)
104109 dbMap = DatabaseUtils .getDatabase(file.absolutePath)
110+ file.delete()
105111 tableNames.addAll(dbMap.keys)
106112 uiThread {
107113 setTableContainer()
@@ -110,12 +116,6 @@ class DatabaseEditActivity : BaseActivity() {
110116 }
111117 }
112118
113- override fun onDestroy () {
114- doAsync {
115- ShellManager .rmFile(dstDir.absolutePath)
116- }
117- super .onDestroy()
118- }
119119
120120 private fun setTableContainer () {
121121 tableNameContainer.removeAllViews()
Original file line number Diff line number Diff line change @@ -54,9 +54,11 @@ class AppDataInfoView : FrameLayout {
5454 doAsync {
5555 val sqliteFiles = ShellManager .getSqliteFiles(packageName)
5656 uiThread {
57- if (sqliteFiles.isNotEmpty()) {
58- databaseContainer.removeAllViews()
57+ if (sqliteFiles.isEmpty()) {
58+ defaultDbTv.setText(R .string.none)
59+ return @uiThread
5960 }
61+ databaseContainer.removeAllViews()
6062 val params = LinearLayout .LayoutParams (LayoutParams .MATCH_PARENT , LayoutParams .WRAP_CONTENT )
6163 for (sqliteFile in sqliteFiles) {
6264 val textView = AppCompatTextView (context)
@@ -78,10 +80,11 @@ class AppDataInfoView : FrameLayout {
7880 private fun getSharedPreferencesFiles (packageName : String ) {
7981 doAsync {
8082 val files = AppInfoManager .getSharedPreferencesFiles(packageName)
81- if (files.isEmpty()) {
82- return @doAsync
83- }
8483 uiThread {
84+ if (files.isEmpty()) {
85+ defaultSpTv.setText(R .string.none)
86+ return @uiThread
87+ }
8588 sharedPreferenceContainer.removeAllViews()
8689 val params = LinearLayout .LayoutParams (LayoutParams .MATCH_PARENT , LayoutParams .WRAP_CONTENT )
8790 files.forEach {
Original file line number Diff line number Diff line change 7878 android : paddingBottom =" 8dp" >
7979
8080 <androidx .appcompat.widget.AppCompatTextView
81+ android : id =" @+id/defaultSpTv"
8182 android : layout_width =" match_parent"
8283 android : layout_height =" wrap_content"
8384 android : paddingTop =" 8dp"
84- android : text =" 无 "
85+ android : text =" @string/getting "
8586 android : textColor =" @color/item_content_text"
8687 android : textSize =" 14sp" />
8788 </LinearLayout >
8889
8990 <androidx .appcompat.widget.AppCompatTextView
9091 android : layout_width =" match_parent"
9192 android : layout_height =" wrap_content"
92- android : text =" 数据库列表 "
93+ android : text =" @string/database_list "
9394 android : textColor =" @color/item_title_text"
9495 android : textSize =" 16sp" />
9596
101102 android : paddingBottom =" 8dp" >
102103
103104 <androidx .appcompat.widget.AppCompatTextView
105+ android : id =" @+id/defaultDbTv"
104106 android : layout_width =" match_parent"
105107 android : layout_height =" wrap_content"
106108 android : paddingTop =" 8dp"
107- android : text =" 无 "
109+ android : text =" @string/getting "
108110 android : textColor =" @color/item_content_text"
109111 android : textSize =" 14sp" />
110112 </LinearLayout >
Original file line number Diff line number Diff line change 5353 <string name =" table" >表</string >
5454 <string name =" table_data_is_empty" >该表数据为空</string >
5555 <string name =" get_database_failed" >获取数据库信息失败</string >
56+ <string name =" getting" >获取中...</string >
57+ <string name =" database_list" >数据库列表</string >
58+ <string name =" none" >无</string >
5659</resources >
You can’t perform that action at this time.
0 commit comments