From 9044760a10c261fb57704602770980364491afc6 Mon Sep 17 00:00:00 2001 From: FlaminSarge Date: Fri, 10 Apr 2020 05:37:58 -0700 Subject: [PATCH] Change color of 'last page read' in chapter description (#2855) Change color of 'last page read' in chapter description --- .../tachiyomi/ui/manga/chapter/ChapterHolder.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt index ff2c017683..f92d01e6c3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt @@ -1,5 +1,8 @@ package eu.kanade.tachiyomi.ui.manga.chapter +import android.text.SpannableString +import android.text.SpannableStringBuilder +import android.text.style.ForegroundColorSpan import android.view.View import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga @@ -34,20 +37,23 @@ class ChapterHolder( chapter_title.setTextColor(adapter.bookmarkedColor) } - val descriptions = mutableListOf() + val descriptions = mutableListOf() if (chapter.date_upload > 0) { descriptions.add(adapter.dateFormat.format(Date(chapter.date_upload))) } if (!chapter.read && chapter.last_page_read > 0) { - descriptions.add(itemView.context.getString(R.string.chapter_progress, chapter.last_page_read + 1)) + val lastPageRead = SpannableString(itemView.context.getString(R.string.chapter_progress, chapter.last_page_read + 1)).apply { + setSpan(ForegroundColorSpan(adapter.bookmarkedColor), 0, length, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE) + } + descriptions.add(lastPageRead) } if (!chapter.scanlator.isNullOrBlank()) { descriptions.add(chapter.scanlator!!) } if (descriptions.isNotEmpty()) { - chapter_description.text = descriptions.joinToString(" • ") + chapter_description.text = descriptions.joinTo(SpannableStringBuilder(), " • ") } else { chapter_description.text = "" }