From afb364c96049bdea221240e0d8fdf2d340c1dc18 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 5 Dec 2020 17:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=BA=90=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/rss/subscription/SourceSubActivity.kt | 5 ++++- .../io/legado/app/ui/rss/subscription/SourceSubAdapter.kt | 2 +- app/src/main/res/menu/source_sub_item.xml | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/menu/source_sub_item.xml diff --git a/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubActivity.kt b/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubActivity.kt index 006eb21b9..11de210fd 100644 --- a/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubActivity.kt @@ -41,7 +41,10 @@ class SourceSubActivity : BaseActivity(), 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) } diff --git a/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubAdapter.kt index 830601cac..0fa19871e 100644 --- a/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/subscription/SourceSubAdapter.kt @@ -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) diff --git a/app/src/main/res/menu/source_sub_item.xml b/app/src/main/res/menu/source_sub_item.xml new file mode 100644 index 000000000..f852b2bcf --- /dev/null +++ b/app/src/main/res/menu/source_sub_item.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file