aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/xyz/adjutor/aniki/manga
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/xyz/adjutor/aniki/manga')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt33
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()
}