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. --- .../xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt | 13 ++++++++----- .../main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'app/src/main/java/xyz/adjutor/aniki/topmanga') 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()) -- cgit v1.2.3