mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 04:28:00 +01:00
Fix stuck UI after rotation (#275)
This commit is contained in:
parent
5054b37a96
commit
817b1ddb32
1 changed files with 4 additions and 1 deletions
|
@ -33,7 +33,6 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment.arguments = bundle
|
fragment.arguments = bundle
|
||||||
fragment.listener = activity
|
|
||||||
return fragment
|
return fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +40,10 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
|
||||||
|
|
||||||
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
||||||
val fragment = super.instantiateItem(container, position) as ViewPagerFragment
|
val fragment = super.instantiateItem(container, position) as ViewPagerFragment
|
||||||
|
|
||||||
|
// getItem() might not be called if the activity is recreated, so the listener must be set here
|
||||||
|
fragment.listener = activity
|
||||||
|
|
||||||
fragments[position] = fragment
|
fragments[position] = fragment
|
||||||
return fragment
|
return fragment
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue