From 848c8bf1ba4f0f3ecf2eeae0b9be2d6a664db2b4 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Tue, 2 Mar 2021 10:46:48 +0100 Subject: Creating the APIs and the responses. --- .../xyz/adjutor/aniki/manga/search/SearchManga.kt | 34 ++++++++++++++++++++++ .../adjutor/aniki/manga/search/SearchMangaApi.kt | 12 ++++++++ .../aniki/manga/search/SearchMangaResponse.kt | 13 +++++++++ 3 files changed, 59 insertions(+) create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/search/SearchManga.kt create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaApi.kt create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaResponse.kt (limited to 'app/src/main/java/xyz/adjutor/aniki/manga/search') diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchManga.kt b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchManga.kt new file mode 100644 index 0000000..53899e2 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchManga.kt @@ -0,0 +1,34 @@ +package xyz.adjutor.aniki.manga.search + +import com.google.gson.annotations.SerializedName + +class SearchManga { + + @SerializedName("mal_id") + var mal_id: Int? = null + + @SerializedName("url") + var url: String? = null + + @SerializedName("image_url") + var image_url: String? = null + + @SerializedName("title") + var title: String? = null + + @SerializedName("chapters") + var chapters: Int? = null + + @SerializedName("volumes") + var volumes: Int? = null + + @SerializedName("score") + var score: Float? = null + + @SerializedName("start_date") //we'll maybe remove this later + var start_date: String? = null + + @SerializedName("end_date") //we'll maybe remove this later + var end_date: String? = null + +} diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaApi.kt b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaApi.kt new file mode 100644 index 0000000..6f3e63d --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaApi.kt @@ -0,0 +1,12 @@ +package xyz.adjutor.aniki.manga.search + +import retrofit2.Call +import retrofit2.http.GET +import retrofit2.http.Query + +interface SearchMangaApi { + + @GET("v3/search/manga") + fun getSearchMangaData(@Query("q") q: String): Call + +} \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaResponse.kt b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaResponse.kt new file mode 100644 index 0000000..7721258 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaResponse.kt @@ -0,0 +1,13 @@ +package xyz.adjutor.aniki.manga.search + +import com.google.gson.annotations.SerializedName + +class SearchMangaResponse { //only kept the infos I didn't have and that were interesting to me. + + @SerializedName("results") + private lateinit var results: List + + fun getResults(): List { + return results + } +} -- cgit v1.2.3 From 6d5df6250d4c060840b64d7441525f85146fb87b Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Tue, 2 Mar 2021 11:15:56 +0100 Subject: Building the basic files to display the searched mangas. --- app/src/main/java/xyz/adjutor/aniki/HomePage.kt | 3 + .../aniki/manga/search/SearchMangaAdapter.kt | 80 ++++++++++++++ .../adjutor/aniki/manga/search/SearchMangaPage.kt | 122 +++++++++++++++++++++ app/src/main/res/layout/home_page.xml | 11 ++ app/src/main/res/layout/search_manga_page.xml | 36 ++++++ app/src/main/res/navigation/nav_graph.xml | 13 +++ app/src/main/res/values/strings.xml | 2 + 7 files changed, 267 insertions(+) create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaAdapter.kt create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/search/SearchMangaPage.kt create mode 100644 app/src/main/res/layout/search_manga_page.xml (limited to 'app/src/main/java/xyz/adjutor/aniki/manga/search') diff --git a/app/src/main/java/xyz/adjutor/aniki/HomePage.kt b/app/src/main/java/xyz/adjutor/aniki/HomePage.kt index b7c1d0e..0b90b49 100644 --- a/app/src/main/java/xyz/adjutor/aniki/HomePage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/HomePage.kt @@ -27,5 +27,8 @@ class HomePage : Fragment() { view.findViewById