From 761570091ab4c1bc1cf2a2bde1856ec6dbb6a8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=84=8F=E5=B8=86?= <1657098617@qq.com> Date: Sun, 3 Jul 2022 00:11:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20webdav=E4=B9=A6=E7=B1=8D=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E9=80=89=E9=A1=B9=E7=9A=84=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E4=BA=8B=E4=BB=B6=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/remote/RemoteBookActivity.kt | 28 ++++++++++++++- .../main/res/drawable/ic_baseline_sort_24.xml | 5 +++ app/src/main/res/menu/book_remote.xml | 34 ++++++++++++++++++- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/ic_baseline_sort_24.xml diff --git a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt index 74413c57f..3b1ab5e53 100644 --- a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt @@ -3,6 +3,7 @@ package io.legado.app.ui.book.remote import android.os.Bundle import android.view.Menu import android.view.MenuItem +import android.view.SubMenu import androidx.activity.viewModels import androidx.core.view.isGone import androidx.recyclerview.widget.LinearLayoutManager @@ -12,9 +13,11 @@ import io.legado.app.databinding.ActivityImportBookBinding import io.legado.app.lib.theme.backgroundColor import io.legado.app.ui.about.AppLogDialog import io.legado.app.ui.book.remote.manager.RemoteBookWebDav +import io.legado.app.ui.book.source.manage.BookSourceActivity import io.legado.app.ui.widget.SelectActionBar import io.legado.app.ui.widget.dialog.WaitDialog import io.legado.app.utils.showDialogFragment +import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding import kotlinx.coroutines.flow.conflate import kotlinx.coroutines.launch @@ -32,7 +35,7 @@ class RemoteBookActivity : VMBaseActivity() private val adapter by lazy { RemoteBookAdapter(this, this) } private val waitDialog by lazy { WaitDialog(this) } - + private var groupMenu: SubMenu? = null override fun onActivityCreated(savedInstanceState: Bundle?) { binding.titleBar.setTitle(R.string.remote_book) initView() @@ -75,10 +78,33 @@ class RemoteBookActivity : VMBaseActivity upPath() R.id.menu_log -> showDialogFragment() + R.id.menu_sort_auto -> { + item.isChecked = true + toastOnUi("menu_sort_auto") + //sortCheck(BookSourceActivity.Sort.Weight) + //upBookSource(searchView.query?.toString()) + } + R.id.menu_sort_name -> { + item.isChecked = true + toastOnUi("menu_sort_name") + //sortCheck(BookSourceActivity.Sort.Name) + //upBookSource(searchView.query?.toString()) + } + R.id.menu_sort_time -> { + item.isChecked = true + toastOnUi("menu_sort_time") + //sortCheck(BookSourceActivity.Sort.Update) + //upBookSource(searchView.query?.toString()) + } } return super.onCompatOptionsItemSelected(item) } + override fun onPrepareOptionsMenu(menu: Menu): Boolean { + groupMenu = menu.findItem(R.id.menu_sort)?.subMenu + groupMenu?.setGroupCheckable(R.id.menu_group_sort, true, true) + return super.onPrepareOptionsMenu(menu) + } override fun revertSelection() { adapter.revertSelection() } diff --git a/app/src/main/res/drawable/ic_baseline_sort_24.xml b/app/src/main/res/drawable/ic_baseline_sort_24.xml new file mode 100644 index 000000000..3b184191d --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_sort_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/menu/book_remote.xml b/app/src/main/res/menu/book_remote.xml index 59f5ccd42..6a9c29b0c 100644 --- a/app/src/main/res/menu/book_remote.xml +++ b/app/src/main/res/menu/book_remote.xml @@ -9,11 +9,43 @@ android:icon="@drawable/ic_refresh_black_24dp" android:title="@string/refresh" app:showAsAction="always" /> + + + + + + + + + + + + + + + + \ No newline at end of file