mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Tweak tracking card UI
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -9,153 +9,152 @@ | ||||
|     <LinearLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:orientation="horizontal"> | ||||
|         android:orientation="vertical"> | ||||
|  | ||||
|         <LinearLayout | ||||
|             android:id="@+id/logo_container" | ||||
|             android:layout_width="48dp" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:clickable="true" | ||||
|             android:focusable="true" | ||||
|             android:gravity="center" | ||||
|             android:orientation="vertical" | ||||
|             android:padding="4dp" | ||||
|             tools:background="#2E51A2"> | ||||
|             android:orientation="horizontal"> | ||||
|  | ||||
|             <ImageView | ||||
|                 android:id="@+id/track_logo" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="48dp" | ||||
|                 tools:src="@drawable/ic_tracker_mal" /> | ||||
|             <LinearLayout | ||||
|                 android:id="@+id/logo_container" | ||||
|                 android:layout_width="48dp" | ||||
|                 android:layout_height="match_parent" | ||||
|                 android:clickable="true" | ||||
|                 android:focusable="true" | ||||
|                 android:gravity="center" | ||||
|                 android:orientation="horizontal" | ||||
|                 android:padding="4dp" | ||||
|                 tools:background="#2E51A2"> | ||||
|  | ||||
|             <ImageButton | ||||
|                 android:id="@+id/track_set" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 <ImageView | ||||
|                     android:id="@+id/track_logo" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     tools:src="@drawable/ic_tracker_mal" /> | ||||
|  | ||||
|             </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_width="match_parent" | ||||
|             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" /> | ||||
|                 app:layout_constraintTop_toTopOf="parent" /> | ||||
|  | ||||
|             <LinearLayout | ||||
|             <TextView | ||||
|                 android:id="@+id/track_status" | ||||
|                 style="@style/TextAppearance.Regular.Body1.Secondary" | ||||
|                 android:layout_width="0dp" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:orientation="horizontal" | ||||
|                 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="0dp" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 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_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_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="0dp" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 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_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"> | ||||
|  | ||||
|                     <TextView | ||||
|                         style="@style/TextAppearance.Regular.Body1" | ||||
|                         android:layout_width="wrap_content" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:text="@string/chapters" /> | ||||
|  | ||||
|                     <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"> | ||||
|  | ||||
|                     <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="8dp" | ||||
|                         android:gravity="end" | ||||
|                         tools:text="10" /> | ||||
|  | ||||
|                 </LinearLayout> | ||||
|  | ||||
|             </LinearLayout> | ||||
|                 app:layout_constraintStart_toEndOf="@+id/vert_divider_2" | ||||
|                 app:layout_constraintTop_toBottomOf="@+id/top_divider" | ||||
|                 tools:text="10" /> | ||||
|  | ||||
|         </androidx.constraintlayout.widget.ConstraintLayout> | ||||
|  | ||||
|   | ||||
| @@ -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> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user