mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
优化
This commit is contained in:
parent
33bbd59a8d
commit
8a5ca3382b
@ -2,7 +2,6 @@ package io.legado.app.ui.book.source.manage
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.widget.PopupMenu
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -80,8 +79,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) :
|
||||
iv_edit.onClick { callBack.edit(item) }
|
||||
iv_menu_more.onClick {
|
||||
val popupMenu = PopupMenu(context, it)
|
||||
popupMenu.menu.add(Menu.NONE, R.id.menu_top, Menu.NONE, R.string.to_top)
|
||||
popupMenu.menu.add(Menu.NONE, R.id.menu_del, Menu.NONE, R.string.delete)
|
||||
popupMenu.inflate(R.menu.book_source_item)
|
||||
popupMenu.setOnMenuItemClickListener { menuItem ->
|
||||
when (menuItem.itemId) {
|
||||
R.id.menu_top -> callBack.toTop(item)
|
||||
|
12
app/src/main/res/menu/book_source_item.xml
Normal file
12
app/src/main/res/menu/book_source_item.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_top"
|
||||
android:title="@string/to_top" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_del"
|
||||
android:title="@string/delete" />
|
||||
|
||||
</menu>
|
Loading…
Reference in New Issue
Block a user