mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-18 23:49:18 +01:00
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 <andreas.everos@gmail.com>
This commit is contained in:
parent
4af13e3536
commit
9a801cfdfb
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,24 +67,22 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/track_details"
|
||||
<View
|
||||
android:id="@+id/top_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/middle_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/top_divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_status"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_item_selector"
|
||||
@ -92,27 +90,22 @@
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/vert_divider_1"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_divider"
|
||||
tools:text="Reading" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vert_divider_1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bottom_divider"
|
||||
app:layout_constraintEnd_toStartOf="@+id/track_chapters"
|
||||
app:layout_constraintStart_toEndOf="@+id/track_status"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_chapters"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_item_selector"
|
||||
@ -120,27 +113,21 @@
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/vert_divider_2"
|
||||
app:layout_constraintStart_toEndOf="@+id/vert_divider_1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_divider"
|
||||
tools:text="12/24" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vert_divider_2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bottom_divider"
|
||||
app:layout_constraintEnd_toStartOf="@+id/track_score"
|
||||
app:layout_constraintStart_toEndOf="@+id/track_chapters"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:background="?android:attr/textColorHint"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_score"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_item_selector"
|
||||
@ -148,24 +135,26 @@
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/vert_divider_2"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_divider"
|
||||
tools:text="10" />
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/track_score" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_start_date"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_item_selector"
|
||||
@ -173,27 +162,22 @@
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/vert_divider_3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bottom_divider"
|
||||
tools:text="4/16/2020" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vert_divider_3"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:alpha="0.25"
|
||||
android:background="?android:attr/textColorHint"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/track_finish_date"
|
||||
app:layout_constraintStart_toEndOf="@+id/track_start_date"
|
||||
app:layout_constraintTop_toTopOf="@+id/bottom_divider" />
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_finish_date"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/list_item_selector"
|
||||
@ -206,7 +190,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/bottom_divider"
|
||||
tools:text="4/16/2020" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -623,7 +623,6 @@
|
||||
<string name="error_invalid_date_supplied">Invalid date supplied</string>
|
||||
<string name="myanimelist_creds_missing">MAL login credentials not found</string>
|
||||
<string name="myanimelist_relogin">Please login to MAL again</string>
|
||||
<string name="score_unsupported">Not supported</string>
|
||||
<string name="source_unsupported">Source is not supported</string>
|
||||
<string name="error_no_match">No match found</string>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user