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)
|
stopSelf(startId)
|
||||||
}
|
}
|
||||||
if (target == Target.CHAPTERS) {
|
if (target == Target.CHAPTERS) {
|
||||||
listener?.onUpdateManga()
|
listener?.onUpdateManga(Manga.create(STARTING_UPDATE_SOURCE))
|
||||||
}
|
}
|
||||||
job = GlobalScope.launch(handler) {
|
job = GlobalScope.launch(handler) {
|
||||||
when (target) {
|
when (target) {
|
||||||
|
@ -592,6 +592,7 @@ class LibraryUpdateService(
|
||||||
* Key for category to update.
|
* Key for category to update.
|
||||||
*/
|
*/
|
||||||
const val KEY_CATEGORY = "category"
|
const val KEY_CATEGORY = "category"
|
||||||
|
const val STARTING_UPDATE_SOURCE = -5L
|
||||||
|
|
||||||
fun categoryInQueue(id: Int?) = instance?.categoryIds?.contains(id) ?: false
|
fun categoryInQueue(id: Int?) = instance?.categoryIds?.contains(id) ?: false
|
||||||
private var instance: LibraryUpdateService? = null
|
private var instance: LibraryUpdateService? = null
|
||||||
|
|
|
@ -1460,6 +1460,7 @@ class LibraryController(
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
override fun onUpdateManga(manga: Manga?) {
|
override fun onUpdateManga(manga: Manga?) {
|
||||||
|
if (manga?.source == LibraryUpdateService.STARTING_UPDATE_SOURCE) return
|
||||||
if (manga == null) adapter.notifyDataSetChanged()
|
if (manga == null) adapter.notifyDataSetChanged()
|
||||||
else presenter.updateManga()
|
else presenter.updateManga()
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,14 +394,18 @@ class RecentsPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onUpdateManga(manga: Manga?) {
|
override fun onUpdateManga(manga: Manga?) {
|
||||||
if (manga == null && !LibraryUpdateService.isRunning()) {
|
when {
|
||||||
|
manga == null -> {
|
||||||
presenterScope.launchUI { controller?.setRefreshing(false) }
|
presenterScope.launchUI { controller?.setRefreshing(false) }
|
||||||
} else if (manga == null) {
|
}
|
||||||
|
manga.source == LibraryUpdateService.STARTING_UPDATE_SOURCE -> {
|
||||||
presenterScope.launchUI { controller?.setRefreshing(true) }
|
presenterScope.launchUI { controller?.setRefreshing(true) }
|
||||||
} else {
|
}
|
||||||
|
else -> {
|
||||||
getRecents()
|
getRecents()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the given list of chapter.
|
* Deletes the given list of chapter.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue