|
@@ -71,6 +71,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
|
|
var bookSort = 0
|
|
var bookSort = 0
|
|
|
private set
|
|
private set
|
|
|
private var upLastUpdateTimeJob: Job? = null
|
|
private var upLastUpdateTimeJob: Job? = null
|
|
|
|
|
+ private var defaultScrollBarSize = 0
|
|
|
|
|
|
|
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
this.savedInstanceState = savedInstanceState
|
|
this.savedInstanceState = savedInstanceState
|
|
@@ -86,7 +87,8 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
|
|
|
|
|
|
|
private fun initRecyclerView() {
|
|
private fun initRecyclerView() {
|
|
|
binding.rvBookshelf.setEdgeEffectColor(primaryColor)
|
|
binding.rvBookshelf.setEdgeEffectColor(primaryColor)
|
|
|
- binding.rvBookshelf.setFastScrollEnabled(AppConfig.showBookshelfFastScroller)
|
|
|
|
|
|
|
+ defaultScrollBarSize = binding.rvBookshelf.scrollBarSize
|
|
|
|
|
+ upFastScrollerBar()
|
|
|
binding.refreshLayout.setColorSchemeColors(accentColor)
|
|
binding.refreshLayout.setColorSchemeColors(accentColor)
|
|
|
binding.refreshLayout.setOnRefreshListener {
|
|
binding.refreshLayout.setOnRefreshListener {
|
|
|
binding.refreshLayout.isRefreshing = false
|
|
binding.refreshLayout.isRefreshing = false
|
|
@@ -118,6 +120,16 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
|
|
startLastUpdateTimeJob()
|
|
startLastUpdateTimeJob()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private fun upFastScrollerBar() {
|
|
|
|
|
+ val showBookshelfFastScroller = AppConfig.showBookshelfFastScroller
|
|
|
|
|
+ binding.rvBookshelf.setFastScrollEnabled(showBookshelfFastScroller)
|
|
|
|
|
+ if (showBookshelfFastScroller) {
|
|
|
|
|
+ binding.rvBookshelf.scrollBarSize = 0
|
|
|
|
|
+ } else {
|
|
|
|
|
+ binding.rvBookshelf.scrollBarSize = defaultScrollBarSize
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
fun upBookSort(sort: Int) {
|
|
fun upBookSort(sort: Int) {
|
|
|
binding.root.post {
|
|
binding.root.post {
|
|
|
arguments?.putInt("bookSort", sort)
|
|
arguments?.putInt("bookSort", sort)
|
|
@@ -276,7 +288,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
|
|
observeEvent<String>(EventBus.BOOKSHELF_REFRESH) {
|
|
observeEvent<String>(EventBus.BOOKSHELF_REFRESH) {
|
|
|
booksAdapter.notifyDataSetChanged()
|
|
booksAdapter.notifyDataSetChanged()
|
|
|
startLastUpdateTimeJob()
|
|
startLastUpdateTimeJob()
|
|
|
- binding.rvBookshelf.setFastScrollEnabled(AppConfig.showBookshelfFastScroller)
|
|
|
|
|
|
|
+ upFastScrollerBar()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|