添加源地址订阅功能

pull/517/head
gedoor 4 years ago
parent cb4be31602
commit afb364c960
  1. 5
      app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubAdapter.kt
  3. 8
      app/src/main/res/menu/source_sub_item.xml

@ -41,7 +41,10 @@ class SourceSubActivity : BaseActivity<ActivitySourceSubBinding>(),
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.menu_add -> editSubscription(SourceSub())
R.id.menu_add -> {
val order = App.db.sourceSubDao().maxOrder + 1
editSubscription(SourceSub(customOrder = order))
}
}
return super.onCompatOptionsItemSelected(item)
}

@ -44,7 +44,7 @@ class SourceSubAdapter(context: Context, val callBack: Callback) :
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.inflate(R.menu.source_sub_item)
popupMenu.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.menu_del -> callBack.delSubscription(source)

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_del"
android:title="@string/delete" />
</menu>
Loading…
Cancel
Save