diff --git a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt index 144fa4e19..e3fb6f190 100644 --- a/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/explore/ExploreAdapter.kt @@ -2,8 +2,8 @@ package io.legado.app.ui.main.explore import android.content.Context import android.view.LayoutInflater -import android.view.Menu import android.widget.PopupMenu +import io.legado.app.App import io.legado.app.R import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.base.adapter.SimpleRecyclerAdapter @@ -40,9 +40,7 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca } ll_title.onLongClick { val popupMenu = PopupMenu(context, ll_title) - popupMenu.menu.add(Menu.NONE, R.id.menu_edit, Menu.NONE, R.string.edit) - popupMenu.menu.add(Menu.NONE, R.id.menu_top, Menu.NONE, R.string.to_top) - popupMenu.menu.add(Menu.NONE, R.id.menu_refresh, Menu.NONE, R.string.refresh) + popupMenu.inflate(R.menu.explore_item) popupMenu.setOnMenuItemClickListener { when (it.itemId) { R.id.menu_edit -> callBack.editSource(item.bookSourceUrl) @@ -51,6 +49,11 @@ class ExploreAdapter(context: Context, private val scope: CoroutineScope, val ca ACache.get(context, "explore").remove(item.bookSourceUrl) notifyItemChanged(holder.layoutPosition) } + R.id.menu_del -> { + Coroutine.async(scope) { + App.db.bookSourceDao().delete(item) + } + } } true } diff --git a/app/src/main/res/menu/explore_item.xml b/app/src/main/res/menu/explore_item.xml new file mode 100644 index 000000000..8cc2fe0c3 --- /dev/null +++ b/app/src/main/res/menu/explore_item.xml @@ -0,0 +1,20 @@ + +
\ No newline at end of file diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml index 016946f36..cc2d9c170 100644 --- a/app/src/main/res/values/ids.xml +++ b/app/src/main/res/values/ids.xml @@ -1,8 +1,5 @@