diff options
author | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-05-19 10:12:39 +0200 |
---|---|---|
committer | Clyhtsuriva <aimeric@adjutor.xyz> | 2021-05-19 10:12:39 +0200 |
commit | cccf03dbafbb5605f530e14912dfa15418d22db0 (patch) | |
tree | 366dcab01a2a6ab40fed72cc25cf1bb4368c9589 /app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/DetailSearchMangaActivity.kt | |
parent | 67be76376ab6263ec1d97ea68d561bf90844df9d (diff) | |
parent | 8ede9457fd21ac5e272e73f5ece1d4bc9c23faab (diff) |
Merge branch 'release/3.2'v3.2.0
Diffstat (limited to 'app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/DetailSearchMangaActivity.kt')
-rw-r--r-- | app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/DetailSearchMangaActivity.kt | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/DetailSearchMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/DetailSearchMangaActivity.kt deleted file mode 100644 index 83beb9b..0000000 --- a/app/src/main/java/xyz/adjutor/aniki/presentation/view/manga/DetailSearchMangaActivity.kt +++ /dev/null @@ -1,130 +0,0 @@ -package xyz.adjutor.aniki.presentation.view.manga - -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 xyz.adjutor.aniki.R -import xyz.adjutor.aniki.presentation.controller.manga.DetailSearchMangaController -import xyz.adjutor.aniki.presentation.model.manga.MangaResponse - -class DetailSearchMangaActivity : AppCompatActivity() { - - lateinit var controller: DetailSearchMangaController - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_detail_search_manga) - - controller = DetailSearchMangaController() - - //used in the list - val intentMangaImageUrl = "themangaimageurl" - val intentMangaTitle = "themangatitle" - val intentMangaScore = "themangascore" - - //only used for the detail - val intentMangaId = "themangaid" - val intentMangaUrl = "themangaurl" - val intentMangaChapters = "themangachapters" - val intentMangaVolumes = "themangavolumes" - val intentMangaStartDate = "themangastartdate" - val intentMangaEndDate = "themangaenddate" - - val mangaImageUrl = intent.getStringExtra(intentMangaImageUrl) - val mangaTitle = intent.getStringExtra(intentMangaTitle) - val mangaScore = intent.getStringExtra(intentMangaScore) - - val mangaId = intent.getStringExtra(intentMangaId) - val mangaUrl = intent.getStringExtra(intentMangaUrl) - val mangaChapters = intent.getStringExtra(intentMangaChapters) - val mangaVolumes = intent.getStringExtra(intentMangaVolumes) - val mangaStartDate = intent.getStringExtra(intentMangaStartDate) - val mangaEndDate = intent.getStringExtra(intentMangaEndDate) - - - val ivImage: ImageView = findViewById(R.id.iv_detail_image) - val tvTitle: TextView = findViewById(R.id.tv_detail_title) - val tvScore: TextView = findViewById(R.id.tv_detail_score) - - val tvId: TextView = findViewById(R.id.tv_detail_id) - val tvUrl: TextView = findViewById(R.id.tv_url) - val tvChapters: TextView = findViewById(R.id.tv_chapters) - 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) - - Glide - .with(this) - .load(mangaImageUrl) - .apply(RequestOptions().override(400)) - .into(ivImage) - tvTitle.text = mangaTitle - tvScore.text = mangaScore - - - tvId.text = mangaId - tvUrl.text = mangaUrl - - //using null as a string because it has been converted to a string before - tvChapters.text = if (mangaChapters != "null") { - mangaChapters - } else { - fieldIsNull() - } - - tvVolumes.text = if (mangaVolumes != "null") { - mangaVolumes - } else { - fieldIsNull() - } - - tvStartDate.text = splitDate(mangaStartDate!!) - - tvEndDate.text = if (mangaEndDate != "null") { - splitDate(mangaEndDate!!) - } else { - fieldIsNull() - } - - controller.onStart(this, mangaId.toString()) - - } - - private fun splitDate(mangaDate: String): CharSequence { - val delimiter = "T" - return mangaDate - .split(delimiter) //split between the date and the time - .toTypedArray()[0] //convert it to an array and take the first string - - } - - fun showDetail(manga: MangaResponse) { - //elements from MangaResponse - val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) - val tvRank: TextView = findViewById(R.id.tv_detail_rank) - val tvBackground: TextView = findViewById(R.id.tv_background) - - tvSynopsis.text = manga.synopsis.toString() - - tvRank.text = manga.rank.toString() - - tvBackground.text = if (manga.background != null) { - manga.background.toString() - } else { - fieldIsNull() - } - - } - - fun showError(text: String) { - Toast.makeText(this, text, Toast.LENGTH_LONG).show() - } - - private fun fieldIsNull(): String { - return "Unknown" - } -}
\ No newline at end of file |