diff --git a/cozy/ui/library_view.py b/cozy/ui/library_view.py index 095c1393..c593c7a2 100644 --- a/cozy/ui/library_view.py +++ b/cozy/ui/library_view.py @@ -117,7 +117,7 @@ def _on_library_view_mode_changed(self): visible_child_name = RECENT_PAGE elif view_mode == LibraryViewMode.CURRENT: visible_child_name = RECENT_PAGE - if not self._view_model.is_any_book_in_progress: + if not self._view_model.is_any_book_recent: books_view_page = NO_RECENT_PAGE elif view_mode == LibraryViewMode.AUTHOR: visible_child_name = AUTHOR_PAGE diff --git a/cozy/view_model/library_view_model.py b/cozy/view_model/library_view_model.py index 1c7e487e..5cb06904 100644 --- a/cozy/view_model/library_view_model.py +++ b/cozy/view_model/library_view_model.py @@ -78,8 +78,8 @@ def selected_filter(self, value): self._notify("selected_filter") @property - def is_any_book_in_progress(self) -> bool: - return any(book.position > 0 for book in self.books) + def is_any_book_recent(self) -> bool: + return any(book.last_played > 0 for book in self.books) @property def authors(self): @@ -129,12 +129,15 @@ def display_book_filter(self, book_element: BookCard): hide_offline_books = self._application_settings.hide_offline book_is_online = self._fs_monitor.get_book_online(book) - if self.selected_filter == _("All"): - return True - elif hide_offline_books and not book_is_online and not book.downloaded: + + if hide_offline_books and not book_is_online and not book.downloaded: return False - elif self.library_view_mode == LibraryViewMode.CURRENT: + + if self.library_view_mode == LibraryViewMode.CURRENT: return book.last_played > 0 + + if self.selected_filter == _("All"): + return True elif self.library_view_mode == LibraryViewMode.AUTHOR: return self.selected_filter in book.author elif self.library_view_mode == LibraryViewMode.READER: