Merge pull request #495 from esensar/fix/sort-rotation
Fix issue with sort not working after rotating device
This commit is contained in:
commit
c88b9af155
1 changed files with 8 additions and 2 deletions
|
@ -15,8 +15,14 @@ class ViewPagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) {
|
|||
private val fragments = HashMap<Int, Fragment>()
|
||||
|
||||
override fun getItem(position: Int): Fragment {
|
||||
val fragment = getFragment(position)
|
||||
fragments[position] = fragment
|
||||
return getFragment(position)
|
||||
}
|
||||
|
||||
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
||||
val fragment = super.instantiateItem(container, position)
|
||||
if (fragment is Fragment) {
|
||||
fragments[position] = fragment
|
||||
}
|
||||
return fragment
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue