pull/1434/head
gedoor 3 years ago
parent 2c6f3a9950
commit 29d31190dc
  1. 2
      app/src/main/java/io/legado/app/ui/book/arrange/ArrangeBookActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt
  3. 11
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleActivity.kt
  4. 4
      app/src/main/java/io/legado/app/ui/book/local/rule/TxtTocRuleViewModel.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  7. 5
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  8. 10
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceViewModel.kt
  9. 4
      app/src/main/java/io/legado/app/ui/widget/SelectActionBar.kt

@ -84,7 +84,7 @@ class ArrangeBookActivity : VMBaseActivity<ActivityArrangeBookBinding, ArrangeBo
adapter.revertSelection()
}
override fun onClickMainAction() {
override fun onClickSelectBarMainAction() {
selectGroup(groupRequestCode, 0)
}

@ -98,7 +98,7 @@ class ImportBookActivity : VMBaseActivity<ActivityImportBookBinding, ImportBookV
}
@SuppressLint("NotifyDataSetChanged")
override fun onClickMainAction() {
override fun onClickSelectBarMainAction() {
viewModel.addToBookshelf(adapter.selectedUris) {
adapter.notifyDataSetChanged()
}

@ -111,6 +111,10 @@ class TxtTocRuleActivity : VMBaseActivity<ActivityTxtTocRuleBinding, TxtTocRuleV
}
}
override fun onClickSelectBarMainAction() {
delSourceDialog()
}
override fun revertSelection() {
adapter.revertSelection()
}
@ -144,6 +148,13 @@ class TxtTocRuleActivity : VMBaseActivity<ActivityTxtTocRuleBinding, TxtTocRuleV
.upCountView(adapter.selection.size, adapter.itemCount)
}
private fun delSourceDialog() {
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
okButton { viewModel.del(*adapter.selection.toTypedArray()) }
noButton()
}
}
@SuppressLint("InflateParams")
private fun showImportDialog() {
val aCache = ACache.get(this, cacheDir = false)

@ -19,9 +19,9 @@ class TxtTocRuleViewModel(app: Application) : BaseViewModel(app) {
}
}
fun del(txtTocRule: TxtTocRule) {
fun del(vararg txtTocRule: TxtTocRule) {
execute {
appDb.txtTocRuleDao.delete(txtTocRule)
appDb.txtTocRuleDao.delete(*txtTocRule)
}
}

@ -306,7 +306,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
adapter.revertSelection()
}
override fun onClickMainAction() {
override fun onClickSelectBarMainAction() {
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
okButton { viewModel.delSelection(adapter.selection) }
noButton()

@ -158,7 +158,7 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
adapter.revertSelection()
}
override fun onClickMainAction() {
override fun onClickSelectBarMainAction() {
delSourceDialog()
}

@ -130,7 +130,6 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
when (item?.itemId) {
R.id.menu_enable_selection -> viewModel.enableSelection(adapter.selection)
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.selection)
R.id.menu_del_selection -> viewModel.delSelection(adapter.selection)
R.id.menu_top_sel -> viewModel.topSource(*adapter.selection.toTypedArray())
R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.selection.toTypedArray())
R.id.menu_export_selection -> viewModel.saveToFile(adapter.selection) { file ->
@ -211,13 +210,13 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
adapter.revertSelection()
}
override fun onClickMainAction() {
override fun onClickSelectBarMainAction() {
delSourceDialog()
}
private fun delSourceDialog() {
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) {
okButton { viewModel.delSelection(adapter.selection) }
okButton { viewModel.del(*adapter.selection.toTypedArray()) }
noButton()
}
}

@ -31,8 +31,8 @@ class RssSourceViewModel(application: Application) : BaseViewModel(application)
}
}
fun del(rssSource: RssSource) {
execute { appDb.rssSourceDao.delete(rssSource) }
fun del(vararg rssSource: RssSource) {
execute { appDb.rssSourceDao.delete(*rssSource) }
}
fun update(vararg rssSource: RssSource) {
@ -69,12 +69,6 @@ class RssSourceViewModel(application: Application) : BaseViewModel(application)
}
}
fun delSelection(sources: List<RssSource>) {
execute {
appDb.rssSourceDao.delete(*sources.toTypedArray())
}
}
fun saveToFile(sources: List<RssSource>, success: (file: File) -> Unit) {
execute {
val path = "${context.filesDir}/shareRssSource.json"

@ -42,7 +42,7 @@ class SelectActionBar @JvmOverloads constructor(
}
}
binding.btnRevertSelection.setOnClickListener { callBack?.revertSelection() }
binding.btnSelectActionMain.setOnClickListener { callBack?.onClickMainAction() }
binding.btnSelectActionMain.setOnClickListener { callBack?.onClickSelectBarMainAction() }
binding.ivMenuMore.setOnClickListener { selMenu?.show() }
}
@ -108,6 +108,6 @@ class SelectActionBar @JvmOverloads constructor(
fun revertSelection()
fun onClickMainAction() {}
fun onClickSelectBarMainAction() {}
}
}
Loading…
Cancel
Save