mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 03:01:49 +01:00
Make query non nullable, it fixes some bugs in the catalogue
This commit is contained in:
parent
de6cc8394e
commit
5d396bfb7c
@ -52,7 +52,7 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
|||||||
/**
|
/**
|
||||||
* Query from the view.
|
* Query from the view.
|
||||||
*/
|
*/
|
||||||
var query: String? = null
|
var query = ""
|
||||||
private set
|
private set
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,7 +104,7 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
|||||||
source = getLastUsedSource()
|
source = getLastUsedSource()
|
||||||
|
|
||||||
if (savedState != null) {
|
if (savedState != null) {
|
||||||
query = savedState.getString(QUERY_KEY)
|
query = savedState.getString(QUERY_KEY, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
startableLatestCache(GET_MANGA_DETAILS,
|
startableLatestCache(GET_MANGA_DETAILS,
|
||||||
@ -160,7 +160,7 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
|||||||
fun setActiveSource(source: Source) {
|
fun setActiveSource(source: Source) {
|
||||||
prefs.lastUsedCatalogueSource().set(source.id)
|
prefs.lastUsedCatalogueSource().set(source.id)
|
||||||
this.source = source
|
this.source = source
|
||||||
restartPager(null)
|
restartPager()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,7 +168,7 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
|||||||
*
|
*
|
||||||
* @param query the query, or null if searching popular manga.
|
* @param query the query, or null if searching popular manga.
|
||||||
*/
|
*/
|
||||||
fun restartPager(query: String?) {
|
fun restartPager(query: String = "") {
|
||||||
this.query = query
|
this.query = query
|
||||||
stop(REQUEST_PAGE)
|
stop(REQUEST_PAGE)
|
||||||
lastMangasPage = null
|
lastMangasPage = null
|
||||||
@ -215,10 +215,10 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
|||||||
nextMangasPage.url = lastMangasPage!!.nextPageUrl
|
nextMangasPage.url = lastMangasPage!!.nextPageUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
val observable = if (query.isNullOrEmpty())
|
val observable = if (query.isEmpty())
|
||||||
source.pullPopularMangasFromNetwork(nextMangasPage)
|
source.pullPopularMangasFromNetwork(nextMangasPage)
|
||||||
else
|
else
|
||||||
source.searchMangasFromNetwork(nextMangasPage, query!!)
|
source.searchMangasFromNetwork(nextMangasPage, query)
|
||||||
|
|
||||||
return observable.subscribeOn(Schedulers.io())
|
return observable.subscribeOn(Schedulers.io())
|
||||||
.doOnNext { lastMangasPage = it }
|
.doOnNext { lastMangasPage = it }
|
||||||
|
Loading…
Reference in New Issue
Block a user