Fix a few more endless loading issues

This commit is contained in:
Jays2Kings 2021-04-07 04:01:12 -04:00
parent 40a9b2c421
commit 212386f3cc

View File

@ -312,7 +312,7 @@ class RecentsController(bundle: Bundle? = null) :
if (!hasNewItems || presenter.viewType == RecentsPresenter.VIEW_TYPE_GROUP_ALL || presenter.query.isNotEmpty() || if (!hasNewItems || presenter.viewType == RecentsPresenter.VIEW_TYPE_GROUP_ALL || presenter.query.isNotEmpty() ||
recents.isEmpty() recents.isEmpty()
) { ) {
onAddPageError() loadNoMore()
} else if (hasNewItems && presenter.viewType != RecentsPresenter.VIEW_TYPE_GROUP_ALL && presenter.query.isEmpty()) { } else if (hasNewItems && presenter.viewType != RecentsPresenter.VIEW_TYPE_GROUP_ALL && presenter.query.isEmpty()) {
resetProgressItem() resetProgressItem()
} }
@ -477,7 +477,7 @@ class RecentsController(bundle: Bundle? = null) :
setOnQueryTextChangeListener(searchView) { setOnQueryTextChangeListener(searchView) {
if (presenter.query != it) { if (presenter.query != it) {
presenter.query = it ?: return@setOnQueryTextChangeListener false presenter.query = it ?: return@setOnQueryTextChangeListener false
onAddPageError() loadNoMore()
refresh() refresh()
} }
true true
@ -544,14 +544,18 @@ class RecentsController(bundle: Bundle? = null) :
override fun onLoadMore(lastPosition: Int, currentPage: Int) { override fun onLoadMore(lastPosition: Int, currentPage: Int) {
val view = view ?: return val view = view ?: return
if (presenter.finished || BackupRestoreService.isRunning(view.context.applicationContext)) { if (presenter.finished ||
onAddPageError() BackupRestoreService.isRunning(view.context.applicationContext) ||
presenter.viewType == RecentsPresenter.VIEW_TYPE_GROUP_ALL ||
presenter.query.isNotEmpty()
) {
loadNoMore()
return return
} }
presenter.requestNext() presenter.requestNext()
} }
private fun onAddPageError() { private fun loadNoMore() {
adapter.onLoadMoreComplete(null) adapter.onLoadMoreComplete(null)
} }