diff options
Diffstat (limited to 'app/src/main/java/xyz/adjutor/aniki/topmanga')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt | 33 | ||||
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt | 2 |
2 files changed, 29 insertions, 6 deletions
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 b222a99..5749071 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt @@ -72,10 +72,20 @@ class DetailTopMangaActivity : AppCompatActivity() { .apply(RequestOptions().override(400)) .into(ivImage) - //not used in the recyclerview - tvVolumes.text = mangaVolumes + //using null as a string because it has been converted to a string before + tvVolumes.text = if (mangaVolumes != "null"){ + mangaVolumes + } else { + fieldIsNull() + } + tvStartDate.text = mangaStartDate - tvEndDate.text = mangaEndDate + + tvEndDate.text = if (mangaEndDate != "null"){ + mangaEndDate + } else { + fieldIsNull() + } //taking the API's fields I want and displaying them makeApiCall(baseUrl, mangaId.toString()) @@ -116,13 +126,26 @@ class DetailTopMangaActivity : AppCompatActivity() { val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) val tvBackground: TextView = findViewById(R.id.tv_background) - tvChapters.text = manga.chapters.toString() + tvChapters.text = if (manga.chapters != null){ + manga.chapters.toString() + } else { + fieldIsNull() + } + tvSynopsis.text = manga.synopsis.toString() - tvBackground.text = manga.background.toString() + + tvBackground.text = if (manga.background != null){ + manga.background.toString() + } else { + fieldIsNull() + } } fun showError(text: String) { Toast.makeText(this, text, Toast.LENGTH_LONG).show() } + fun fieldIsNull(): String{ + return "Unknown" + } }
\ 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 c2b3567..c6fde13 100644 --- a/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/TopMangaAdapter.kt @@ -70,7 +70,7 @@ class TopMangaAdapter(val mangaList: List<TopManga>) : putExtra(currentMangaImageUrl, currentManga.image_url.toString()) putExtra(currentMangaVolumes, currentManga.volumes.toString()) putExtra(currentMangaStartDate, currentManga.start_date) - putExtra(currentMangaEndDate, currentManga.end_date) + putExtra(currentMangaEndDate, currentManga.end_date.toString()) } holder.itemView.context.startActivity(intent) } |