Show icon when chapter is bookmarked

This commit is contained in:
arkon 2020-05-07 23:03:22 -04:00
parent d86d861e4b
commit ce6848b3c0
2 changed files with 25 additions and 5 deletions

View File

@ -8,7 +8,9 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import eu.kanade.tachiyomi.util.view.visibleIf
import java.util.Date 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_description
import kotlinx.android.synthetic.main.chapters_item.chapter_title import kotlinx.android.synthetic.main.chapters_item.chapter_title
import kotlinx.android.synthetic.main.chapters_item.download_text import kotlinx.android.synthetic.main.chapters_item.download_text
@ -30,12 +32,15 @@ class ChapterHolder(
} }
// Set correct text color // 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_title.setTextColor(chapterColor)
chapter_description.setTextColor(chapterColor) chapter_description.setTextColor(chapterColor)
if (chapter.bookmark) {
chapter_title.setTextColor(adapter.bookmarkedColor) bookmark_icon.visibleIf { chapter.bookmark }
}
val descriptions = mutableListOf<CharSequence>() val descriptions = mutableListOf<CharSequence>()

View File

@ -8,6 +8,21 @@
android:paddingStart="16dp" android:paddingStart="16dp"
android:paddingEnd="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 <TextView
android:id="@+id/chapter_title" android:id="@+id/chapter_title"
style="@style/TextAppearance.Regular.Body1" style="@style/TextAppearance.Regular.Body1"
@ -17,7 +32,7 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toEndOf="@+id/bookmark_icon"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Title" /> tools:text="Title" />