Remove unneeded swipe refresh

This commit is contained in:
len 2016-06-05 11:54:35 +02:00
parent 6687c80b2d
commit 156e43290e
3 changed files with 3 additions and 46 deletions

View File

@ -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)
}
}

View File

@ -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)
}
}

View File

@ -5,20 +5,11 @@
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
tools:listitem="@layout/item_recent_chapter">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
tools:listitem="@layout/item_recent_chapter"/>
</RelativeLayout>