Fix library bugs (#7648)

- Fix mixup in Action Menu
- Fix back action not clearing search
This commit is contained in:
Andreas 2022-07-30 04:42:18 +02:00 committed by GitHub
parent 7d74b174e0
commit db93d1da76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -53,8 +53,8 @@ fun LibraryScreen(
onChangeCategoryClicked = onChangeCategoryClicked,
onMarkAsReadClicked = onMarkAsReadClicked,
onMarkAsUnreadClicked = onMarkAsUnreadClicked,
onDownloadClicked = onDownloadClicked,
onDeleteClicked = onDeleteClicked.takeIf { presenter.selection.none { it.source == LocalSource.ID } },
onDownloadClicked = onDownloadClicked.takeIf { presenter.selection.none { it.source == LocalSource.ID } },
onDeleteClicked = onDeleteClicked,
)
},
) { paddingValues ->

View File

@ -78,11 +78,17 @@ class LibraryController(
}
override fun handleBack(): Boolean {
if (presenter.selection.isNotEmpty()) {
presenter.clearSelection()
return true
return when {
presenter.selection.isNotEmpty() -> {
presenter.clearSelection()
true
}
presenter.searchQuery != null -> {
presenter.searchQuery = null
true
}
else -> false
}
return false
}
override fun onViewCreated(view: View) {