|
|
@ -1,21 +1,12 @@ |
|
|
|
package io.legado.app.ui.book.searchContent |
|
|
|
package io.legado.app.ui.book.searchContent |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.os.Build |
|
|
|
|
|
|
|
import android.text.Html |
|
|
|
|
|
|
|
import android.util.Log |
|
|
|
|
|
|
|
import android.view.View |
|
|
|
|
|
|
|
import androidx.annotation.RequiresApi |
|
|
|
|
|
|
|
import androidx.core.text.HtmlCompat |
|
|
|
|
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.ItemViewHolder |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.SimpleRecyclerAdapter |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
|
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
|
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.getCompatColor |
|
|
|
import io.legado.app.utils.visible |
|
|
|
import io.legado.app.utils.hexString |
|
|
|
import kotlinx.android.synthetic.main.item_bookmark.view.* |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.item_search_list.view.* |
|
|
|
import kotlinx.android.synthetic.main.item_search_list.view.* |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
import org.jetbrains.anko.sdk27.listeners.onClick |
|
|
|
|
|
|
|
|
|
|
@ -23,15 +14,15 @@ class SearchListAdapter(context: Context, val callback: Callback) : |
|
|
|
SimpleRecyclerAdapter<SearchResult>(context, R.layout.item_search_list) { |
|
|
|
SimpleRecyclerAdapter<SearchResult>(context, R.layout.item_search_list) { |
|
|
|
|
|
|
|
|
|
|
|
val cacheFileNames = hashSetOf<String>() |
|
|
|
val cacheFileNames = hashSetOf<String>() |
|
|
|
|
|
|
|
val textColor = context.getCompatColor(R.color.primaryText).hexString.substring(2) |
|
|
|
|
|
|
|
val accentColor = context.accentColor.hexString.substring(2) |
|
|
|
|
|
|
|
|
|
|
|
override fun convert(holder: ItemViewHolder, item: SearchResult, payloads: MutableList<Any>) { |
|
|
|
override fun convert(holder: ItemViewHolder, item: SearchResult, payloads: MutableList<Any>) { |
|
|
|
with(holder.itemView) { |
|
|
|
with(holder.itemView) { |
|
|
|
val isDur = callback.durChapterIndex() == item.chapterIndex |
|
|
|
val isDur = callback.durChapterIndex() == item.chapterIndex |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
if (payloads.isEmpty()) { |
|
|
|
tv_search_result.text = item.parseText(item.presentText) |
|
|
|
tv_search_result.text = item.getHtmlCompat(textColor, accentColor) |
|
|
|
if (isDur){ |
|
|
|
tv_search_result.paint.isFakeBoldText = isDur |
|
|
|
tv_search_result.paint.isFakeBoldText = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|