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