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,8 +130,18 @@ class BookshelfFragment1 : BaseBookshelfFragment(R.layout.fragment_bookshelf),
|
|||||||
return bookGroups[position].groupName
|
return bookGroups[position].groupName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定视图位置是否更改时调用
|
||||||
|
* @return POSITION_NONE 已更改,刷新视图. POSITION_UNCHANGED 未更改,不刷新视图
|
||||||
|
*/
|
||||||
override fun getItemPosition(`object`: Any): Int {
|
override fun getItemPosition(`object`: Any): Int {
|
||||||
return POSITION_NONE
|
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 {
|
override fun getItem(position: Int): Fragment {
|
||||||
|
@ -63,10 +63,12 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
|||||||
}
|
}
|
||||||
private var booksFlowJob: Job? = null
|
private var booksFlowJob: Job? = null
|
||||||
private var savedInstanceState: Bundle? = null
|
private var savedInstanceState: Bundle? = null
|
||||||
private var position = 0
|
var position = 0
|
||||||
private var groupId = -1L
|
private set
|
||||||
|
var groupId = -1L
|
||||||
|
private set
|
||||||
private var bookSort = 0
|
private var bookSort = 0
|
||||||
private var upLastUpdateTimeJob : Job? = null
|
private var upLastUpdateTimeJob: Job? = null
|
||||||
|
|
||||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
this.savedInstanceState = savedInstanceState
|
this.savedInstanceState = savedInstanceState
|
||||||
|
Loading…
Reference in New Issue
Block a user