mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
优化
This commit is contained in:
parent
464d99c666
commit
e7df61815c
@ -137,6 +137,7 @@ object PreferKey {
|
||||
const val batchChangeSourceDelay = "batchChangeSourceDelay"
|
||||
const val openBookInfoByClickTitle = "openBookInfoByClickTitle"
|
||||
const val defaultHomePage = "defaultHomePage"
|
||||
const val showBookshelfFastScroller = "showBookshelfFastScroller"
|
||||
|
||||
const val cPrimary = "colorPrimary"
|
||||
const val cAccent = "colorAccent"
|
||||
|
@ -403,6 +403,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
appCtx.putPrefBoolean(PreferKey.openBookInfoByClickTitle, value)
|
||||
}
|
||||
|
||||
var showBookshelfFastScroller: Boolean
|
||||
get() = appCtx.getPrefBoolean(PreferKey.showBookshelfFastScroller, false)
|
||||
set(value) {
|
||||
appCtx.putPrefBoolean(PreferKey.showBookshelfFastScroller, value)
|
||||
}
|
||||
|
||||
var contentSelectSpeakMod: Int
|
||||
get() = appCtx.getPrefInt(PreferKey.contentSelectSpeakMod)
|
||||
set(value) {
|
||||
|
@ -168,6 +168,10 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
||||
AppConfig.showWaitUpCount = swShowWaitUpBooks.isChecked
|
||||
activityViewModel.postUpBooksLiveData(true)
|
||||
}
|
||||
if (AppConfig.showBookshelfFastScroller != swShowBookshelfFastScroller.isChecked) {
|
||||
AppConfig.showBookshelfFastScroller = swShowBookshelfFastScroller.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
if (bookshelfSort != rgSort.getCheckedIndex()) {
|
||||
AppConfig.bookshelfSort = rgSort.getCheckedIndex()
|
||||
upSort()
|
||||
|
@ -86,6 +86,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
||||
|
||||
private fun initRecyclerView() {
|
||||
binding.rvBookshelf.setEdgeEffectColor(primaryColor)
|
||||
binding.rvBookshelf.setFastScrollEnabled(AppConfig.showBookshelfFastScroller)
|
||||
binding.refreshLayout.setColorSchemeColors(accentColor)
|
||||
binding.refreshLayout.setOnRefreshListener {
|
||||
binding.refreshLayout.isRefreshing = false
|
||||
@ -275,6 +276,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
||||
observeEvent<String>(EventBus.BOOKSHELF_REFRESH) {
|
||||
booksAdapter.notifyDataSetChanged()
|
||||
startLastUpdateTimeJob()
|
||||
binding.rvBookshelf.setFastScrollEnabled(AppConfig.showBookshelfFastScroller)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,13 +58,22 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/sw_show_last_update_time"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
|
||||
<io.legado.app.lib.theme.view.ThemeSwitch
|
||||
android:id="@+id/sw_show_bookshelf_fast_scroller"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:text="@string/show_bookshelf_fast_scroller"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sw_show_wait_up_books"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintRight_toLeftOf="@+id/ll_sort"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sw_show_wait_up_books"
|
||||
app:layout_constraintTop_toBottomOf="@+id/sw_show_bookshelf_fast_scroller"
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentTextView
|
||||
@ -119,7 +128,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintLeft_toRightOf="@+id/ll_layout"
|
||||
app:layout_constraintTop_toBottomOf="@id/sw_show_wait_up_books"
|
||||
app:layout_constraintTop_toBottomOf="@id/sw_show_bookshelf_fast_scroller"
|
||||
app:layout_constraintRight_toRightOf="parent">
|
||||
|
||||
<io.legado.app.ui.widget.text.AccentTextView
|
||||
|
@ -13,7 +13,6 @@
|
||||
android:id="@+id/rv_bookshelf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"
|
||||
tools:listitem="@layout/item_bookshelf_list" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
@ -1131,4 +1131,5 @@
|
||||
<string name="default_home_page">默认主页</string>
|
||||
<string name="use_lib_archive">Use LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
@ -1134,4 +1134,5 @@
|
||||
<string name="default_home_page">默认主页</string>
|
||||
<string name="use_lib_archive">Use LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
@ -1134,4 +1134,5 @@
|
||||
<string name="default_home_page">默认主页</string>
|
||||
<string name="use_lib_archive">Use LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
@ -1129,4 +1129,5 @@ Còn </string>
|
||||
<string name="export_wait">等待导出</string>
|
||||
<string name="use_lib_archive">Use LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
@ -1130,4 +1130,5 @@
|
||||
<string name="export_wait">等待导出</string>
|
||||
<string name="use_lib_archive">使用LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">使用libarchive解壓檔案,支持解壓RAR5。</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
@ -1132,4 +1132,5 @@
|
||||
<string name="export_wait">等待导出</string>
|
||||
<string name="use_lib_archive">使用LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">使用libarchive解壓檔案,支持解壓RAR5。</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
@ -1132,4 +1132,5 @@
|
||||
<string name="export_wait">等待导出</string>
|
||||
<string name="use_lib_archive">使用LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">使用libarchive解压文件,支持解压RAR5。</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
@ -1134,4 +1134,5 @@
|
||||
<string name="default_home_page">默认主页</string>
|
||||
<string name="use_lib_archive">Use LibArchive</string>
|
||||
<string name="pref_use_lib_archive_summary">Using libarchive to extract files, it supports extracting RAR5.</string>
|
||||
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user