aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt9
1 files changed, 4 insertions, 5 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt
index b1fe2e2..f2d5e4c 100644
--- a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt
@@ -20,7 +20,6 @@ import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import xyz.adjutor.aniki.R
-import xyz.adjutor.aniki.topmanga.TopManga
import java.lang.reflect.Type
class TopAnimePage : Fragment() {
@@ -38,7 +37,7 @@ class TopAnimePage : Fragment() {
// Inflate the layout for this fragment
val view = inflater.inflate(R.layout.top_anime_page, container, false)
- sharedPreferences = view.context.getSharedPreferences("app_aniki", Context.MODE_PRIVATE)
+ sharedPreferences = view.context.getSharedPreferences("sp_anime", Context.MODE_PRIVATE)
val animeList: List<TopAnime>? = getDataFromCache()
if(animeList != null ){
@@ -95,9 +94,9 @@ class TopAnimePage : Fragment() {
override fun onResponse(call: Call<RestTopAnimeResponse>, response: Response<RestTopAnimeResponse>) {
if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty
- val animeList = response.body()!!.getResults() //getting the "top" field containing our list of TopAnimes
+ val animeList: List<TopAnime> = response.body()!!.getResults() //getting the "top" field containing our list of TopAnimes
saveList(animeList)
- showList(view, animeList) // calling the method in charge of displaying on the recyclerview
+ showList(view, animeList) //calling the method in charge of displaying on the recyclerview
} else {
showError() //a snackbar
@@ -121,7 +120,7 @@ class TopAnimePage : Fragment() {
}
private fun showError() {
- Snackbar.make(requireView(), "HA? YOU THOUGHT IT WAS AN API !? BUT IT WAS I, ERROR !", Snackbar.LENGTH_LONG)
+ Snackbar.make(requireView(), "API ERROR", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}