diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-02-22 20:03:25 +0100 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-02-22 20:03:25 +0100 |
commit | 4012256bf91ccf02eb1871229f755beb26dad3de (patch) | |
tree | ae8521428bdde7750294d25c8e49a93df9e95f26 /app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt | |
parent | 893c9110c99cff286011e3d35acb39ba65a97476 (diff) | |
parent | 494455de615340599cf2cdba0f3f199a47bf5a66 (diff) |
Merge branch 'feature/elements_detail' into developrelease/2.0
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.kt | 9 |
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() } |