From bd885788c79cfa37bb2ff02faf4ae2516b87b5dd Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Tue, 23 Mar 2021 10:54:41 +0100 Subject: Feature added to animes. Removed the ScrollListener, I prefer to only use buttons for the feature. --- .../adjutor/aniki/manga/topmanga/TopMangaPage.kt | 33 ++++++---------------- 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'app/src/main/java/xyz/adjutor/aniki/manga') diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt index ea240b9..9c138a3 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt @@ -24,7 +24,6 @@ import retrofit2.converter.gson.GsonConverterFactory import xyz.adjutor.aniki.R import java.lang.reflect.Type - class TopMangaPage : Fragment() { private lateinit var sharedPreferences: SharedPreferences @@ -50,24 +49,6 @@ class TopMangaPage : Fragment() { makeApiCall(view, baseUrl, 1) } - // add other pages when we touch the bottom - val recyclerView: RecyclerView = view.findViewById(R.id.recycler_view) - recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { - override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { - super.onScrollStateChanged(recyclerView, newState) - if (!recyclerView.canScrollVertically(1)) { //direction integers: -1 for up, 1 for down, 0 will always return false. - page += 1 - makeApiCall(view, baseUrl, page) - Snackbar.make( - requireView(), - "Page $page has been loaded.", - Snackbar.LENGTH_LONG - ) - .setAction("Action", null).show() - } - } - }) - return view } @@ -96,23 +77,23 @@ class TopMangaPage : Fragment() { if (page > 1) { page -= 1 makeApiCall(view, baseUrl, page) - Snackbar.make(requireView(), "Page $page has been loaded.", Snackbar.LENGTH_LONG) + Snackbar.make(requireView(), "Page $page has been loaded.", Snackbar.LENGTH_SHORT) .setAction("Action", null).show() } else { - Snackbar.make(requireView(), "You're already page 1.", Snackbar.LENGTH_LONG) + Snackbar.make(requireView(), "You're already on page 1.", Snackbar.LENGTH_SHORT) .setAction("Action", null).show() } } view.findViewById