mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 10:37:51 +02:00
Remove unneeded swipe refresh
This commit is contained in:
@ -123,9 +123,6 @@ class RecentChaptersFragment : BaseRxFragment<RecentChaptersPresenter>(), Action
|
||||
adapter = RecentChaptersAdapter(this)
|
||||
recycler.adapter = adapter
|
||||
|
||||
// Set swipe refresh listener
|
||||
swipe_refresh.setOnRefreshListener { fetchChapters() }
|
||||
|
||||
// Update toolbar text
|
||||
setToolbarTitle(R.string.label_recent_updates)
|
||||
}
|
||||
@ -316,28 +313,4 @@ class RecentChaptersFragment : BaseRxFragment<RecentChaptersPresenter>(), Action
|
||||
(childFragmentManager.findFragmentByTag(DeletingChaptersDialog.TAG) as? DialogFragment)?.dismiss()
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when swipe refresh activated.
|
||||
*/
|
||||
fun fetchChapters() {
|
||||
swipe_refresh.isRefreshing = true
|
||||
presenter.fetchChaptersFromSource()
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after refresh is completed
|
||||
*/
|
||||
fun onFetchChaptersDone() {
|
||||
swipe_refresh.isRefreshing = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when something went wrong while refreshing
|
||||
* @param error information on what went wrong
|
||||
*/
|
||||
fun onFetchChaptersError(error: Throwable) {
|
||||
swipe_refresh.isRefreshing = false
|
||||
context.toast(error.message)
|
||||
}
|
||||
|
||||
}
|
@ -65,11 +65,7 @@ class RecentChaptersPresenter : BasePresenter<RecentChaptersFragment>() {
|
||||
fragment.onNextMangaChapters(chapters)
|
||||
// Update download status
|
||||
updateChapterStatus(convertToMangaChaptersList(chapters))
|
||||
// Stop refresh
|
||||
fragment.onFetchChaptersDone()
|
||||
|
||||
},
|
||||
{ fragment, error -> fragment.onFetchChaptersError(error) }
|
||||
}
|
||||
)
|
||||
|
||||
// Used to update download status
|
||||
@ -346,8 +342,5 @@ class RecentChaptersPresenter : BasePresenter<RecentChaptersFragment>() {
|
||||
chapter.status = Download.NOT_DOWNLOADED
|
||||
}
|
||||
|
||||
fun fetchChaptersFromSource() {
|
||||
start(GET_RECENT_CHAPTERS)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user