From 9a801cfdfba407634532a5ceac0170a9f4716447 Mon Sep 17 00:00:00 2001 From: Gauthier Date: Tue, 25 May 2021 21:03:56 +0800 Subject: [PATCH] Hide the score display on the tracksheet if not supported (#5169) * hide the score display on the tracksheet if not supported * Convert track item to use LinearLayout Co-authored-by: Andreas E --- .../tachiyomi/ui/manga/track/TrackHolder.kt | 21 ++--- app/src/main/res/layout/track_item.xml | 82 ++++++++----------- app/src/main/res/values/strings.xml | 1 - 3 files changed, 44 insertions(+), 60 deletions(-) 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 2afc1ba3f..d00d62a39 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 @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.manga.track import android.annotation.SuppressLint import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView -import eu.kanade.tachiyomi.R.string import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.TrackItemBinding import uy.kohesive.injekt.injectLazy @@ -43,18 +42,22 @@ class TrackHolder(private val binding: TrackItemBinding, adapter: TrackAdapter) binding.trackSet.isVisible = track == null binding.trackTitle.isVisible = track != null - binding.trackDetails.isVisible = track != null + binding.topDivider.isVisible = track != null + binding.middleRow.isVisible = track != null + binding.bottomDivider.isVisible = track != null + binding.bottomRow.isVisible = track != null + if (track != null) { binding.trackTitle.text = track.title binding.trackChapters.text = "${track.last_chapter_read}/" + if (track.total_chapters > 0) track.total_chapters else "-" binding.trackStatus.text = item.service.getStatus(track.status) - binding.trackScore.text = if (track.score == 0f) "-" else item.service.displayScore(track) + if (item.service.getScoreList().isEmpty()) { - with(binding.trackScore) { - text = context.getString(string.score_unsupported) - isEnabled = false - } + binding.trackScore.isVisible = false + binding.vertDivider2.isVisible = false + } else { + binding.trackScore.text = if (track.score == 0f) "-" else item.service.displayScore(track) } if (item.service.supportsReadingDates) { @@ -64,9 +67,7 @@ class TrackHolder(private val binding: TrackItemBinding, adapter: TrackAdapter) if (track.finished_reading_date != 0L) dateFormat.format(track.finished_reading_date) else "-" } else { binding.bottomDivider.isVisible = false - binding.vertDivider3.isVisible = false - binding.trackStartDate.isVisible = false - binding.trackFinishDate.isVisible = false + binding.bottomRow.isVisible = false } } } diff --git a/app/src/main/res/layout/track_item.xml b/app/src/main/res/layout/track_item.xml index 7325d4b36..0dbf1bece 100644 --- a/app/src/main/res/layout/track_item.xml +++ b/app/src/main/res/layout/track_item.xml @@ -67,24 +67,22 @@ - + + - - + android:background="?android:attr/textColorHint"/> - + + + + + + app:layout_constraintBottom_toBottomOf="parent" /> - + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a0444d899..a6614d88e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -623,7 +623,6 @@ Invalid date supplied MAL login credentials not found Please login to MAL again - Not supported Source is not supported No match found