diff --git a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchResult.kt b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchResult.kt index 6b0d9df5b..3a629839b 100644 --- a/app/src/main/java/io/legado/app/ui/book/searchContent/SearchResult.kt +++ b/app/src/main/java/io/legado/app/ui/book/searchContent/SearchResult.kt @@ -1,9 +1,11 @@ package io.legado.app.ui.book.searchContent import android.text.Spanned -import android.util.Log import androidx.core.text.HtmlCompat -import io.legado.app.ui.book.read.page.entities.TextPage +import io.legado.app.App +import io.legado.app.R +import io.legado.app.utils.getCompatColor +import io.legado.app.utils.hexString data class SearchResult( var index: Int = 0, @@ -23,12 +25,13 @@ data class SearchResult( "($chapterTitle)" } - fun colorPresentText(position: Int, center: String, targetText: String): String{ + fun colorPresentText(position: Int, center: String, targetText: String): String { val sub1 = text.substring(0, position) val sub2 = text.substring(position + center.length, targetText.length) - return "$sub1" + + val textColor = App.INSTANCE.getCompatColor(R.color.primaryText).hexString + return "$sub1" + "$center" + - "$sub2" + "$sub2" } fun parseText(targetText: String): Spanned {