2
0
Fork 1
mirror of https://github.com/FossifyOrg/Gallery.git synced 2025-04-20 10:24:00 +02:00
This commit is contained in:
Jerry 2025-03-12 22:16:03 +01:00 committed by GitHub
commit a94941d14d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,7 +33,6 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
}
fragment.arguments = bundle
fragment.listener = activity
return fragment
}
@ -41,6 +40,10 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
override fun instantiateItem(container: ViewGroup, position: Int): Any {
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
return fragment
}