From 496eff5e9bf0380253594ddf37a5743f6d250562 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sat, 20 Feb 2021 18:10:38 +0100 Subject: Intents now working for top mangas --- app/src/main/res/values/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/src/main/res/values') diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0a85246..3bcd30b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -8,12 +8,12 @@ News Page Article Page Top Manga Page - Title - 0 - image + Title + 0 + image Image of manga Top Anime Page Top Anime - 00.00 + 00.00 \ No newline at end of file -- cgit v1.2.3 From 7c8476a2128f6c4494eaa2d0a363d8cbe3261ba6 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sat, 20 Feb 2021 18:56:42 +0100 Subject: Beginning the manga api part. --- app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt | 31 ++++++++++++ .../java/xyz/adjutor/aniki/manga/MangaAdapter.kt | 58 ++++++++++++++++++++++ .../main/java/xyz/adjutor/aniki/manga/MangaApi.kt | 11 ++++ .../java/xyz/adjutor/aniki/topanime/TopAnime.kt | 2 +- .../aniki/topmanga/DetailTopMangaActivity.kt | 13 +++-- .../xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt | 4 +- .../main/res/layout/activity_detail_top_manga.xml | 22 ++++++++ app/src/main/res/values/strings.xml | 2 + 8 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt (limited to 'app/src/main/res/values') diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt b/app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt new file mode 100644 index 0000000..43944c3 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt @@ -0,0 +1,31 @@ +package xyz.adjutor.aniki.manga + +import com.google.gson.annotations.SerializedName + +//Content of the top field from the api of manga +class Manga{ + + @SerializedName("url") + var url: String? = null + @SerializedName("title") + var title: String? = null + @SerializedName("rank") + var rank: Int? = null + @SerializedName("volumes") + var volumes: Int? = null + @SerializedName("chapters") + var chapters: Int? = null + @SerializedName("start_date") + var start_date: String? = null + @SerializedName("end_date") + var end_date: String? = null + @SerializedName("score") + var score: Float? = null + @SerializedName("image_url") + var image_url: String? = null + @SerializedName("synopsis") + var synopsis: String? = null + @SerializedName("background") + var background: String? = null + +} diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt new file mode 100644 index 0000000..ad753e2 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt @@ -0,0 +1,58 @@ +@file:Suppress("DEPRECATION") + +package xyz.adjutor.aniki.manga + +import android.content.Intent +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.cardview.widget.CardView +import androidx.recyclerview.widget.RecyclerView +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions +import xyz.adjutor.aniki.R +import xyz.adjutor.aniki.topmanga.DetailTopMangaActivity + +class MangaAdapter(val mangaList: List) : + RecyclerView.Adapter() { + + // Describes an item view and its place within the RecyclerView + class MangaViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val mangaTitle: TextView = itemView.findViewById(R.id.tv_title) + val mangaRank: TextView = itemView.findViewById(R.id.tv_rank) + val mangaScore: TextView = itemView.findViewById(R.id.tv_score) + val mangaImage: ImageView = itemView.findViewById(R.id.iv_image) + val cardview: CardView = itemView.findViewById(R.id.cv_cardView) + + } + + // Returns a new ViewHolder + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MangaViewHolder { + val view = LayoutInflater.from(parent.context) + .inflate(R.layout.item_layout, parent, false) + + return MangaViewHolder(view) + } + + // Returns size of data list + override fun getItemCount(): Int { + return mangaList.size + } + + // Displays data at a certain position + override fun onBindViewHolder(holder: MangaViewHolder, position: Int) { + val currentManga: Manga = mangaList[position] + holder.mangaTitle.text = currentManga.title + holder.mangaRank.text = currentManga.rank.toString() + holder.mangaScore.text = currentManga.score.toString() + val image: String = currentManga.image_url.toString() + Glide + .with(holder.itemView.context) + .load(image) + .apply(RequestOptions().override(400)) + .into(holder.mangaImage) + } +} + diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt b/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt new file mode 100644 index 0000000..7692836 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt @@ -0,0 +1,11 @@ +package xyz.adjutor.aniki.manga + +import retrofit2.Call +import retrofit2.http.GET + +interface MangaApi { + + @GET("v3/manga") + fun getMangaData(): Call + +} \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt index a428841..3576e7b 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt @@ -2,7 +2,7 @@ package xyz.adjutor.aniki.topanime import com.google.gson.annotations.SerializedName -//Content of the top field from the api of top manga +//Content of the top field from the api of top anime class TopAnime{ @SerializedName("mal_id") diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt index e97ee39..2f0d2c3 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt @@ -9,26 +9,29 @@ import com.bumptech.glide.request.RequestOptions import xyz.adjutor.aniki.R class DetailTopMangaActivity : AppCompatActivity() { - - private val currentMangaTitle: String = "themangatitle" - val currentMangaRank: String = "themangarank" - val currentMangaScore: String = "themangascore" - val currentMangaImageUrl: String = "themangaimageurl" + private val currentMangaId = "themangaid" + private val currentMangaTitle = "themangatitle" + private val currentMangaRank = "themangarank" + private val currentMangaScore = "themangascore" + private val currentMangaImageUrl = "themangaimageurl" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_detail_top_manga) + val mangaId = intent.getStringExtra(currentMangaId) val mangaTitle = intent.getStringExtra(currentMangaTitle) val mangaRank = intent.getStringExtra(currentMangaRank) val mangaScore = intent.getStringExtra(currentMangaScore) val mangaImage = intent.getStringExtra(currentMangaImageUrl) + val tvId: TextView = findViewById(R.id.tv_detail_id) val tvTitle: TextView = findViewById(R.id.tv_detail_title) val tvRank: TextView = findViewById(R.id.tv_detail_rank) val tvScore: TextView = findViewById(R.id.tv_detail_score) val ivImage: ImageView = findViewById(R.id.iv_detail_image) + tvId.text = mangaId tvTitle.text = mangaTitle tvRank.text = mangaRank tvScore.text = mangaScore diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt index 2eaf958..e46fc79 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt @@ -53,14 +53,16 @@ class TopMangaAdapter(val mangaList: List) : .apply(RequestOptions().override(400)) .into(holder.mangaImage) - //to go to a detail page of the selected manga + //to go to the detail page of the selected manga holder.cardview.setOnClickListener { + val currentMangaId = "themangaid" val currentMangaTitle = "themangatitle" val currentMangaRank = "themangarank" val currentMangaScore = "themangascore" val currentMangaImageUrl = "themangaimageurl" val intent: Intent = Intent(holder.itemView.context, DetailTopMangaActivity::class.java).apply { + putExtra(currentMangaId, currentManga.mal_id.toString()) putExtra(currentMangaTitle, currentManga.title) putExtra(currentMangaRank, currentManga.rank.toString()) putExtra(currentMangaScore, currentManga.score.toString()) diff --git a/app/src/main/res/layout/activity_detail_top_manga.xml b/app/src/main/res/layout/activity_detail_top_manga.xml index 3e74697..42018ef 100644 --- a/app/src/main/res/layout/activity_detail_top_manga.xml +++ b/app/src/main/res/layout/activity_detail_top_manga.xml @@ -7,6 +7,16 @@ tools:context=".topmanga.DetailTopMangaActivity" android:background="@color/very_dark_purple"> + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3bcd30b..03d4a0e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -15,5 +15,7 @@ Top Anime Page Top Anime 00.00 + 000000 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \ No newline at end of file -- cgit v1.2.3 From 6caf50512e0d5ec54493037ad5662229d8836eca Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sun, 21 Feb 2021 18:07:27 +0100 Subject: Making activity_detail_top_manga.xml beautiful! --- .../aniki/topmanga/DetailTopMangaActivity.kt | 27 ++- .../main/res/layout/activity_detail_top_manga.xml | 205 +++++++++++++++++++-- app/src/main/res/values/strings.xml | 24 ++- 3 files changed, 221 insertions(+), 35 deletions(-) (limited to 'app/src/main/res/values') diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt index 2f0d2c3..9347f2c 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt @@ -6,24 +6,26 @@ import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions +import com.google.android.material.snackbar.Snackbar import xyz.adjutor.aniki.R class DetailTopMangaActivity : AppCompatActivity() { - private val currentMangaId = "themangaid" - private val currentMangaTitle = "themangatitle" - private val currentMangaRank = "themangarank" - private val currentMangaScore = "themangascore" - private val currentMangaImageUrl = "themangaimageurl" + + private val mangaId = "themangaid" + private val mangaTitle = "themangatitle" + private val mangaRank = "themangarank" + private val mangaScore = "themangascore" + private val mangaImageUrl = "themangaimageurl" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_detail_top_manga) - val mangaId = intent.getStringExtra(currentMangaId) - val mangaTitle = intent.getStringExtra(currentMangaTitle) - val mangaRank = intent.getStringExtra(currentMangaRank) - val mangaScore = intent.getStringExtra(currentMangaScore) - val mangaImage = intent.getStringExtra(currentMangaImageUrl) + val mangaId = intent.getStringExtra(mangaId) + val mangaTitle = intent.getStringExtra(mangaTitle) + val mangaRank = intent.getStringExtra(mangaRank) + val mangaScore = intent.getStringExtra(mangaScore) + val mangaImage = intent.getStringExtra(mangaImageUrl) val tvId: TextView = findViewById(R.id.tv_detail_id) val tvTitle: TextView = findViewById(R.id.tv_detail_title) @@ -31,6 +33,11 @@ class DetailTopMangaActivity : AppCompatActivity() { val tvScore: TextView = findViewById(R.id.tv_detail_score) val ivImage: ImageView = findViewById(R.id.iv_detail_image) + //elements from Manga + val tvChapters: TextView = findViewById(R.id.tv_chapters) + val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) + val tvBackground: TextView = findViewById(R.id.tv_background) + tvId.text = mangaId tvTitle.text = mangaTitle tvRank.text = mangaRank diff --git a/app/src/main/res/layout/activity_detail_top_manga.xml b/app/src/main/res/layout/activity_detail_top_manga.xml index 42018ef..b9a5dd7 100644 --- a/app/src/main/res/layout/activity_detail_top_manga.xml +++ b/app/src/main/res/layout/activity_detail_top_manga.xml @@ -6,7 +6,24 @@ android:layout_height="match_parent" tools:context=".topmanga.DetailTopMangaActivity" android:background="@color/very_dark_purple"> + + + + app:layout_constraintTop_toTopOf="parent" /> + + android:textColor="@color/slightly_desaturated_magenta" + android:textSize="20sp" + app:layout_constraintBottom_toTopOf="@id/tv_detail_title" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_detail_title" /> + + + + + + + + + + + + + + + + + + + + + + + + + app:layout_constraintTop_toTopOf="parent"/> + + + + + + + + + - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 03d4a0e..100335d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,19 +3,31 @@ Settings Top Manga + Top Anime Home + Home Page - News Page - Article Page Top Manga Page + Top Anime Page + + 000000 Title 0 image - Image of manga - Top Anime Page - Top Anime 00.00 - 000000 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + "MAL ID : " + "Rank : " + "Score : " + 000 + "Volumes : " + "Chapters: " + 0000 + "Start date : " + "End date : " + Jan 0000 + Dec 0000 + Cras molestie turpis at lorem rutrum vehicula. Fusce rutrum, enim sed laoreet semper, tortor quam semper dui, id bibendum lacus quam vitae neque. + \ No newline at end of file -- cgit v1.2.3 From 56f69f774bc2a7ef645169f85b89934255c29cf9 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Mon, 22 Feb 2021 00:00:12 +0100 Subject: API call and display on DetailTopMangaActivity.kt Still need to find a way to call with the right ID. Rn, using the id 1 of monster as a "placeholder" --- app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt | 14 ----- .../java/xyz/adjutor/aniki/manga/MangaAdapter.kt | 58 ----------------- .../main/java/xyz/adjutor/aniki/manga/MangaApi.kt | 4 +- .../xyz/adjutor/aniki/manga/RestMangaResponse.kt | 14 +++++ .../xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt | 2 - .../aniki/topmanga/DetailTopMangaActivity.kt | 72 ++++++++++++++++++++-- .../xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt | 4 +- .../main/res/layout/activity_detail_top_manga.xml | 34 ++++++++-- app/src/main/res/values/strings.xml | 16 ++--- 9 files changed, 120 insertions(+), 98 deletions(-) delete mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt delete mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt create mode 100644 app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt (limited to 'app/src/main/res/values') diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt b/app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt deleted file mode 100644 index baba9f5..0000000 --- a/app/src/main/java/xyz/adjutor/aniki/manga/Manga.kt +++ /dev/null @@ -1,14 +0,0 @@ -package xyz.adjutor.aniki.manga - -import com.google.gson.annotations.SerializedName - -class Manga{ //only kept the infos I didnt have and that were interresting to me. - - @SerializedName("chapters") - var chapters: Int? = null - @SerializedName("synopsis") - var synopsis: String? = null - @SerializedName("background") - var background: String? = null //a bit of background story about the manga - -} diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt deleted file mode 100644 index ad753e2..0000000 --- a/app/src/main/java/xyz/adjutor/aniki/manga/MangaAdapter.kt +++ /dev/null @@ -1,58 +0,0 @@ -@file:Suppress("DEPRECATION") - -package xyz.adjutor.aniki.manga - -import android.content.Intent -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.cardview.widget.CardView -import androidx.recyclerview.widget.RecyclerView -import com.bumptech.glide.Glide -import com.bumptech.glide.request.RequestOptions -import xyz.adjutor.aniki.R -import xyz.adjutor.aniki.topmanga.DetailTopMangaActivity - -class MangaAdapter(val mangaList: List) : - RecyclerView.Adapter() { - - // Describes an item view and its place within the RecyclerView - class MangaViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - val mangaTitle: TextView = itemView.findViewById(R.id.tv_title) - val mangaRank: TextView = itemView.findViewById(R.id.tv_rank) - val mangaScore: TextView = itemView.findViewById(R.id.tv_score) - val mangaImage: ImageView = itemView.findViewById(R.id.iv_image) - val cardview: CardView = itemView.findViewById(R.id.cv_cardView) - - } - - // Returns a new ViewHolder - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MangaViewHolder { - val view = LayoutInflater.from(parent.context) - .inflate(R.layout.item_layout, parent, false) - - return MangaViewHolder(view) - } - - // Returns size of data list - override fun getItemCount(): Int { - return mangaList.size - } - - // Displays data at a certain position - override fun onBindViewHolder(holder: MangaViewHolder, position: Int) { - val currentManga: Manga = mangaList[position] - holder.mangaTitle.text = currentManga.title - holder.mangaRank.text = currentManga.rank.toString() - holder.mangaScore.text = currentManga.score.toString() - val image: String = currentManga.image_url.toString() - Glide - .with(holder.itemView.context) - .load(image) - .apply(RequestOptions().override(400)) - .into(holder.mangaImage) - } -} - diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt b/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt index 7692836..77304bb 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/MangaApi.kt @@ -5,7 +5,7 @@ import retrofit2.http.GET interface MangaApi { - @GET("v3/manga") - fun getMangaData(): Call + @GET("v3/manga/1") + fun getMangaData(): Call } \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt b/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt new file mode 100644 index 0000000..7a4aff9 --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt @@ -0,0 +1,14 @@ +package xyz.adjutor.aniki.manga + +import com.google.gson.annotations.SerializedName + +class RestMangaResponse{ //only kept the infos I didnt have and that were interresting to me. + + @SerializedName("chapters") + var chapters: Int? = null + @SerializedName("synopsis") + var synopsis: String? = null + @SerializedName("background") + var background: String? = null //a bit of background story about the manga + +} diff --git a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt index 4953939..d38adb2 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt @@ -1,5 +1,3 @@ -@file:Suppress("DEPRECATION") - package xyz.adjutor.aniki.topanime import android.view.LayoutInflater diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt index 27f602a..152fe4a 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt @@ -1,16 +1,34 @@ package xyz.adjutor.aniki.topmanga +import android.content.Context import android.os.Bundle +import android.view.View import android.widget.ImageView import android.widget.TextView +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions -import com.google.android.material.snackbar.Snackbar +import com.google.gson.GsonBuilder +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory import xyz.adjutor.aniki.R +import xyz.adjutor.aniki.manga.MangaApi +import xyz.adjutor.aniki.manga.RestMangaResponse class DetailTopMangaActivity : AppCompatActivity() { + var base_url = "https://api.jikan.moe/" + val gson = GsonBuilder() + .setLenient() + .create() + var manga: RestMangaResponse? = null + private val mangaId = "themangaid" private val mangaTitle = "themangatitle" private val mangaRank = "themangarank" @@ -45,11 +63,6 @@ class DetailTopMangaActivity : AppCompatActivity() { val tvStartDate: TextView = findViewById(R.id.tv_start_date) val tvEndDate: TextView = findViewById(R.id.tv_end_date) - //elements from Manga - val tvChapters: TextView = findViewById(R.id.tv_chapters) - val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) - val tvBackground: TextView = findViewById(R.id.tv_background) - tvId.text = mangaId tvTitle.text = mangaTitle tvRank.text = mangaRank @@ -63,5 +76,52 @@ class DetailTopMangaActivity : AppCompatActivity() { tvVolumes.text = mangaVolumes tvStartDate.text = mangaStartDate tvEndDate.text = mangaEndDate + + makeApiCall(base_url) + } + + private fun makeApiCall(BASE_URL: String) { + + val retrofit = Retrofit.Builder() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() + + val service = retrofit.create(MangaApi::class.java) + val call = service.getMangaData() + + call.enqueue(object : Callback { + override fun onResponse(call: Call, response: Response) { + if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty + + manga = response.body() //getting the RestMangaResponse fields + showDetail(manga!!) + + } else { + showError("API ERROR : is not successful") + } + } + + override fun onFailure(call: Call, t: Throwable) { + showError("API ERROR : onFailure") + } + + }) + } + + private fun showDetail(manga: RestMangaResponse) { + //elements from RestMangaResponse + val tvChapters: TextView = findViewById(R.id.tv_chapters) + val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) + val tvBackground: TextView = findViewById(R.id.tv_background) + + tvChapters.text = manga.chapters.toString() + tvSynopsis.text = manga.synopsis.toString() + tvBackground.text = manga.background.toString() + + } + + fun showError(text: String) { + Toast.makeText(this, text, Toast.LENGTH_LONG).show() } } \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt index 7a32dd5..c2b3567 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt @@ -1,5 +1,3 @@ -@file:Suppress("DEPRECATION") - package xyz.adjutor.aniki.topmanga import android.content.Intent @@ -53,7 +51,7 @@ class TopMangaAdapter(val mangaList: List) : .apply(RequestOptions().override(400)) .into(holder.mangaImage) - //to go to the detail page of the selected manga + //when you click on a selected cardview, some datas are sent to the other activity holder.cardview.setOnClickListener { val currentMangaId = "themangaid" val currentMangaTitle = "themangatitle" diff --git a/app/src/main/res/layout/activity_detail_top_manga.xml b/app/src/main/res/layout/activity_detail_top_manga.xml index b9a5dd7..ffb9791 100644 --- a/app/src/main/res/layout/activity_detail_top_manga.xml +++ b/app/src/main/res/layout/activity_detail_top_manga.xml @@ -104,9 +104,10 @@ android:id="@+id/cv_more_infos" android:layout_width="match_parent" android:layout_height="wrap_content" - app:layout_constraintTop_toBottomOf="@id/cv_header" android:layout_margin="4sp" - app:cardBackgroundColor="@color/black"> + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_header"> + + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@id/tv_volumes" /> + + + + + + app:layout_constraintTop_toBottomOf="@id/tv_text_synopsis"/> @@ -226,6 +239,15 @@ android:layout_height="match_parent" android:padding="10dp"> + + + app:layout_constraintTop_toBottomOf="@id/tv_text_background"/> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 100335d..311e39b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -17,17 +17,19 @@ 00.00 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - "MAL ID : " - "Rank : " - "Score : " + "MAL ID " + "Rank " + "Score " 000 - "Volumes : " - "Chapters: " + "Volumes " + "Chapters " 0000 - "Start date : " - "End date : " + "Start date " + "End date " Jan 0000 Dec 0000 Cras molestie turpis at lorem rutrum vehicula. Fusce rutrum, enim sed laoreet semper, tortor quam semper dui, id bibendum lacus quam vitae neque. + Synopsis + Background \ No newline at end of file -- cgit v1.2.3 From b54b731b3333e3e7936a15ccff925ff8a203dd53 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Mon, 22 Feb 2021 18:47:30 +0100 Subject: Removed justification and added links. Justification cropped the text, decided to get rid of it. Added a url to MAL, it's clickable. --- .../aniki/topmanga/DetailTopMangaActivity.kt | 5 +++ .../java/xyz/adjutor/aniki/topmanga/TopManga.kt | 2 + .../xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt | 2 + .../main/res/layout/activity_detail_top_manga.xml | 44 +++++++++++++++++++--- app/src/main/res/values/strings.xml | 2 + 5 files changed, 50 insertions(+), 5 deletions(-) (limited to 'app/src/main/res/values') diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt index 5950352..70e1422 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt @@ -38,6 +38,7 @@ class DetailTopMangaActivity : AppCompatActivity() { private val intentMangaVolumes = "themangavolumes" private val intentMangaStartDate = "themangastartdate" private val intentMangaEndDate = "themangaenddate" + private val intentMangaUrl = "themangaurl" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -54,6 +55,7 @@ class DetailTopMangaActivity : AppCompatActivity() { val mangaVolumes = intent.getStringExtra(intentMangaVolumes) val mangaStartDate = intent.getStringExtra(intentMangaStartDate) val mangaEndDate = intent.getStringExtra(intentMangaEndDate) + val mangaUrl = intent.getStringExtra(intentMangaUrl) val tvId: TextView = findViewById(R.id.tv_detail_id) val tvTitle: TextView = findViewById(R.id.tv_detail_title) @@ -64,6 +66,7 @@ class DetailTopMangaActivity : AppCompatActivity() { val tvVolumes: TextView = findViewById(R.id.tv_volumes) val tvStartDate: TextView = findViewById(R.id.tv_start_date) val tvEndDate: TextView = findViewById(R.id.tv_end_date) + val tvUrl: TextView = findViewById(R.id.tv_url) tvId.text = mangaId tvTitle.text = mangaTitle @@ -90,6 +93,8 @@ class DetailTopMangaActivity : AppCompatActivity() { fieldIsNull() } + tvUrl.text = mangaUrl + val manga: RestMangaResponse? = getDataFromCache(mangaId.toString()) if(manga != null ){ showDetail(manga) diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopManga.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopManga.kt index 0f73dd4..05f4692 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopManga.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopManga.kt @@ -11,6 +11,8 @@ class TopManga{ var rank: Int? = null @SerializedName("title") var title: String? = null + @SerializedName("url") + var url: String? = null @SerializedName("volumes") var volumes: Int? = null @SerializedName("start_date") diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt index c6fde13..d64a744 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt @@ -61,6 +61,7 @@ class TopMangaAdapter(val mangaList: List) : val currentMangaVolumes = "themangavolumes" val currentMangaStartDate = "themangastartdate" val currentMangaEndDate = "themangaenddate" + val currentMangaUrl = "themangaurl" val intent: Intent = Intent(holder.itemView.context, DetailTopMangaActivity::class.java).apply { putExtra(currentMangaId, currentManga.mal_id.toString()) @@ -71,6 +72,7 @@ class TopMangaAdapter(val mangaList: List) : putExtra(currentMangaVolumes, currentManga.volumes.toString()) putExtra(currentMangaStartDate, currentManga.start_date) putExtra(currentMangaEndDate, currentManga.end_date.toString()) + putExtra(currentMangaUrl, currentManga.url.toString()) } holder.itemView.context.startActivity(intent) } diff --git a/app/src/main/res/layout/activity_detail_top_manga.xml b/app/src/main/res/layout/activity_detail_top_manga.xml index dfeb8ba..6d069c9 100644 --- a/app/src/main/res/layout/activity_detail_top_manga.xml +++ b/app/src/main/res/layout/activity_detail_top_manga.xml @@ -222,18 +222,18 @@ android:id="@+id/tv_synopsis" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:justificationMode="inter_word" android:text="@string/synopsis" android:textColor="@color/slightly_desaturated_magenta" android:textIsSelectable="true" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_text_synopsis" - tools:targetApi="o" /> + /> + app:layout_constraintTop_toBottomOf="@id/tv_text_background" /> + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 311e39b..a730c17 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,5 +31,7 @@ Cras molestie turpis at lorem rutrum vehicula. Fusce rutrum, enim sed laoreet semper, tortor quam semper dui, id bibendum lacus quam vitae neque. Synopsis Background + "More info at" + https://myanimelist.net/media/id/name \ No newline at end of file -- cgit v1.2.3 From e79bf68553676c9be09f4616aadcd522149c506e Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Mon, 22 Feb 2021 19:51:27 +0100 Subject: Detail is now working for animes --- app/src/main/AndroidManifest.xml | 4 + .../main/java/xyz/adjutor/aniki/anime/AnimeApi.kt | 2 +- .../aniki/topanime/DetailTopAnimeActivity.kt | 179 +++++++++++++ .../java/xyz/adjutor/aniki/topanime/TopAnime.kt | 4 +- .../xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt | 43 ++- .../xyz/adjutor/aniki/topanime/TopAnimePage.kt | 6 +- .../aniki/topmanga/DetailTopMangaActivity.kt | 2 +- .../xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt | 6 +- .../xyz/adjutor/aniki/topmanga/TopMangaPage.kt | 2 +- .../main/res/layout/activity_detail_top_anime.xml | 287 +++++++++++++++++++++ app/src/main/res/values/strings.xml | 2 + 11 files changed, 518 insertions(+), 19 deletions(-) create mode 100644 app/src/main/java/xyz/adjutor/aniki/topanime/DetailTopAnimeActivity.kt create mode 100644 app/src/main/res/layout/activity_detail_top_anime.xml (limited to 'app/src/main/res/values') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5316b25..09802b7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,6 +17,10 @@ android:name=".topmanga.DetailTopMangaActivity" android:label="Details" android:theme="@style/Theme.Aniki" /> + + fun getAnimeData(@Path("id") id: String): Call } \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/topanime/DetailTopAnimeActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topanime/DetailTopAnimeActivity.kt new file mode 100644 index 0000000..383c73e --- /dev/null +++ b/app/src/main/java/xyz/adjutor/aniki/topanime/DetailTopAnimeActivity.kt @@ -0,0 +1,179 @@ +package xyz.adjutor.aniki.topanime + +import android.content.Context +import android.content.SharedPreferences +import android.os.Bundle +import android.widget.ImageView +import android.widget.TextView +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import com.bumptech.glide.Glide +import com.bumptech.glide.request.RequestOptions +import com.google.gson.GsonBuilder +import com.google.gson.reflect.TypeToken +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response +import retrofit2.Retrofit +import retrofit2.converter.gson.GsonConverterFactory +import xyz.adjutor.aniki.R +import xyz.adjutor.aniki.anime.AnimeApi +import xyz.adjutor.aniki.anime.RestAnimeResponse +import java.lang.reflect.Type + +class DetailTopAnimeActivity : AppCompatActivity() { + + private var baseUrl = "https://api.jikan.moe/" + var sharedPreferences: SharedPreferences? = null + private val gson = GsonBuilder() + .setLenient() + .create() + + private val intentAnimeId = "theanimeid" + private val intentAnimeTitle = "theanimetitle" + private val intentAnimeRank = "theanimerank" + private val intentAnimeScore = "theanimescore" + private val intentAnimeImageUrl = "theanimeimageurl" + + private val intentAnimeEpisodes = "theanimeepisodes" + private val intentAnimeStartDate = "theanimestartdate" + private val intentAnimeEndDate = "theanimeenddate" + private val intentAnimeUrl = "theanimeurl" + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_detail_top_anime) + + sharedPreferences = this.getSharedPreferences("sp_anime", Context.MODE_PRIVATE) + + val animeId = intent.getStringExtra(intentAnimeId) + val animeTitle = intent.getStringExtra(intentAnimeTitle) + val animeRank = intent.getStringExtra(intentAnimeRank) + val animeScore = intent.getStringExtra(intentAnimeScore) + val animeImageUrl = intent.getStringExtra(intentAnimeImageUrl) + + val animeEpisodes = intent.getStringExtra(intentAnimeEpisodes) + val animeStartDate = intent.getStringExtra(intentAnimeStartDate) + val animeEndDate = intent.getStringExtra(intentAnimeEndDate) + val animeUrl = intent.getStringExtra(intentAnimeUrl) + + val tvId: TextView = findViewById(R.id.tv_detail_id) + val tvTitle: TextView = findViewById(R.id.tv_detail_title) + val tvRank: TextView = findViewById(R.id.tv_detail_rank) + val tvScore: TextView = findViewById(R.id.tv_detail_score) + val ivImage: ImageView = findViewById(R.id.iv_detail_image) + + val tvEpisodes: TextView = findViewById(R.id.tv_episodes) + val tvStartDate: TextView = findViewById(R.id.tv_start_date) + val tvEndDate: TextView = findViewById(R.id.tv_end_date) + val tvUrl: TextView = findViewById(R.id.tv_url) + + tvId.text = animeId + tvTitle.text = animeTitle + tvRank.text = animeRank + tvScore.text = animeScore + Glide + .with(this) + .load(animeImageUrl) + .apply(RequestOptions().override(400)) + .into(ivImage) + + //using null as a string because it has been converted to a string before + tvEpisodes.text = if (animeEpisodes != "null"){ + animeEpisodes + } else { + fieldIsNull() + } + + tvStartDate.text = animeStartDate + + tvEndDate.text = if (animeEndDate != "null"){ + animeEndDate + } else { + fieldIsNull() + } + + tvUrl.text = animeUrl + + val anime: RestAnimeResponse? = getDataFromCache(animeId.toString()) + if(anime != null ){ + showDetail(anime) + } else { + //taking the API's fields I want and displaying them + makeApiCall(baseUrl, animeId.toString()) + } + + } + + private fun getDataFromCache(animeId: String): RestAnimeResponse? { + val jsonAnime: String?= sharedPreferences?.getString(animeId, null) + + return if(jsonAnime == null) { + null + } else { + val type: Type = object : TypeToken() {}.type + gson.fromJson(jsonAnime, type) + } + } + + private fun makeApiCall(BASE_URL: String, animeId: String) { + + val retrofit = Retrofit.Builder() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() + + val service = retrofit.create(AnimeApi::class.java) + val call = service.getAnimeData(animeId) //based on the id + + call.enqueue(object : Callback { + override fun onResponse(call: Call, response: Response) { + if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty + + val anime = response.body() //getting the RestAnimeResponse fields + saveList(anime) + showDetail(anime!!) + + } else { + showError("API ERROR : is not successful") + } + } + + override fun onFailure(call: Call, t: Throwable) { + showError("API ERROR : onFailure") + } + + }) + } + + private fun showDetail(anime: RestAnimeResponse) { + //elements from RestAnimeResponse + val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) + val tvBackground: TextView = findViewById(R.id.tv_background) + + tvSynopsis.text = anime.synopsis.toString() + + tvBackground.text = if (anime.background != null){ + anime.background.toString() + } else { + fieldIsNull() + } + + } + + fun showError(text: String) { + Toast.makeText(this, text, Toast.LENGTH_LONG).show() + } + private fun fieldIsNull(): String{ + return "Unknown" + } + + fun saveList(anime: RestAnimeResponse?) { + val jsonString: String = gson.toJson(anime) + + sharedPreferences + ?.edit() + ?.putString(anime?.mal_id.toString(), jsonString) + ?.apply() + } +} \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt index e063ad1..1764878 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnime.kt @@ -11,8 +11,10 @@ class TopAnime{ var rank: Int? = null @SerializedName("title") var title: String? = null + @SerializedName("url") + var url: String? = null @SerializedName("episodes") - var volumes: Int? = null + var episodes: Int? = null @SerializedName("start_date") var start_date: String? = null @SerializedName("end_date") diff --git a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt index d38adb2..e5a2bb5 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimeAdapter.kt @@ -1,16 +1,18 @@ package xyz.adjutor.aniki.topanime +import android.content.Intent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView +import androidx.cardview.widget.CardView import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions import xyz.adjutor.aniki.R -class TopAnimeAdapter(val animeList: List) : +class TopAnimeAdapter(private val animeList: List) : RecyclerView.Adapter() { // Describes an item view and its place within the RecyclerView @@ -19,6 +21,7 @@ class TopAnimeAdapter(val animeList: List) : val animeRank: TextView = itemView.findViewById(R.id.tv_rank) val animeScore: TextView = itemView.findViewById(R.id.tv_score) val animeImage: ImageView = itemView.findViewById(R.id.iv_image) + val cardview: CardView = itemView.findViewById(R.id.cv_cardView) } // Returns a new ViewHolder @@ -40,13 +43,37 @@ class TopAnimeAdapter(val animeList: List) : holder.animeTitle.text = currentAnime.title holder.animeRank.text = currentAnime.rank.toString() holder.animeScore.text = currentAnime.score.toString() - val image : String = currentAnime.image_url.toString() + val image: String = currentAnime.image_url.toString() Glide - .with(holder.itemView.context) - .load(image) - .apply(RequestOptions().override(400)) - .into(holder.animeImage) - } + .with(holder.itemView.context) + .load(image) + .apply(RequestOptions().override(400)) + .into(holder.animeImage) -} + //when you click on a selected cardview, some datas are sent to the other activity + holder.cardview.setOnClickListener { + val currentAnimeId = "theanimeid" + val currentAnimeTitle = "theanimetitle" + val currentAnimeRank = "theanimerank" + val currentAnimeScore = "theanimescore" + val currentAnimeImageUrl = "theanimeimageurl" + val currentAnimeEpisodes = "theanimeepisodes" + val currentAnimeStartDate = "theanimestartdate" + val currentAnimeEndDate = "theanimeenddate" + val currentAnimeUrl = "theanimeurl" + val intent: Intent = Intent(holder.itemView.context, DetailTopAnimeActivity::class.java).apply { + putExtra(currentAnimeId, currentAnime.mal_id.toString()) + putExtra(currentAnimeTitle, currentAnime.title) + putExtra(currentAnimeRank, currentAnime.rank.toString()) + putExtra(currentAnimeScore, currentAnime.score.toString()) + putExtra(currentAnimeImageUrl, currentAnime.image_url.toString()) + putExtra(currentAnimeEpisodes, currentAnime.episodes.toString()) + putExtra(currentAnimeStartDate, currentAnime.start_date) + putExtra(currentAnimeEndDate, currentAnime.end_date.toString()) + putExtra(currentAnimeUrl, currentAnime.url.toString()) + } + holder.itemView.context.startActivity(intent) + } + } +} \ No newline at end of file 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 53dca8a..f2d5e4c 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topanime/TopAnimePage.kt @@ -37,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? = getDataFromCache() if(animeList != null ){ @@ -94,9 +94,9 @@ class TopAnimePage : Fragment() { override fun onResponse(call: Call, response: Response) { 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 = 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 diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt index 70e1422..2b1fac4 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt @@ -44,7 +44,7 @@ class DetailTopMangaActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_detail_top_manga) - sharedPreferences = this.getSharedPreferences("app_aniki", Context.MODE_PRIVATE) + sharedPreferences = this.getSharedPreferences("sp_manga", Context.MODE_PRIVATE) val mangaId = intent.getStringExtra(intentMangaId) val mangaTitle = intent.getStringExtra(intentMangaTitle) diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt index d64a744..0396b3d 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt @@ -12,7 +12,7 @@ import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions import xyz.adjutor.aniki.R -class TopMangaAdapter(val mangaList: List) : +class TopMangaAdapter(private val mangaList: List) : RecyclerView.Adapter() { // Describes an item view and its place within the RecyclerView @@ -22,7 +22,6 @@ class TopMangaAdapter(val mangaList: List) : val mangaScore: TextView = itemView.findViewById(R.id.tv_score) val mangaImage: ImageView = itemView.findViewById(R.id.iv_image) val cardview: CardView = itemView.findViewById(R.id.cv_cardView) - } // Returns a new ViewHolder @@ -77,5 +76,4 @@ class TopMangaAdapter(val mangaList: List) : holder.itemView.context.startActivity(intent) } } -} - +} \ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt index c560ffd..f99cd9a 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaPage.kt @@ -37,7 +37,7 @@ class TopMangaPage : Fragment() { // Inflate the layout for this fragment val view = inflater.inflate(R.layout.top_manga_page, container, false) - sharedPreferences = view.context.getSharedPreferences("app_aniki", Context.MODE_PRIVATE) + sharedPreferences = view.context.getSharedPreferences("sp_manga", Context.MODE_PRIVATE) val mangaList: List? = getDataFromCache() if(mangaList != null ){ diff --git a/app/src/main/res/layout/activity_detail_top_anime.xml b/app/src/main/res/layout/activity_detail_top_anime.xml new file mode 100644 index 0000000..6afa6ad --- /dev/null +++ b/app/src/main/res/layout/activity_detail_top_anime.xml @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a730c17..bb9520a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -33,5 +33,7 @@ Background "More info at" https://myanimelist.net/media/id/name + "Episodes " + 0000 \ No newline at end of file -- cgit v1.2.3