mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01: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) | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -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> | ||||
		Reference in New Issue
	
	Block a user