pull/94/head
kunfei 5 years ago
parent 8a5ca3382b
commit dbb2c19125
  1. 4
      app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleAdapter.kt
  2. 4
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt
  3. 12
      app/src/main/res/menu/replace_rule_item.xml
  4. 12
      app/src/main/res/menu/rss_source_item.xml

@ -2,7 +2,6 @@ package io.legado.app.ui.replacerule
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.view.Menu
import android.widget.PopupMenu import android.widget.PopupMenu
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -80,8 +79,7 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) :
} }
iv_menu_more.onClick { iv_menu_more.onClick {
val popupMenu = PopupMenu(context, it) val popupMenu = PopupMenu(context, it)
popupMenu.menu.add(Menu.NONE, R.id.menu_top, Menu.NONE, R.string.to_top) popupMenu.inflate(R.menu.replace_rule_item)
popupMenu.menu.add(Menu.NONE, R.id.menu_del, Menu.NONE, R.string.delete)
popupMenu.setOnMenuItemClickListener { menuItem -> popupMenu.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) { when (menuItem.itemId) {
R.id.menu_top -> callBack.toTop(item) R.id.menu_top -> callBack.toTop(item)

@ -1,7 +1,6 @@
package io.legado.app.ui.rss.source.manage package io.legado.app.ui.rss.source.manage
import android.content.Context import android.content.Context
import android.view.Menu
import android.widget.PopupMenu import android.widget.PopupMenu
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import io.legado.app.R import io.legado.app.R
@ -77,8 +76,7 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) :
iv_edit.onClick { callBack.edit(item) } iv_edit.onClick { callBack.edit(item) }
iv_menu_more.onClick { iv_menu_more.onClick {
val popupMenu = PopupMenu(context, it) val popupMenu = PopupMenu(context, it)
popupMenu.menu.add(Menu.NONE, R.id.menu_top, Menu.NONE, R.string.to_top) popupMenu.inflate(R.menu.rss_source_item)
popupMenu.menu.add(Menu.NONE, R.id.menu_del, Menu.NONE, R.string.delete)
popupMenu.setOnMenuItemClickListener { menuItem -> popupMenu.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) { when (menuItem.itemId) {
R.id.menu_top -> callBack.toTop(item) R.id.menu_top -> callBack.toTop(item)

@ -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>

@ -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…
Cancel
Save