HapeLee 1 год назад
Родитель
Сommit
c3bc0ae2c1

+ 10 - 5
app/src/main/java/io/legato/kazusa/base/BaseBottomSheetDialogFragment.kt

@@ -2,11 +2,13 @@ package io.legato.kazusa.base
 
 import android.content.DialogInterface
 import android.content.DialogInterface.OnDismissListener
+import android.content.res.Configuration
 import android.os.Bundle
 import android.view.View
 import androidx.annotation.LayoutRes
 import androidx.fragment.app.FragmentManager
 import androidx.lifecycle.lifecycleScope
+import com.google.android.material.bottomsheet.BottomSheetDialog
 import com.google.android.material.bottomsheet.BottomSheetDialogFragment
 import io.legato.kazusa.constant.AppLog
 import io.legato.kazusa.help.coroutine.Coroutine
@@ -24,11 +26,14 @@ abstract class BaseBottomSheetDialogFragment(
         this.onDismissListener = onDismissListener
     }
 
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-//        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N) {
-//            setStyle(STYLE_NO_TITLE, 0)
-//        }
+    override fun onStart() {
+        super.onStart()
+        if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
+            val screenHeight = resources.displayMetrics.heightPixels
+            (dialog as? BottomSheetDialog)?.behavior?.apply {
+                peekHeight = (screenHeight * 0.7f).toInt()
+            }
+        }
     }
 
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

+ 3 - 4
app/src/main/java/io/legato/kazusa/ui/main/MainActivity.kt

@@ -35,8 +35,8 @@ import io.legato.kazusa.lib.dialogs.alert
 import io.legato.kazusa.service.BaseReadAloudService
 import io.legato.kazusa.ui.about.CrashLogsDialog
 import io.legato.kazusa.ui.main.bookshelf.BaseBookshelfFragment
-import io.legato.kazusa.ui.main.bookshelf.style1.BookshelfFragment1
-import io.legato.kazusa.ui.main.bookshelf.style2.BookshelfFragment2
+import io.legato.kazusa.ui.main.bookshelf.books.BookshelfFragment1
+import io.legato.kazusa.ui.main.bookshelf.books.BookshelfFragment2
 import io.legato.kazusa.ui.main.explore.ExploreFragment
 import io.legato.kazusa.ui.main.my.MyFragment
 import io.legato.kazusa.ui.main.rss.RssFragment
@@ -55,7 +55,7 @@ import kotlin.coroutines.resume
 import kotlin.coroutines.suspendCoroutine
 import androidx.core.view.get
 import com.google.android.material.navigation.NavigationBarView
