From e460cf1718d3d89076962ef0cb8e63dfd7d82e84 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 31 Jan 2020 12:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/importbook/ImportBookActivity.kt | 22 +++++++++++++++++++ .../app/ui/importbook/ImportBookAdapter.kt | 1 + 2 files changed, 23 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt index 297715822..5d3fb2810 100644 --- a/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt @@ -161,4 +161,26 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity super.onBackPressed() } } + + override fun upCountView() { + if (importBookAdapter.selectedUris.isEmpty()) { + btn_add_book.setText(R.string.nb_file_add_shelf) + //设置某些按钮的是否可点击 + setMenuClickable(false) + } else { + btn_add_book.text = + getString(R.string.nb_file_add_shelves, importBookAdapter.selectedUris.size) + //设置某些按钮的是否可点击 + setMenuClickable(true) + } + } + + private fun setMenuClickable(isClickable: Boolean) { + //设置是否可删除 + btn_delete.isEnabled = isClickable + btn_delete.isClickable = isClickable + //设置是否可添加书籍 + btn_add_book.isEnabled = isClickable + btn_add_book.isClickable = isClickable + } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/importbook/ImportBookAdapter.kt b/app/src/main/java/io/legado/app/ui/importbook/ImportBookAdapter.kt index 5c80057d4..02645acc3 100644 --- a/app/src/main/java/io/legado/app/ui/importbook/ImportBookAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/importbook/ImportBookAdapter.kt @@ -68,6 +68,7 @@ class ImportBookAdapter(context: Context, val callBack: CallBack) : interface CallBack { fun findFolder(dirName: String) + fun upCountView() } } \ No newline at end of file