Tweak initial tracker card appearance

This commit is contained in:
arkon 2020-01-24 12:18:55 -05:00
parent f1cca207fc
commit a746d4cc3a
3 changed files with 121 additions and 128 deletions

View File

@ -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 = ""
}
}
}

View File

@ -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,16 +29,33 @@
</FrameLayout>
<Button
android:id="@+id/track_set"
style="@style/Theme.Widget.Button.Borderless.Small"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="16dp"
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">
<LinearLayout
android:id="@+id/title_container"
android:layout_width="0dp"
android:layout_width="match_parent"
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_toTopOf="parent">
android:padding="16dp">
<TextView
style="@style/TextAppearance.Regular.Body1"
@ -48,7 +65,6 @@
<TextView
android:id="@+id/track_title"
style="@style/TextAppearance.Medium.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
@ -60,26 +76,19 @@
</LinearLayout>
<View
android:id="@+id/divider1"
android:layout_width="0dp"
android:layout_width="match_parent"
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" />
android:layout_marginEnd="16dp"
android:background="?android:attr/divider" />
<LinearLayout
android:id="@+id/status_container"
android:layout_width="0dp"
android:layout_width="match_parent"
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">
android:padding="16dp">
<TextView
style="@style/TextAppearance.Regular.Body1"
@ -99,26 +108,19 @@
</LinearLayout>
<View
android:id="@+id/divider2"
android:layout_width="0dp"
android:layout_width="match_parent"
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" />
android:layout_marginEnd="16dp"
android:background="?android:attr/divider" />
<LinearLayout
android:id="@+id/chapters_container"
android:layout_width="0dp"
android:layout_width="match_parent"
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">
android:padding="16dp">
<TextView
style="@style/TextAppearance.Regular.Body1"
@ -138,26 +140,19 @@
</LinearLayout>
<View
android:id="@+id/divider3"
android:layout_width="0dp"
android:layout_width="match_parent"
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" />
android:layout_marginEnd="16dp"
android:background="?android:attr/divider" />
<LinearLayout
android:id="@+id/score_container"
android:layout_width="0dp"
android:layout_width="match_parent"
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">
android:padding="16dp">
<TextView
style="@style/TextAppearance.Regular.Body1"
@ -176,6 +171,8 @@
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>

View File

@ -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-->
<!--=======-->