-import io.legato.kazusa.ui.main.bookshelf.style1.BookshelfFragment3
+import io.legato.kazusa.ui.main.bookshelf.books.BookshelfFragment3
 
 /**
  * 主界面
@@ -92,7 +92,6 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
-        // 绑定返回键逻辑
         onBackPressedDispatcher.addCallback(this) {
             if (pagePosition != 0) {
                 binding.viewPagerMain.currentItem = 0

+ 34 - 21
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style1/books/BooksFragment.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/BooksFragment.kt

@@ -1,7 +1,6 @@
-package io.legato.kazusa.ui.main.bookshelf.style1.books
+package io.legato.kazusa.ui.main.bookshelf.books
 
 import android.annotation.SuppressLint
-import android.content.res.Configuration
 import android.os.Bundle
 import android.view.View
 import android.view.ViewConfiguration
@@ -28,6 +27,9 @@ import io.legato.kazusa.help.config.AppConfig
 //import io.legado.app.lib.theme.primaryColor
 import io.legato.kazusa.ui.book.info.BookInfoActivity
 import io.legato.kazusa.ui.main.MainViewModel
+import io.legato.kazusa.ui.main.bookshelf.books.styleDefalut.BaseBooksAdapter
+import io.legato.kazusa.ui.main.bookshelf.books.styleDefalut.BooksAdapterGrid
+import io.legato.kazusa.ui.main.bookshelf.books.styleDefalut.BooksAdapterList
 import io.legato.kazusa.utils.bookshelfLayout
 import io.legato.kazusa.utils.cnCompare
 import io.legato.kazusa.utils.flowWithLifecycleAndDatabaseChangeFirst
@@ -147,12 +149,12 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
         }
     }
 
-    fun upBookSort(sort: Int) {
-        binding.root.post {
-            arguments?.putInt("bookSort", sort)
-            bookSort = sort
+    fun upBookSort() {
+//        binding.root.post {
+//            arguments?.putInt("bookSort", sort)
+//            bookSort = sort
             upRecyclerData()
-        }
+//        }
     }
 
     fun setEnableRefresh(enable: Boolean) {
@@ -168,24 +170,36 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
         booksFlowJob = viewLifecycleOwner.lifecycleScope.launch {
             appDb.bookDao.flowByGroup(groupId).map { list ->
                 //排序
+
+                val isDescending = AppConfig.bookshelfSortOrder == 1
+
                 when (bookSort) {
-                    1 -> list.sortedByDescending { it.latestChapterTime }
-                    2 -> list.sortedWith { o1, o2 ->
-                        o1.name.cnCompare(o2.name)
-                    }
+                    1 -> if (isDescending) list.sortedByDescending { it.latestChapterTime }
+                    else list.sortedBy { it.latestChapterTime }
 
-                    3 -> list.sortedBy { it.order }
+                    2 -> if (isDescending)
+                        list.sortedWith { o1, o2 -> o2.name.cnCompare(o1.name) }
+                    else
+                        list.sortedWith { o1, o2 -> o1.name.cnCompare(o2.name) }
 
-                    // 综合排序 issue #3192
-                    4 -> list.sortedByDescending {
-                        max(it.latestChapterTime, it.durChapterTime)
-                    }
-                    // 按作者排序
-                    5 -> list.sortedWith { o1, o2 ->
-                        o1.author.cnCompare(o2.author)
+                    3 -> if (isDescending) list.sortedByDescending { it.order }
+                    else list.sortedBy { it.order }
+
+                    4 -> if (isDescending) list.sortedByDescending {
+                        max(
+                            it.latestChapterTime,
+                            it.durChapterTime
+                        )
                     }
+                    else list.sortedBy { max(it.latestChapterTime, it.durChapterTime) }
+
+                    5 -> if (isDescending)
+                        list.sortedWith { o1, o2 -> o2.author.cnCompare(o1.author) }
+                    else
+                        list.sortedWith { o1, o2 -> o1.author.cnCompare(o2.author) }
 
-                    else -> list.sortedByDescending { it.durChapterTime }
+                    else -> if (isDescending) list.sortedByDescending { it.durChapterTime }
+                    else list.sortedBy { it.durChapterTime }
                 }
             }.flowWithLifecycleAndDatabaseChangeFirst(
                 viewLifecycleOwner.lifecycle,
@@ -197,7 +211,6 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
                 binding.tvEmptyMsg.isGone = list.isNotEmpty()
                 binding.refreshLayout.isEnabled = enableRefresh && list.isNotEmpty()
                 booksAdapter.setItems(list)
-                delay(100)
             }
         }
     }

+ 2 - 6
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style1/BookshelfFragment1.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/BookshelfFragment1.kt

@@ -1,6 +1,6 @@
 @file:Suppress("DEPRECATION")
 
-package io.legato.kazusa.ui.main.bookshelf.style1
+package io.legato.kazusa.ui.main.bookshelf.books
 
 import android.annotation.SuppressLint
 import android.os.Bundle
@@ -19,7 +19,6 @@ import io.legato.kazusa.help.config.AppConfig
 import io.legato.kazusa.ui.book.group.GroupEditDialog
 import io.legato.kazusa.ui.book.search.SearchActivity
 import io.legato.kazusa.ui.main.bookshelf.BaseBookshelfFragment
-import io.legato.kazusa.ui.main.bookshelf.style1.books.BooksFragment
 import io.legato.kazusa.utils.showDialogFragment
 import io.legato.kazusa.utils.toastOnUi
 import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
@@ -116,11 +115,8 @@ class BookshelfFragment1() : BaseBookshelfFragment(R.layout.fragment_bookshelf1)
             if (it is BooksFragment) {
                 val position = it.position
                 val group = bookGroups.getOrNull(position) ?: return@forEach
-                val newSort = group.getRealBookSort()
                 it.setEnableRefresh(group.enableRefresh)
-                if (it.bookSort != newSort) {
-                    it.upBookSort(newSort)
-                }
+                it.upBookSort()
             }
         }
     }

+ 29 - 21
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style2/BookshelfFragment2.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/BookshelfFragment2.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style2
+package io.legato.kazusa.ui.main.bookshelf.books
 
 import android.annotation.SuppressLint
 import android.os.Bundle
@@ -24,6 +24,9 @@ import io.legato.kazusa.ui.book.group.GroupEditDialog
 import io.legato.kazusa.ui.book.info.BookInfoActivity
 import io.legato.kazusa.ui.book.search.SearchActivity
 import io.legato.kazusa.ui.main.bookshelf.BaseBookshelfFragment
+import io.legato.kazusa.ui.main.bookshelf.books.styleFold.BaseBooksAdapter
+import io.legato.kazusa.ui.main.bookshelf.books.styleFold.BooksAdapterGrid
+import io.legato.kazusa.ui.main.bookshelf.books.styleFold.BooksAdapterList
 import io.legato.kazusa.utils.bookshelfLayout
 import io.legato.kazusa.utils.cnCompare
 import io.legato.kazusa.utils.flowWithLifecycleAndDatabaseChangeFirst
@@ -39,7 +42,6 @@ import kotlinx.coroutines.flow.conflate
 import kotlinx.coroutines.flow.flowOn
 import kotlinx.coroutines.flow.map
 import kotlinx.coroutines.launch
-import java.util.Locale
 import kotlin.math.max
 
 /**
@@ -69,7 +71,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
 
     private var bookGroups: List<BookGroup> = emptyList()
     private var booksFlowJob: Job? = null
-    override var groupId = BookGroup.IdRoot
+    override var groupId = BookGroup.Companion.IdRoot
     private var allBooks: List<Book> = emptyList()
     override var books: List<Book> = emptyList()
     private var enableRefresh = true
@@ -134,7 +136,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
         allBooksFlowJob?.cancel()
         allBooksFlowJob = viewLifecycleOwner.lifecycleScope.launch {
             appDb.bookDao.flowAll().map { list ->
-                when (AppConfig.getBookSortByGroupId(BookGroup.IdRoot)) {
+                when (AppConfig.getBookSortByGroupId(BookGroup.Companion.IdRoot)) {
                     1 -> list.sortedByDescending { it.latestChapterTime }
                     2 -> list.sortedWith { o1, o2 -> o1.name.cnCompare(o2.name) }
                     3 -> list.sortedBy { it.order }
@@ -144,7 +146,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
             }.flowWithLifecycleAndDatabaseChangeFirst(
                 viewLifecycleOwner.lifecycle,
                 Lifecycle.State.RESUMED,
-                AppDatabase.BOOK_TABLE_NAME
+                AppDatabase.Companion.BOOK_TABLE_NAME
             ).catch {
                 AppLog.put("所有书籍更新出错", it)
             }.conflate().flowOn(Dispatchers.Default).collect { list ->
@@ -156,7 +158,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
     }
 
     private fun initBooksData() {
-        if (groupId == BookGroup.IdRoot) {
+        if (groupId == BookGroup.Companion.IdRoot) {
             if (isAdded) {
                 binding.titleBar.title = getString(R.string.bookshelf)
                 binding.refreshLayout.isEnabled = true
@@ -173,9 +175,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
         }
         booksFlowJob?.cancel()
         booksFlowJob = viewLifecycleOwner.lifecycleScope.launch {
-
             appDb.bookDao.flowByGroup(groupId).map { list ->
-
                 //排序
                 val isDescending = AppConfig.bookshelfSortOrder == 1
 
@@ -183,15 +183,27 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
                     1 -> if (isDescending) list.sortedByDescending { it.latestChapterTime }
                     else list.sortedBy { it.latestChapterTime }
 
-                    2 -> if (isDescending) list.sortedWith(compareByDescending { it.name.cnCompareKey() })
-                    else list.sortedWith(compareBy { it.name.cnCompareKey() })
+                    2 -> if (isDescending)
+                        list.sortedWith { o1, o2 -> o2.name.cnCompare(o1.name) }
+                    else
+                        list.sortedWith { o1, o2 -> o1.name.cnCompare(o2.name) }
 
                     3 -> if (isDescending) list.sortedByDescending { it.order }
                     else list.sortedBy { it.order }
 
-                    4 -> if (isDescending) list.sortedByDescending { max(it.latestChapterTime, it.durChapterTime) }
+                    4 -> if (isDescending) list.sortedByDescending {
+                        max(
+                            it.latestChapterTime,
+                            it.durChapterTime
+                        )
+                    }
                     else list.sortedBy { max(it.latestChapterTime, it.durChapterTime) }
 
+                    5 -> if (isDescending)
+                        list.sortedWith { o1, o2 -> o2.author.cnCompare(o1.author) }
+                    else
+                        list.sortedWith { o1, o2 -> o1.author.cnCompare(o2.author) }
+
                     else -> if (isDescending) list.sortedByDescending { it.durChapterTime }
                     else list.sortedBy { it.durChapterTime }
                 }
@@ -199,7 +211,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
             }.flowWithLifecycleAndDatabaseChangeFirst(
                 viewLifecycleOwner.lifecycle,
                 Lifecycle.State.RESUMED,
-                AppDatabase.BOOK_TABLE_NAME
+                AppDatabase.Companion.BOOK_TABLE_NAME
             ).catch {
                 AppLog.put("书架更新出错", it)
             }.conflate().flowOn(Dispatchers.Default).collect { list ->
@@ -211,13 +223,9 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
         }
     }
 
-    fun String.cnCompareKey(): String {
-        return this.trim().lowercase(Locale.getDefault())
-    }
-
     fun back(): Boolean {
-        if (groupId != BookGroup.IdRoot) {
-            groupId = BookGroup.IdRoot
+        if (groupId != BookGroup.Companion.IdRoot) {
+            groupId = BookGroup.Companion.IdRoot
             initBooksData()
             return true
         }
@@ -225,7 +233,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
     }
 
     override fun onQueryTextSubmit(query: String?): Boolean {
-        SearchActivity.start(requireContext(), query)
+        SearchActivity.Companion.start(requireContext(), query)
         return false
     }
 
@@ -268,7 +276,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
     }
 
     fun getItemCount(): Int {
-        return if (groupId == BookGroup.IdRoot) {
+        return if (groupId == BookGroup.Companion.IdRoot) {
             bookGroups.size + books.size
         } else {
             books.size
@@ -276,7 +284,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
     }
 
     override fun getItems(): List<Any> {
-        return if (groupId == BookGroup.IdRoot) {
+        return if (groupId == BookGroup.Companion.IdRoot) {
             bookGroups + books
         } else {
             books

+ 2 - 6
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style1/BookshelfFragment3.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/BookshelfFragment3.kt

@@ -1,6 +1,6 @@
 @file:Suppress("DEPRECATION")
 
-package io.legato.kazusa.ui.main.bookshelf.style1
+package io.legato.kazusa.ui.main.bookshelf.books
 
 import android.annotation.SuppressLint
 import android.os.Bundle
@@ -18,7 +18,6 @@ import io.legato.kazusa.databinding.FragmentBookshelf3Binding
 import io.legato.kazusa.help.config.AppConfig
 import io.legato.kazusa.ui.book.search.SearchActivity
 import io.legato.kazusa.ui.main.bookshelf.BaseBookshelfFragment
-import io.legato.kazusa.ui.main.bookshelf.style1.books.BooksFragment
 import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
 import kotlin.collections.set
 
@@ -109,11 +108,8 @@ class BookshelfFragment3() : BaseBookshelfFragment(R.layout.fragment_bookshelf3)
             if (it is BooksFragment) {
                 val position = it.position
                 val group = bookGroups.getOrNull(position) ?: return@forEach
-                val newSort = group.getRealBookSort()
                 it.setEnableRefresh(group.enableRefresh)
-                if (it.bookSort != newSort) {
-                    it.upBookSort(newSort)
-                }
+                it.upBookSort()
             }
         }
     }

+ 1 - 1
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style1/books/BaseBooksAdapter.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/styleDefalut/BaseBooksAdapter.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style1.books
+package io.legato.kazusa.ui.main.bookshelf.books.styleDefalut
 
 import android.content.Context
 import androidx.core.os.bundleOf

+ 1 - 1
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style1/books/BooksAdapterGrid.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/styleDefalut/BooksAdapterGrid.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style1.books
+package io.legato.kazusa.ui.main.bookshelf.books.styleDefalut
 
 import android.content.Context
 import android.os.Bundle

+ 1 - 1
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style1/books/BooksAdapterList.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/styleDefalut/BooksAdapterList.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style1.books
+package io.legato.kazusa.ui.main.bookshelf.books.styleDefalut
 
 import android.content.Context
 import android.os.Bundle

+ 1 - 1
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style2/BaseBooksAdapter.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/styleFold/BaseBooksAdapter.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style2
+package io.legato.kazusa.ui.main.bookshelf.books.styleFold
 
 import android.content.Context
 import android.view.LayoutInflater

+ 1 - 1
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style2/BooksAdapterGrid.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/styleFold/BooksAdapterGrid.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style2
+package io.legato.kazusa.ui.main.bookshelf.books.styleFold
 
 import android.content.Context
 import android.os.Bundle

+ 1 - 1
app/src/main/java/io/legato/kazusa/ui/main/bookshelf/style2/BooksAdapterList.kt → app/src/main/java/io/legato/kazusa/ui/main/bookshelf/books/styleFold/BooksAdapterList.kt

@@ -1,4 +1,4 @@
-package io.legato.kazusa.ui.main.bookshelf.style2
+package io.legato.kazusa.ui.main.bookshelf.books.styleFold
 
 import android.content.Context
 import android.os.Bundle

+ 1 - 2
app/src/main/res/layout-land/view_read_menu.xml

@@ -144,7 +144,6 @@
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:layout_marginVertical="8dp"
-                    android:layout_marginHorizontal="16dp"
                     android:importantForAccessibility="no"
                     android:gravity="center"
                     android:orientation="horizontal">
@@ -198,7 +197,7 @@
                     android:gravity="end"
                     android:importantForAccessibility="no"
                     android:paddingVertical="8dp"
-                    android:paddingHorizontal="16dp"
+                    android:paddingEnd="16dp"
                     android:orientation="horizontal">
 
                     <com.google.android.material.button.MaterialButton

+ 172 - 169
app/src/main/res/layout/dialog_bookshelf_config.xml

@@ -1,222 +1,225 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:fillViewport="true"
-    android:paddingHorizontal="16dp"
-    android:paddingVertical="8dp"
-    android:orientation="vertical">
+    android:fillViewport="true">
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:gravity="center"
+        android:fillViewport="true"
+        android:paddingHorizontal="16dp"
         android:paddingVertical="8dp"
-        android:paddingHorizontal="16dp">
+        android:orientation="vertical">
 
-        <View
-            android:layout_width="36dp"
-            android:layout_height="4dp"
-            android:layout_gravity="center_horizontal"
-            android:background="@drawable/bg_bottom_sheet_handle"
-            android:layout_marginBottom="16dp" />
-
-        <TextView
-            android:id="@+id/bottom_sheet_title"
-            android:layout_width="wrap_content"
+        <LinearLayout
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:text="@string/bookshelf_layout"
-            android:textSize="18sp"
-            android:textStyle="bold" />
-
-    </LinearLayout>
-
-    <com.google.android.material.materialswitch.MaterialSwitch
-        android:id="@+id/sw_show_unread"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/show_unread"
-        tools:ignore="TouchTargetSizeCheck" />
-
-    <com.google.android.material.materialswitch.MaterialSwitch
-        android:id="@+id/sw_show_last_update_time"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/show_last_update_time"
-        tools:ignore="TouchTargetSizeCheck" />
+            android:orientation="vertical"
+            android:gravity="center"
+            android:paddingVertical="8dp"
+            android:paddingHorizontal="16dp">
+
+            <View
+                android:layout_width="36dp"
+                android:layout_height="4dp"
+                android:layout_gravity="center_horizontal"
+                android:background="@drawable/bg_bottom_sheet_handle"
+                android:layout_marginBottom="16dp" />
+
+            <TextView
+                android:id="@+id/bottom_sheet_title"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/bookshelf_layout"
+                android:textSize="18sp"
+                android:textStyle="bold" />
 
-    <com.google.android.material.materialswitch.MaterialSwitch
-        android:id="@+id/sw_show_wait_up_books"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/show_wait_up_count"
-        tools:ignore="TouchTargetSizeCheck" />
+        </LinearLayout>
 
-    <com.google.android.material.materialswitch.MaterialSwitch
-        android:id="@+id/sw_show_bookshelf_fast_scroller"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/show_bookshelf_fast_scroller"
-        tools:ignore="TouchTargetSizeCheck" />
+        <com.google.android.material.materialswitch.MaterialSwitch
+            android:id="@+id/sw_show_unread"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/show_unread"
+            tools:ignore="TouchTargetSizeCheck" />
 
+        <com.google.android.material.materialswitch.MaterialSwitch
+            android:id="@+id/sw_show_last_update_time"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/show_last_update_time"
+            tools:ignore="TouchTargetSizeCheck" />
 
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingTop="8dp"
-        android:text="@string/group_style"
-        android:textSize="14sp"
-        android:textStyle="bold" />
+        <com.google.android.material.materialswitch.MaterialSwitch
+            android:id="@+id/sw_show_wait_up_books"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/show_wait_up_count"
+            tools:ignore="TouchTargetSizeCheck" />
 
-    <com.google.android.material.chip.ChipGroup
-        android:id="@+id/chip_group_style"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:checkableBehavior="single"
-        android:paddingBottom="8dp"
-        app:singleSelection="true"
-        app:selectionRequired="true">
-    </com.google.android.material.chip.ChipGroup>
+        <com.google.android.material.materialswitch.MaterialSwitch
+            android:id="@+id/sw_show_bookshelf_fast_scroller"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/show_bookshelf_fast_scroller"
+            tools:ignore="TouchTargetSizeCheck" />
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:paddingTop="8dp">
 
         <TextView
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:text="排列视图"
+            android:paddingTop="8dp"
+            android:text="@string/group_style"
             android:textSize="14sp"
             android:textStyle="bold" />
 
-        <View
-            android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="1"/>
-
         <com.google.android.material.chip.ChipGroup
-            android:id="@+id/chip_group_layout"
-            android:layout_width="wrap_content"
+            android:id="@+id/chip_group_style"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:checkableBehavior="single"
+            android:paddingBottom="8dp"
             app:singleSelection="true"
             app:selectionRequired="true">
+        </com.google.android.material.chip.ChipGroup>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:paddingTop="8dp">
 
-            <com.google.android.material.chip.Chip
-                android:id="@+id/chip_list"
+            <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="列表" />
-
-            <com.google.android.material.chip.Chip
-                android:id="@+id/chip_grid"
+                android:layout_gravity="center_vertical"
+                android:text="排列视图"
+                android:textSize="14sp"
+                android:textStyle="bold" />
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
+
+            <com.google.android.material.chip.ChipGroup
+                android:id="@+id/chip_group_layout"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="网格" />
-        </com.google.android.material.chip.ChipGroup>
-    </LinearLayout>
+                app:singleSelection="true"
+                app:selectionRequired="true">
 
+                <com.google.android.material.chip.Chip
+                    android:id="@+id/chip_list"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="列表" />
 
+                <com.google.android.material.chip.Chip
+                    android:id="@+id/chip_grid"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="网格" />
+            </com.google.android.material.chip.ChipGroup>
+        </LinearLayout>
 
-    <TextView
-        android:id="@+id/slider_text"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="每行列数"
-        android:textSize="14sp"
-        android:textStyle="bold"
-        android:paddingTop="8dp" />
 
-    <com.google.android.material.slider.Slider
-        android:id="@+id/slider_grid_count"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingVertical="8dp"
-        android:valueFrom="1"
-        android:valueTo="9"
-        android:stepSize="1"
-        android:value="3" />
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal">
         <TextView
-            android:layout_width="wrap_content"
+            android:id="@+id/slider_text"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:text="@string/sort"
+            android:text="每行列数"
             android:textSize="14sp"
-            android:textStyle="bold" />
-
-        <View
-            android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="1"/>
+            android:textStyle="bold"
+            android:paddingTop="8dp" />
 
-        <com.google.android.material.chip.ChipGroup
-            android:id="@+id/chipGroupOrder"
-            android:layout_width="wrap_content"
+        <com.google.android.material.slider.Slider
+            android:id="@+id/slider_grid_count"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            app:singleSelection="true">
-
-            <com.google.android.material.chip.Chip
+            android:paddingVertical="8dp"
+            android:valueFrom="1"
+            android:valueTo="9"
+            android:stepSize="1"
+            android:value="3" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+            <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:id="@+id/chip_asc"
-                android:text="升序"
-                android:checkable="true" />
-
-            <com.google.android.material.chip.Chip
+                android:layout_gravity="center_vertical"
+                android:text="@string/sort"
+                android:textSize="14sp"
+                android:textStyle="bold" />
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
+
+            <com.google.android.material.chip.ChipGroup
+                android:id="@+id/chipGroupOrder"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:id="@+id/chip_desc"
-                android:text="降序"
-                android:checkable="true" />
-        </com.google.android.material.chip.ChipGroup>
-    </LinearLayout>
-
-    <com.google.android.material.chip.ChipGroup
-        android:id="@+id/chip_group_sort"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        app:singleSelection="true"
-        app:selectionRequired="true"
-        android:layout_marginTop="4dp"
-        android:layout_marginBottom="4dp"
-        android:orientation="horizontal" />
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal">
+                app:singleSelection="true">
+
+                <com.google.android.material.chip.Chip
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:id="@+id/chip_asc"
+                    android:text="升序"
+                    android:checkable="true" />
+
+                <com.google.android.material.chip.Chip
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:id="@+id/chip_desc"
+                    android:text="降序"
+                    android:checkable="true" />
+            </com.google.android.material.chip.ChipGroup>
+        </LinearLayout>
 
-        <View
-            android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="1"/>
+        <com.google.android.material.chip.ChipGroup
+            android:id="@+id/chip_group_sort"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            app:singleSelection="true"
+            app:selectionRequired="true"
+            android:orientation="horizontal" />
 
-        <com.google.android.material.button.MaterialButton
-            android:id="@+id/btnCancel"
-            style="@style/Widget.Material3.Button.OutlinedButton"
-            android:text="取消"
-            android:layout_marginEnd="8dp"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" />
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <View
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
+
+            <com.google.android.material.button.MaterialButton
+                android:id="@+id/btnCancel"
+                style="@style/Widget.Material3.Button.OutlinedButton"
+                android:text="取消"
+                android:layout_marginEnd="8dp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" />
 
-        <com.google.android.material.button.MaterialButton
-            android:id="@+id/btnOk"
-            style="@style/Widget.Material3.Button"
-            android:text="确定"
+            <com.google.android.material.button.MaterialButton
+                android:id="@+id/btnOk"
+                style="@style/Widget.Material3.Button"
+                android:text="确定"
 
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content" />
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content" />
 
+        </LinearLayout>
     </LinearLayout>
-
-</LinearLayout>
+</androidx.core.widget.NestedScrollView>

+ 2 - 2
app/src/main/res/layout/dialog_read_book_style.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<ScrollView
+<androidx.core.widget.NestedScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tool="http://schemas.android.com/tools"
@@ -309,4 +309,4 @@
         </LinearLayout>
 
     </LinearLayout>
-</ScrollView>
+</androidx.core.widget.NestedScrollView>