mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-15 04:55:09 +01:00
Tweak initial tracker card appearance
This commit is contained in:
parent
f1cca207fc
commit
a746d4cc3a
@ -4,17 +4,21 @@ 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.visibleIf
|
||||
import kotlinx.android.synthetic.main.track_item.*
|
||||
|
||||
class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
|
||||
|
||||
init {
|
||||
val listener = adapter.rowClickListener
|
||||
|
||||
logo_container.setOnClickListener { listener.onLogoClick(adapterPosition) }
|
||||
title_container.setOnClickListener { listener.onTitleClick(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")
|
||||
@ -23,6 +27,10 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
|
||||
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
|
||||
@ -31,12 +39,6 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
|
||||
if (track.total_chapters > 0) track.total_chapters else "-"
|
||||
track_status.text = item.service.getStatus(track.status)
|
||||
track_score.text = if (track.score == 0f) "-" else item.service.displayScore(track)
|
||||
} else {
|
||||
track_title.setTextAppearance(itemView.context, R.style.TextAppearance_Medium_Button)
|
||||
track_title.setText(R.string.action_edit)
|
||||
track_chapters.text = ""
|
||||
track_score.text = ""
|
||||
track_status.text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@
|
||||
android:id="@+id/logo_container"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="0dp"
|
||||
android:clickable="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:clickable="true"
|
||||
tools:background="#2E51A2">
|
||||
|
||||
<ImageView
|
||||
@ -29,150 +29,147 @@
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/title_container"
|
||||
<Button
|
||||
android:id="@+id/track_set"
|
||||
style="@style/Theme.Widget.Button.Borderless.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
android:text="@string/action_edit"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/track_details"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_title"
|
||||
style="@style/TextAppearance.Medium.Button"
|
||||
<LinearLayout
|
||||
android:id="@+id/title_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:ellipsize="middle"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/action_edit" />
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="?android:attr/divider"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/title_container" />
|
||||
<TextView
|
||||
android:id="@+id/track_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:ellipsize="middle"
|
||||
android:gravity="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/action_edit" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/status_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider1">
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/status" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?android:attr/divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_status"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
<LinearLayout
|
||||
android:id="@+id/status_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="end"
|
||||
tools:text="Reading" />
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/status" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="?android:attr/divider"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status_container" />
|
||||
<TextView
|
||||
android:id="@+id/track_status"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="end"
|
||||
tools:text="Reading" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/chapters_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider2">
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chapters" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?android:attr/divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_chapters"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
<LinearLayout
|
||||
android:id="@+id/chapters_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="end"
|
||||
tools:text="12/24" />
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp">
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/chapters" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:background="?android:attr/divider"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/chapters_container" />
|
||||
<TextView
|
||||
android:id="@+id/track_chapters"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="end"
|
||||
tools:text="12/24" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/score_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/divider3">
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/score" />
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?android:attr/divider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_score"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
<LinearLayout
|
||||
android:id="@+id/score_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="end"
|
||||
tools:text="10" />
|
||||
android:background="?attr/selectable_list_drawable"
|
||||
android:clickable="true"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/score" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_score"
|
||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:gravity="end"
|
||||
tools:text="10" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -129,12 +129,6 @@
|
||||
<item name="android:textColor">?android:attr/textColorHint</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.Medium.Button">
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textColor">?attr/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<!--=======-->
|
||||
<!--Widgets-->
|
||||
<!--=======-->
|
||||
|
Loading…
Reference in New Issue
Block a user