mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Show icon when chapter is bookmarked
This commit is contained in:
		| @@ -8,7 +8,9 @@ import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.download.model.Download | ||||
| import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder | ||||
| import eu.kanade.tachiyomi.util.view.visibleIf | ||||
| import java.util.Date | ||||
| import kotlinx.android.synthetic.main.chapters_item.bookmark_icon | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_description | ||||
| import kotlinx.android.synthetic.main.chapters_item.chapter_title | ||||
| import kotlinx.android.synthetic.main.chapters_item.download_text | ||||
| @@ -30,12 +32,15 @@ class ChapterHolder( | ||||
|         } | ||||
|  | ||||
|         // Set correct text color | ||||
|         val chapterColor = if (chapter.read) adapter.readColor else adapter.unreadColor | ||||
|         val chapterColor = when { | ||||
|             chapter.read -> adapter.readColor | ||||
|             chapter.bookmark -> adapter.bookmarkedColor | ||||
|             else -> adapter.unreadColor | ||||
|         } | ||||
|         chapter_title.setTextColor(chapterColor) | ||||
|         chapter_description.setTextColor(chapterColor) | ||||
|         if (chapter.bookmark) { | ||||
|             chapter_title.setTextColor(adapter.bookmarkedColor) | ||||
|         } | ||||
|  | ||||
|         bookmark_icon.visibleIf { chapter.bookmark } | ||||
|  | ||||
|         val descriptions = mutableListOf<CharSequence>() | ||||
|  | ||||
|   | ||||
| @@ -8,6 +8,21 @@ | ||||
|     android:paddingStart="16dp" | ||||
|     android:paddingEnd="16dp"> | ||||
|  | ||||
|     <ImageView | ||||
|         android:id="@+id/bookmark_icon" | ||||
|         android:layout_width="16dp" | ||||
|         android:layout_height="0dp" | ||||
|         android:layout_marginTop="12dp" | ||||
|         android:layout_marginEnd="4dp" | ||||
|         android:visibility="gone" | ||||
|         app:layout_constraintBottom_toBottomOf="@id/chapter_title" | ||||
|         app:layout_constraintEnd_toStartOf="@id/chapter_title" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         app:srcCompat="@drawable/ic_bookmark_24dp" | ||||
|         app:tint="?attr/colorAccent" | ||||
|         tools:visibility="visible" /> | ||||
|  | ||||
|     <TextView | ||||
|         android:id="@+id/chapter_title" | ||||
|         style="@style/TextAppearance.Regular.Body1" | ||||
| @@ -17,7 +32,7 @@ | ||||
|         android:ellipsize="end" | ||||
|         android:maxLines="1" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
|         app:layout_constraintStart_toEndOf="@+id/bookmark_icon" | ||||
|         app:layout_constraintTop_toTopOf="parent" | ||||
|         tools:text="Title" /> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user