Tweak tracking card UI

This commit is contained in:
arkon 2020-04-12 22:00:19 -04:00
parent aedb4749a2
commit a0a8899801
3 changed files with 132 additions and 129 deletions

View File

@ -4,16 +4,14 @@ import android.annotation.SuppressLint
import android.view.View
import eu.kanade.tachiyomi.ui.base.holder.BaseViewHolder
import eu.kanade.tachiyomi.util.view.visibleIf
import kotlinx.android.synthetic.main.track_item.chapters_container
import kotlinx.android.synthetic.main.track_item.logo_container
import kotlinx.android.synthetic.main.track_item.score_container
import kotlinx.android.synthetic.main.track_item.status_container
import kotlinx.android.synthetic.main.track_item.track_chapters
import kotlinx.android.synthetic.main.track_item.track_details
import kotlinx.android.synthetic.main.track_item.track_logo
import kotlinx.android.synthetic.main.track_item.track_score
import kotlinx.android.synthetic.main.track_item.track_set
import kotlinx.android.synthetic.main.track_item.track_status
import kotlinx.android.synthetic.main.track_item.track_title
class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
@ -22,9 +20,10 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
logo_container.setOnClickListener { listener.onLogoClick(adapterPosition) }
track_set.setOnClickListener { listener.onSetClick(adapterPosition) }
status_container.setOnClickListener { listener.onStatusClick(adapterPosition) }
chapters_container.setOnClickListener { listener.onChaptersClick(adapterPosition) }
score_container.setOnClickListener { listener.onScoreClick(adapterPosition) }
track_title.setOnClickListener { listener.onSetClick(adapterPosition) }
track_status.setOnClickListener { listener.onStatusClick(adapterPosition) }
track_chapters.setOnClickListener { listener.onChaptersClick(adapterPosition) }
track_score.setOnClickListener { listener.onScoreClick(adapterPosition) }
}
@SuppressLint("SetTextI18n")
@ -33,8 +32,12 @@ class TrackHolder(view: View, adapter: TrackAdapter) : BaseViewHolder(view) {
track_logo.setImageResource(item.service.getLogo())
logo_container.setBackgroundColor(item.service.getLogoColor())
track_set.visibleIf { track == null }
track_title.visibleIf { track != null }
track_details.visibleIf { track != null }
if (track != null) {
track_title.text = track.title
track_chapters.text = "${track.last_chapter_read}/" +
if (track.total_chapters > 0) track.total_chapters else "-"
track_status.text = item.service.getStatus(track.status)

View File

@ -6,6 +6,11 @@
style="@style/Theme.Widget.CardView.Item"
android:padding="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -14,149 +19,143 @@
<LinearLayout
android:id="@+id/logo_container"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="vertical"
android:orientation="horizontal"
android:padding="4dp"
tools:background="#2E51A2">
<ImageView
android:id="@+id/track_logo"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:src="@drawable/ic_tracker_mal" />
<ImageButton
android:id="@+id/track_set"
android:layout_width="wrap_content"
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_edit"
android:padding="8dp"
app:srcCompat="@drawable/ic_edit_24dp"
app:tint="@color/md_white_1000_50" />
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/track_set"
style="@style/Theme.Widget.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/add_tracking"
android:visibility="gone" />
<TextView
android:id="@+id/track_title"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_item_selector"
android:ellipsize="end"
android:maxLines="1"
android:padding="16dp"
tools:text="Title" />
</LinearLayout>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/track_details"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="@+id/status_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_item_selector"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/status" />
<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="16dp"
android:ellipsize="end"
android:maxLines="1"
tools:text="Reading" />
</LinearLayout>
android:layout_height="wrap_content">
<View
android:id="@+id/divider"
android:id="@+id/top_divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:alpha="0.25"
android:background="?android:attr/textColorHint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status_container" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider">
<LinearLayout
android:id="@+id/chapters_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/list_item_selector"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:padding="16dp">
app:layout_constraintTop_toTopOf="parent" />
<TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content"
android:id="@+id/track_status"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/chapters" />
android:background="@drawable/list_item_selector"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
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_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_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_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:gravity="end"
tools:text="12/24" />
</LinearLayout>
<LinearLayout
android:id="@+id/score_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/list_item_selector"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:padding="16dp">
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
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" />
<TextView
style="@style/TextAppearance.Regular.Body1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/score" />
<View
android:id="@+id/vert_divider_2"
android:layout_width="1dp"
android:layout_height="0dp"
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_score"
app:layout_constraintStart_toEndOf="@+id/track_chapters"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/track_score"
style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:gravity="end"
android:background="@drawable/list_item_selector"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/vert_divider_2"
app:layout_constraintTop_toBottomOf="@+id/top_divider"
tools:text="10" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@ -459,6 +459,7 @@
<!-- Tracking Screen -->
<string name="manga_tracking_tab">Tracking</string>
<string name="add_tracking">Add tracking</string>
<string name="reading">Reading</string>
<string name="currently_reading">Currently reading</string>
<string name="completed">Completed</string>