mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactoring of last pr
This commit is contained in:
parent
a1320c5c26
commit
6a37d0f60d
2 changed files with 5 additions and 6 deletions
|
@ -167,7 +167,6 @@ class LibraryController(
|
|||
* Library search query.
|
||||
*/
|
||||
private var query = ""
|
||||
private var oldShowAllCategories = true
|
||||
|
||||
/**
|
||||
* Currently selected mangas.
|
||||
|
@ -1267,11 +1266,10 @@ class LibraryController(
|
|||
|
||||
fun search(query: String?): Boolean {
|
||||
if (!query.isNullOrBlank() && this.query.isBlank() && !presenter.showAllCategories) {
|
||||
oldShowAllCategories = presenter.showAllCategories
|
||||
preferences.showAllCategories().set(true)
|
||||
presenter.forceShowAllCategories = true
|
||||
presenter.getLibrary()
|
||||
} else if (query.isNullOrBlank() && this.query.isNotBlank() && !oldShowAllCategories) {
|
||||
preferences.showAllCategories().set(oldShowAllCategories)
|
||||
} else if (query.isNullOrBlank() && this.query.isNotBlank() && presenter.forceShowAllCategories) {
|
||||
presenter.forceShowAllCategories = false
|
||||
presenter.getLibrary()
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,9 @@ class LibraryPresenter(
|
|||
private set
|
||||
var allLibraryItems: List<LibraryItem> = emptyList()
|
||||
private set
|
||||
var forceShowAllCategories = false
|
||||
val showAllCategories
|
||||
get() = preferences.showAllCategories().get()
|
||||
get() = forceShowAllCategories || preferences.showAllCategories().get()
|
||||
|
||||
private val libraryIsGrouped
|
||||
get() = groupType != UNGROUPED
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue