|
@@ -44,6 +44,8 @@ abstract class PdfThumbDialogFragment:
|
|
abstract fun getColumns(): Int
|
|
abstract fun getColumns(): Int
|
|
abstract fun getCreateExtractBlankFile(pdfFilename: String, selectPage: String): File
|
|
abstract fun getCreateExtractBlankFile(pdfFilename: String, selectPage: String): File
|
|
abstract fun getKdanPdfReaderFolder(): File
|
|
abstract fun getKdanPdfReaderFolder(): File
|
|
|
|
+ open fun shouldShowDelete(): Boolean { return true }
|
|
|
|
+ open fun shouldShowExtract(): Boolean { return true }
|
|
|
|
|
|
private val readerViewModel: ReaderViewModel by sharedViewModel()
|
|
private val readerViewModel: ReaderViewModel by sharedViewModel()
|
|
private val viewModel: PdfThumbViewModel by viewModel { parametersOf(readerViewModel.readerModel) }
|
|
private val viewModel: PdfThumbViewModel by viewModel { parametersOf(readerViewModel.readerModel) }
|
|
@@ -172,8 +174,8 @@ abstract class PdfThumbDialogFragment:
|
|
}
|
|
}
|
|
|
|
|
|
private fun invalidateOptionsMenu() {
|
|
private fun invalidateOptionsMenu() {
|
|
|
|
+ val menu = toolbar_pdfThumb.menu
|
|
if (!viewModel.passwordHandler.isNeedPassword()) {
|
|
if (!viewModel.passwordHandler.isNeedPassword()) {
|
|
- val menu = toolbar_pdfThumb.menu
|
|
|
|
when (viewModel.isEdit) {
|
|
when (viewModel.isEdit) {
|
|
true -> {
|
|
true -> {
|
|
val isExtractEnable = viewModel.hasSelectItem()
|
|
val isExtractEnable = viewModel.hasSelectItem()
|
|
@@ -201,13 +203,19 @@ abstract class PdfThumbDialogFragment:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- val menu = toolbar_pdfThumb.menu
|
|
|
|
menu.findItem(R.id.item_action_edit_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_edit_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_select_all_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_select_all_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_extract_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_extract_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_rorate_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_rorate_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_delete_thumb).isVisible = false
|
|
menu.findItem(R.id.item_action_delete_thumb).isVisible = false
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (!shouldShowDelete()) {
|
|
|
|
+ menu.findItem(R.id.item_action_delete_thumb).isVisible = false
|
|
|
|
+ }
|
|
|
|
+ if (!shouldShowExtract()) {
|
|
|
|
+ menu.findItem(R.id.item_action_extract_thumb).isVisible = false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
override fun onStop() {
|
|
override fun onStop() {
|