diff --git a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt index 213157e90..2be9e6409 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/HistoryKeyAdapter.kt @@ -1,6 +1,5 @@ package io.legado.app.ui.book.search -import android.content.Context import io.legado.app.App import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder @@ -15,8 +14,10 @@ import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onLongClick -class HistoryKeyAdapter(context: Context, val callBack: CallBack) : - SimpleRecyclerAdapter(context, R.layout.item_text) { +class HistoryKeyAdapter(activity: SearchActivity, val callBack: CallBack) : + SimpleRecyclerAdapter(activity, R.layout.item_text) { + + private val explosionField = ExplosionField.attach2Window(activity) override fun convert(holder: ItemViewHolder, item: SearchKeyword, payloads: MutableList) { with(holder.itemView) { @@ -26,7 +27,7 @@ class HistoryKeyAdapter(context: Context, val callBack: CallBack) : } onLongClick { it?.let { - ExplosionField(context).explode(it, true) + explosionField.explode(it, true) } GlobalScope.launch(IO) { App.db.searchKeywordDao().delete(item)