Using swipe refresh for loading new manga into tracking

This commit is contained in:
Jay 2020-01-13 19:12:24 -08:00
parent c5ad0fc692
commit a8a9d699b2
2 changed files with 4 additions and 2 deletions

View File

@ -88,8 +88,8 @@ class TrackPresenter(
.flatMap { db.insertTrack(item).asRxObservable() } .flatMap { db.insertTrack(item).asRxObservable() }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ }, .subscribeFirst({ view, _ -> view.onRefreshDone() },
{ error -> context.toast(error.message) })) TrackController::onRefreshError))
} else { } else {
db.deleteTrackForManga(manga, service).executeAsBlocking() db.deleteTrackForManga(manga, service).executeAsBlocking()
} }

View File

@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.util.plusAssign import eu.kanade.tachiyomi.util.plusAssign
import kotlinx.android.synthetic.main.track_controller.*
import kotlinx.android.synthetic.main.track_search_dialog.view.* import kotlinx.android.synthetic.main.track_search_dialog.view.*
import rx.Subscription import rx.Subscription
import rx.android.schedulers.AndroidSchedulers import rx.android.schedulers.AndroidSchedulers
@ -133,6 +134,7 @@ class TrackSearchDialog : DialogController {
} }
private fun onPositiveButtonClick() { private fun onPositiveButtonClick() {
trackController.swipe_refresh.isRefreshing = true
trackController.presenter.registerTracking(selectedItem, service) trackController.presenter.registerTracking(selectedItem, service)
} }