From 466ec7b962d89e9b016343e952c744c27dd0cd04 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 9 Mar 2020 16:27:23 -0400 Subject: [PATCH] Compact tracker card --- .../tachiyomi/ui/manga/track/TrackAdapter.kt | 2 +- .../ui/manga/track/TrackController.kt | 2 +- .../tachiyomi/ui/manga/track/TrackHolder.kt | 13 +- app/src/main/res/layout/track_item.xml | 118 +++++++----------- 4 files changed, 48 insertions(+), 87 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt index a399150bd3..597e21a704 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt @@ -36,7 +36,7 @@ class TrackAdapter(controller: TrackController) : RecyclerView.Adapter(), } } - override fun onTitleClick(position: Int) { + override fun onSetClick(position: Int) { val item = adapter?.getItem(position) ?: return TrackSearchDialog(this, item.service).showDialog(router, TAG_SEARCH_CONTROLLER) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt index 767c550414..db51eeac16 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackHolder.kt @@ -2,21 +2,18 @@ package eu.kanade.tachiyomi.ui.manga.track import android.annotation.SuppressLint import android.view.View -import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder import eu.kanade.tachiyomi.util.view.visibleIf import kotlinx.android.synthetic.main.track_item.chapters_container import kotlinx.android.synthetic.main.track_item.logo_container import kotlinx.android.synthetic.main.track_item.score_container import kotlinx.android.synthetic.main.track_item.status_container -import kotlinx.android.synthetic.main.track_item.title_container import kotlinx.android.synthetic.main.track_item.track_chapters import kotlinx.android.synthetic.main.track_item.track_details import kotlinx.android.synthetic.main.track_item.track_logo import kotlinx.android.synthetic.main.track_item.track_score import kotlinx.android.synthetic.main.track_item.track_set import kotlinx.android.synthetic.main.track_item.track_status -import kotlinx.android.synthetic.main.track_item.track_title class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) { @@ -24,28 +21,20 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) { val listener = adapter.rowClickListener logo_container.setOnClickListener { listener.onLogoClick(adapterPosition) } - title_container.setOnClickListener { listener.onTitleClick(adapterPosition) } + track_set.setOnClickListener { listener.onSetClick(adapterPosition) } status_container.setOnClickListener { listener.onStatusClick(adapterPosition) } chapters_container.setOnClickListener { listener.onChaptersClick(adapterPosition) } score_container.setOnClickListener { listener.onScoreClick(adapterPosition) } - - track_set.setOnClickListener { listener.onTitleClick(adapterPosition) } } @SuppressLint("SetTextI18n") - @Suppress("DEPRECATION") fun bind(item: TrackItem) { val track = item.track track_logo.setImageResource(item.service.getLogo()) logo_container.setBackgroundColor(item.service.getLogoColor()) track_details.visibleIf { track != null } - track_set.visibleIf { track == null } - if (track != null) { - track_title.setTextAppearance(itemView.context, R.style.TextAppearance_Regular_Body1_Secondary) - track_title.isAllCaps = false - track_title.text = track.title track_chapters.text = "${track.last_chapter_read}/" + if (track.total_chapters > 0) track.total_chapters else "-" track_status.text = item.service.getStatus(track.status) diff --git a/app/src/main/res/layout/track_item.xml b/app/src/main/res/layout/track_item.xml index 07a93fbdea..5f4c952e4b 100644 --- a/app/src/main/res/layout/track_item.xml +++ b/app/src/main/res/layout/track_item.xml @@ -8,7 +8,8 @@ + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize"> -