From db93d1da76ba453e5b499bab0d2482728014786f Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 30 Jul 2022 04:42:18 +0200 Subject: [PATCH] Fix library bugs (#7648) - Fix mixup in Action Menu - Fix back action not clearing search --- .../kanade/presentation/library/LibraryScreen.kt | 4 ++-- .../tachiyomi/ui/library/LibraryController.kt | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt index fec2432ea..1f7baaa8c 100644 --- a/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt @@ -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 -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index a1f9553f0..cec1a6f07 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -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) {