mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
b4cd2a668a
commit
66e0f066ad
@ -130,9 +130,19 @@ class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf),
|
||||
return bookGroups[position].groupName
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定视图位置是否更改时调用
|
||||
* @return POSITION_NONE 已更改,刷新视图. POSITION_UNCHANGED 未更改,不刷新视图
|
||||
*/
|
||||
override fun getItemPosition(`object`: Any): Int {
|
||||
val fragment = `object` as BooksFragment
|
||||
val position = fragment.position
|
||||
val group = bookGroups[position]
|
||||
if (fragment.groupId != group.groupId) {
|
||||
return POSITION_NONE
|
||||
}
|
||||
return POSITION_UNCHANGED
|
||||
}
|
||||
|
||||
override fun getItem(position: Int): Fragment {
|
||||
val group = bookGroups[position]
|
||||
|
@ -63,10 +63,12 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
||||
}
|
||||
private var booksFlowJob: Job? = null
|
||||
private var savedInstanceState: Bundle? = null
|
||||
private var position = 0
|
||||
private var groupId = -1L
|
||||
var position = 0
|
||||
private set
|
||||
var groupId = -1L
|
||||
private set
|
||||
private var bookSort = 0
|
||||
private var upLastUpdateTimeJob : Job? = null
|
||||
private var upLastUpdateTimeJob: Job? = null
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
this.savedInstanceState = savedInstanceState
|
||||
|
Loading…
Reference in New Issue
Block a user