|
|
@ -1,9 +1,12 @@ |
|
|
|
package io.legado.app.ui.book.local.rule |
|
|
|
package io.legado.app.ui.book.local.rule |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
|
|
|
|
import android.view.View |
|
|
|
import android.view.ViewGroup |
|
|
|
import android.view.ViewGroup |
|
|
|
|
|
|
|
import android.widget.PopupMenu |
|
|
|
import androidx.core.os.bundleOf |
|
|
|
import androidx.core.os.bundleOf |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
|
|
|
|
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.RecyclerAdapter |
|
|
|
import io.legado.app.base.adapter.RecyclerAdapter |
|
|
|
import io.legado.app.data.entities.TxtTocRule |
|
|
|
import io.legado.app.data.entities.TxtTocRule |
|
|
@ -63,8 +66,28 @@ class TxtTocRuleAdapter(context: Context, private val callBack: CallBack) : |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
binding.ivEdit.setOnClickListener { |
|
|
|
binding.ivEdit.setOnClickListener { |
|
|
|
|
|
|
|
getItem(holder.layoutPosition)?.let { |
|
|
|
|
|
|
|
callBack.edit(it) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
binding.ivMenuMore.setOnClickListener { |
|
|
|
|
|
|
|
showMenu(it, holder.layoutPosition) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun showMenu(view: View, position: Int) { |
|
|
|
|
|
|
|
val source = getItem(position) ?: return |
|
|
|
|
|
|
|
val popupMenu = PopupMenu(context, view) |
|
|
|
|
|
|
|
popupMenu.inflate(R.menu.rss_source_item) |
|
|
|
|
|
|
|
popupMenu.setOnMenuItemClickListener { menuItem -> |
|
|
|
|
|
|
|
when (menuItem.itemId) { |
|
|
|
|
|
|
|
R.id.menu_top -> callBack.toTop(source) |
|
|
|
|
|
|
|
R.id.menu_bottom -> callBack.toBottom(source) |
|
|
|
|
|
|
|
R.id.menu_del -> callBack.del(source) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
popupMenu.show() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun selectAll() { |
|
|
|
fun selectAll() { |
|
|
|