mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +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 android.view.View
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder
|
import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder
|
||||||
|
import eu.kanade.tachiyomi.util.visibleIf
|
||||||
import kotlinx.android.synthetic.main.track_item.*
|
import kotlinx.android.synthetic.main.track_item.*
|
||||||
|
|
||||||
class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
|
class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val listener = adapter.rowClickListener
|
val listener = adapter.rowClickListener
|
||||||
|
|
||||||
logo_container.setOnClickListener { listener.onLogoClick(adapterPosition) }
|
logo_container.setOnClickListener { listener.onLogoClick(adapterPosition) }
|
||||||
title_container.setOnClickListener { listener.onTitleClick(adapterPosition) }
|
title_container.setOnClickListener { listener.onTitleClick(adapterPosition) }
|
||||||
status_container.setOnClickListener { listener.onStatusClick(adapterPosition) }
|
status_container.setOnClickListener { listener.onStatusClick(adapterPosition) }
|
||||||
chapters_container.setOnClickListener { listener.onChaptersClick(adapterPosition) }
|
chapters_container.setOnClickListener { listener.onChaptersClick(adapterPosition) }
|
||||||
score_container.setOnClickListener { listener.onScoreClick(adapterPosition) }
|
score_container.setOnClickListener { listener.onScoreClick(adapterPosition) }
|
||||||
|
|
||||||
|
track_set.setOnClickListener { listener.onTitleClick(adapterPosition) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
@ -23,6 +27,10 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
|
|||||||
val track = item.track
|
val track = item.track
|
||||||
track_logo.setImageResource(item.service.getLogo())
|
track_logo.setImageResource(item.service.getLogo())
|
||||||
logo_container.setBackgroundColor(item.service.getLogoColor())
|
logo_container.setBackgroundColor(item.service.getLogoColor())
|
||||||
|
|
||||||
|
track_details.visibleIf { track != null }
|
||||||
|
track_set.visibleIf { track == null }
|
||||||
|
|
||||||
if (track != null) {
|
if (track != null) {
|
||||||
track_title.setTextAppearance(itemView.context, R.style.TextAppearance_Regular_Body1_Secondary)
|
track_title.setTextAppearance(itemView.context, R.style.TextAppearance_Regular_Body1_Secondary)
|
||||||
track_title.isAllCaps = false
|
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 "-"
|
if (track.total_chapters > 0) track.total_chapters else "-"
|
||||||
track_status.text = item.service.getStatus(track.status)
|
track_status.text = item.service.getStatus(track.status)
|
||||||
track_score.text = if (track.score == 0f) "-" else item.service.displayScore(track)
|
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:id="@+id/logo_container"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:clickable="true"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:clickable="true"
|
|
||||||
tools:background="#2E51A2">
|
tools:background="#2E51A2">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -29,150 +29,147 @@
|
|||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<Button
|
||||||
android:id="@+id/title_container"
|
android:id="@+id/track_set"
|
||||||
|
style="@style/Theme.Widget.Button.Borderless.Small"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectable_list_drawable"
|
|
||||||
android:clickable="true"
|
|
||||||
android:padding="16dp"
|
android:padding="16dp"
|
||||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
android:text="@string/action_edit"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
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">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
style="@style/TextAppearance.Regular.Body1"
|
android:id="@+id/title_container"
|
||||||
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"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="4dp"
|
android:background="?attr/selectable_list_drawable"
|
||||||
android:ellipsize="middle"
|
android:clickable="true"
|
||||||
android:gravity="end"
|
android:padding="16dp">
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/action_edit" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
style="@style/TextAppearance.Regular.Body1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/title" />
|
||||||
|
|
||||||
<View
|
<TextView
|
||||||
android:id="@+id/divider1"
|
android:id="@+id/track_title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginStart="4dp"
|
||||||
android:layout_marginStart="16dp"
|
android:ellipsize="middle"
|
||||||
android:background="?android:attr/divider"
|
android:gravity="end"
|
||||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
android:maxLines="1"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:text="@string/action_edit" />
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title_container" />
|
|
||||||
|
|
||||||
<LinearLayout
|
</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">
|
|
||||||
|
|
||||||
<TextView
|
<View
|
||||||
style="@style/TextAppearance.Regular.Body1"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="1dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginStart="16dp"
|
||||||
android:text="@string/status" />
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="?android:attr/divider" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/track_status"
|
android:id="@+id/status_container"
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="4dp"
|
android:background="?attr/selectable_list_drawable"
|
||||||
android:gravity="end"
|
android:clickable="true"
|
||||||
tools:text="Reading" />
|
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
|
<TextView
|
||||||
android:id="@+id/divider2"
|
android:id="@+id/track_status"
|
||||||
android:layout_width="0dp"
|
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||||
android:layout_height="1dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="4dp"
|
||||||
android:background="?android:attr/divider"
|
android:gravity="end"
|
||||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
tools:text="Reading" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/status_container" />
|
|
||||||
|
|
||||||
<LinearLayout
|
</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">
|
|
||||||
|
|
||||||
<TextView
|
<View
|
||||||
style="@style/TextAppearance.Regular.Body1"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="1dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginStart="16dp"
|
||||||
android:text="@string/chapters" />
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="?android:attr/divider" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/track_chapters"
|
android:id="@+id/chapters_container"
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="4dp"
|
android:background="?attr/selectable_list_drawable"
|
||||||
android:gravity="end"
|
android:clickable="true"
|
||||||
tools:text="12/24" />
|
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
|
<TextView
|
||||||
android:id="@+id/divider3"
|
android:id="@+id/track_chapters"
|
||||||
android:layout_width="0dp"
|
style="@style/TextAppearance.Regular.Body1.Secondary"
|
||||||
android:layout_height="1dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="4dp"
|
||||||
android:background="?android:attr/divider"
|
android:gravity="end"
|
||||||
app:layout_constraintStart_toEndOf="@+id/logo_container"
|
tools:text="12/24" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/chapters_container" />
|
|
||||||
|
|
||||||
<LinearLayout
|
</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">
|
|
||||||
|
|
||||||
<TextView
|
<View
|
||||||
style="@style/TextAppearance.Regular.Body1"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="1dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_marginStart="16dp"
|
||||||
android:text="@string/score" />
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="?android:attr/divider" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/track_score"
|
android:id="@+id/score_container"
|
||||||
style="@style/TextAppearance.Regular.Body1.Secondary"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="4dp"
|
android:background="?attr/selectable_list_drawable"
|
||||||
android:gravity="end"
|
android:clickable="true"
|
||||||
tools:text="10" />
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -129,12 +129,6 @@
|
|||||||
<item name="android:textColor">?android:attr/textColorHint</item>
|
<item name="android:textColor">?android:attr/textColorHint</item>
|
||||||
</style>
|
</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-->
|
<!--Widgets-->
|
||||||
<!--=======-->
|
<!--=======-->
|
||||||
|
Loading…
Reference in New Issue
Block a user