|
|
@ -84,11 +84,11 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
uri ?: return@registerForActivityResult |
|
|
|
uri ?: return@registerForActivityResult |
|
|
|
if (uri.isContentScheme()) { |
|
|
|
if (uri.isContentScheme()) { |
|
|
|
DocumentFile.fromTreeUri(this, uri)?.let { |
|
|
|
DocumentFile.fromTreeUri(this, uri)?.let { |
|
|
|
viewModel.exportSelection(adapter.getSelection(), it) |
|
|
|
viewModel.exportSelection(adapter.selection, it) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
uri.path?.let { |
|
|
|
uri.path?.let { |
|
|
|
viewModel.exportSelection(adapter.getSelection(), File(it)) |
|
|
|
viewModel.exportSelection(adapter.selection, File(it)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -122,7 +122,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
when (item.itemId) { |
|
|
|
when (item.itemId) { |
|
|
|
R.id.menu_add_book_source -> startActivity<BookSourceEditActivity>() |
|
|
|
R.id.menu_add_book_source -> startActivity<BookSourceEditActivity>() |
|
|
|
R.id.menu_import_qr -> qrResult.launch(null) |
|
|
|
R.id.menu_import_qr -> qrResult.launch(null) |
|
|
|
R.id.menu_share_source -> viewModel.shareSelection(adapter.getSelection()) { |
|
|
|
R.id.menu_share_source -> viewModel.shareSelection(adapter.selection) { |
|
|
|
startActivity(Intent.createChooser(it, getString(R.string.share_selected_source))) |
|
|
|
startActivity(Intent.createChooser(it, getString(R.string.share_selected_source))) |
|
|
|
} |
|
|
|
} |
|
|
|
R.id.menu_group_manage -> |
|
|
|
R.id.menu_group_manage -> |
|
|
@ -302,7 +302,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
|
|
|
|
|
|
|
|
override fun onClickMainAction() { |
|
|
|
override fun onClickMainAction() { |
|
|
|
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) { |
|
|
|
alert(titleResource = R.string.draw, messageResource = R.string.sure_del) { |
|
|
|
okButton { viewModel.delSelection(adapter.getSelection()) } |
|
|
|
okButton { viewModel.delSelection(adapter.selection) } |
|
|
|
noButton() |
|
|
|
noButton() |
|
|
|
}.show() |
|
|
|
}.show() |
|
|
|
} |
|
|
|
} |
|
|
@ -316,13 +316,13 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
|
|
|
|
|
|
|
|
override fun onMenuItemClick(item: MenuItem?): Boolean { |
|
|
|
override fun onMenuItemClick(item: MenuItem?): Boolean { |
|
|
|
when (item?.itemId) { |
|
|
|
when (item?.itemId) { |
|
|
|
R.id.menu_enable_selection -> viewModel.enableSelection(adapter.getSelection()) |
|
|
|
R.id.menu_enable_selection -> viewModel.enableSelection(adapter.selection) |
|
|
|
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.getSelection()) |
|
|
|
R.id.menu_disable_selection -> viewModel.disableSelection(adapter.selection) |
|
|
|
R.id.menu_enable_explore -> viewModel.enableSelectExplore(adapter.getSelection()) |
|
|
|
R.id.menu_enable_explore -> viewModel.enableSelectExplore(adapter.selection) |
|
|
|
R.id.menu_disable_explore -> viewModel.disableSelectExplore(adapter.getSelection()) |
|
|
|
R.id.menu_disable_explore -> viewModel.disableSelectExplore(adapter.selection) |
|
|
|
R.id.menu_check_source -> checkSource() |
|
|
|
R.id.menu_check_source -> checkSource() |
|
|
|
R.id.menu_top_sel -> viewModel.topSource(*adapter.getSelection().toTypedArray()) |
|
|
|
R.id.menu_top_sel -> viewModel.topSource(*adapter.selection.toTypedArray()) |
|
|
|
R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.getSelection().toTypedArray()) |
|
|
|
R.id.menu_bottom_sel -> viewModel.bottomSource(*adapter.selection.toTypedArray()) |
|
|
|
R.id.menu_add_group -> selectionAddToGroups() |
|
|
|
R.id.menu_add_group -> selectionAddToGroups() |
|
|
|
R.id.menu_remove_group -> selectionRemoveFromGroups() |
|
|
|
R.id.menu_remove_group -> selectionRemoveFromGroups() |
|
|
|
R.id.menu_export_selection -> exportDir.launch(null) |
|
|
|
R.id.menu_export_selection -> exportDir.launch(null) |
|
|
@ -343,7 +343,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
CheckSource.keyword = it |
|
|
|
CheckSource.keyword = it |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
CheckSource.start(this@BookSourceActivity, adapter.getSelection()) |
|
|
|
CheckSource.start(this@BookSourceActivity, adapter.selection) |
|
|
|
} |
|
|
|
} |
|
|
|
noButton() |
|
|
|
noButton() |
|
|
|
}.show() |
|
|
|
}.show() |
|
|
@ -361,7 +361,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
viewModel.selectionAddToGroups(adapter.getSelection(), it) |
|
|
|
viewModel.selectionAddToGroups(adapter.selection, it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -381,7 +381,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
okButton { |
|
|
|
okButton { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
alertBinding.editView.text?.toString()?.let { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
if (it.isNotEmpty()) { |
|
|
|
viewModel.selectionRemoveFromGroups(adapter.getSelection(), it) |
|
|
|
viewModel.selectionRemoveFromGroups(adapter.selection, it) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -454,7 +454,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV |
|
|
|
|
|
|
|
|
|
|
|
override fun upCountView() { |
|
|
|
override fun upCountView() { |
|
|
|
binding.selectActionBar |
|
|
|
binding.selectActionBar |
|
|
|
.upCountView(adapter.getSelection().size, adapter.itemCount) |
|
|
|
.upCountView(adapter.selection.size, adapter.itemCount) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onQueryTextChange(newText: String?): Boolean { |
|
|
|
override fun onQueryTextChange(newText: String?): Boolean { |
|
|
|