diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-03-23 10:54:41 +0100 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-03-23 10:54:41 +0100 |
commit | bd885788c79cfa37bb2ff02faf4ae2516b87b5dd (patch) | |
tree | 3008f3643180e237bd735cce7a4ddf72f883acf8 /app/src/main/java/xyz/adjutor/aniki/manga/topmanga | |
parent | d283df0f70241bb6b54bee66e8fb9564b0051376 (diff) |
Feature added to animes.feature/multiple_top_pages
Removed the ScrollListener, I prefer to only use buttons for the feature.
Diffstat (limited to 'app/src/main/java/xyz/adjutor/aniki/manga/topmanga')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt | 33 |
1 files changed, 9 insertions, 24 deletions
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<Button>(R.id.button_next).setOnClickListener { 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() } fun updateList() { makeApiCall(view, baseUrl, 1) - Snackbar.make(requireView(), "Data refreshed", Snackbar.LENGTH_LONG) + Snackbar.make(requireView(), "Data refreshed", Snackbar.LENGTH_SHORT) .setAction("Action", null).show() } @@ -182,7 +163,11 @@ class TopMangaPage : Fragment() { } private fun showError() { - Snackbar.make(requireView(), "API ERROR", Snackbar.LENGTH_LONG) + Snackbar.make( + requireView(), + "API ERROR : Verify your internet connection.", + Snackbar.LENGTH_LONG + ) .setAction("Action", null).show() } |