mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Don't update library items on starting service update
This commit is contained in:
parent
790ab499f9
commit
203089e1b7
3 changed files with 13 additions and 7 deletions
|
@ -239,7 +239,7 @@ class LibraryUpdateService(
|
|||
stopSelf(startId)
|
||||
}
|
||||
if (target == Target.CHAPTERS) {
|
||||
listener?.onUpdateManga()
|
||||
listener?.onUpdateManga(Manga.create(STARTING_UPDATE_SOURCE))
|
||||
}
|
||||
job = GlobalScope.launch(handler) {
|
||||
when (target) {
|
||||
|
@ -592,6 +592,7 @@ class LibraryUpdateService(
|
|||
* Key for category to update.
|
||||
*/
|
||||
const val KEY_CATEGORY = "category"
|
||||
const val STARTING_UPDATE_SOURCE = -5L
|
||||
|
||||
fun categoryInQueue(id: Int?) = instance?.categoryIds?.contains(id) ?: false
|
||||
private var instance: LibraryUpdateService? = null
|
||||
|
|
|
@ -1460,6 +1460,7 @@ class LibraryController(
|
|||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun onUpdateManga(manga: Manga?) {
|
||||
if (manga?.source == LibraryUpdateService.STARTING_UPDATE_SOURCE) return
|
||||
if (manga == null) adapter.notifyDataSetChanged()
|
||||
else presenter.updateManga()
|
||||
}
|
||||
|
|
|
@ -394,12 +394,16 @@ class RecentsPresenter(
|
|||
}
|
||||
|
||||
override fun onUpdateManga(manga: Manga?) {
|
||||
if (manga == null && !LibraryUpdateService.isRunning()) {
|
||||
presenterScope.launchUI { controller?.setRefreshing(false) }
|
||||
} else if (manga == null) {
|
||||
presenterScope.launchUI { controller?.setRefreshing(true) }
|
||||
} else {
|
||||
getRecents()
|
||||
when {
|
||||
manga == null -> {
|
||||
presenterScope.launchUI { controller?.setRefreshing(false) }
|
||||
}
|
||||
manga.source == LibraryUpdateService.STARTING_UPDATE_SOURCE -> {
|
||||
presenterScope.launchUI { controller?.setRefreshing(true) }
|
||||
}
|
||||
else -> {
|
||||
getRecents()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue