From 3cccff03d4adddf5edcd437c045ea081002e9788 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 31 Oct 2020 19:44:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9C=AC=E5=9C=B0=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/local/ImportBookActivity.kt | 28 ++++++++++++------- .../main/res/layout/activity_import_book.xml | 11 ++++++++ app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index 5bb609f4a..b706712a7 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -122,12 +122,14 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity val lastPath = AppConfig.importBookPath when { lastPath.isNullOrEmpty() -> { + tv_empty_msg.visible() FilePicker.selectFolder(this, requestCodeSelectFolder) } lastPath.isContentPath() -> { val rootUri = Uri.parse(lastPath) rootDoc = DocumentFile.fromTreeUri(this, rootUri) if (rootDoc == null) { + tv_empty_msg.visible() FilePicker.selectFolder(this, requestCodeSelectFolder) } else { subDocs.clear() @@ -135,18 +137,22 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity } } Build.VERSION.SDK_INT > Build.VERSION_CODES.Q -> { + tv_empty_msg.visible() FilePicker.selectFolder(this, requestCodeSelectFolder) } - else -> PermissionsCompat.Builder(this) - .addPermissions(*Permissions.Group.STORAGE) - .rationale(R.string.tip_perm_request_storage) - .onGranted { - rootDoc = null - subDocs.clear() - path = lastPath - upPath() - } - .request() + else -> { + tv_empty_msg.visible() + PermissionsCompat.Builder(this) + .addPermissions(*Permissions.Group.STORAGE) + .rationale(R.string.tip_perm_request_storage) + .onGranted { + rootDoc = null + subDocs.clear() + path = lastPath + upPath() + } + .request() + } } } @@ -154,6 +160,7 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity @Synchronized private fun upPath() { rootDoc?.let { rootDoc -> + tv_empty_msg.gone() var path = rootDoc.name.toString() + File.separator var lastDoc = rootDoc for (doc in subDocs) { @@ -183,6 +190,7 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity } } ?: let { if (path.isBlank()) return + tv_empty_msg.gone() tv_path.text = path.replace(sdPath, "SD") val docList = arrayListOf() File(path).listFiles()?.forEach { diff --git a/app/src/main/res/layout/activity_import_book.xml b/app/src/main/res/layout/activity_import_book.xml index 73b289294..38f12f595 100644 --- a/app/src/main/res/layout/activity_import_book.xml +++ b/app/src/main/res/layout/activity_import_book.xml @@ -65,6 +65,17 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> + + 超过一天的搜索数据 重新分段 样式名称: + 点击右上角文件夹图标,选择文件夹 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8ac325c9b..985e7a4df 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -776,5 +776,6 @@ 超过一天的搜索数据 重新分段 样式名称: + 点击右上角文件夹图标,选择文件夹 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 4a9e4b4f4..f09556f04 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -779,5 +779,6 @@ 超过一天的搜索数据 重新分段 样式名称: + 点击右上角文件夹图标,选择文件夹 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3b9347a7a..95856897c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -782,5 +782,6 @@ 超过一天的搜索数据 重新分段 样式名称: + 点击右上角文件夹图标,选择文件夹