From d053033b3c74acdbd05ea5bc6549e87ff7ea008f Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Tue, 13 Apr 2021 13:34:34 +0200 Subject: Moving the basic variables. --- .../aniki/presentation/view/manga/TopMangaPage.kt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'app/src') 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() 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? = getDataFromCache() -- cgit v1.2.3