diff options
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/TopMangaPage.kt | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/TopMangaPage.kt index edb5fea..943019d 100644 --- a/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/TopMangaPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/TopMangaPage.kt @@ -23,19 +23,21 @@ import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import xyz.adjutor.aniki.R import xyz.adjutor.aniki.data.manga.TopMangaApi +import xyz.adjutor.aniki.presentation.controller.TopMangaController import xyz.adjutor.aniki.presentation.model.manga.TopManga import xyz.adjutor.aniki.presentation.model.manga.TopMangaResponse import java.lang.reflect.Type +import kotlin.properties.Delegates //view class TopMangaPage : Fragment() { + lateinit var controller: TopMangaController + private lateinit var sharedPreferences: SharedPreferences - val gson: Gson = GsonBuilder() - .setLenient() - .create() - private var baseUrl = "https://api.jikan.moe/" //the api's base url - var page: Int = 1 + lateinit var gson: Gson + private lateinit var baseUrl: String //the api's base url + private var page by Delegates.notNull<Int>() override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -44,6 +46,14 @@ class TopMangaPage : Fragment() { // Inflate the layout for this fragment val view = inflater.inflate(R.layout.top_manga_page, container, false) + //controller.onStart() + + gson = GsonBuilder() + .setLenient() + .create() + baseUrl = "https://api.jikan.moe/" //the api's base url + page = 1 + sharedPreferences = view.context.getSharedPreferences("sp_manga", Context.MODE_PRIVATE) val mangaList: List<TopManga>? = getDataFromCache() |