mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 07:44:00 +01:00
Merge pull request #6681 from vector-im/fix/mna/leak-tab-layout-mediator
[FTUE] Memory leak on FtueAuthSplashCarouselFragment
This commit is contained in:
commit
bfd9dcbca2
1
changelog.d/6680.misc
Normal file
1
changelog.d/6680.misc
Normal file
@ -0,0 +1 @@
|
||||
[FTUE] Memory leak on FtueAuthSplashCarouselFragment
|
@ -52,6 +52,8 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractFtueAuthFragment<FragmentFtueSplashCarouselBinding>() {
|
||||
|
||||
private var tabLayoutMediator: TabLayoutMediator? = null
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueSplashCarouselBinding {
|
||||
return FragmentFtueSplashCarouselBinding.inflate(inflater, container, false)
|
||||
}
|
||||
@ -61,10 +63,19 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
||||
setupViews()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
tabLayoutMediator?.detach()
|
||||
tabLayoutMediator = null
|
||||
views.splashCarousel.adapter = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
val carouselAdapter = carouselController.adapter
|
||||
views.splashCarousel.adapter = carouselAdapter
|
||||
TabLayoutMediator(views.carouselIndicator, views.splashCarousel) { _, _ -> }.attach()
|
||||
tabLayoutMediator = TabLayoutMediator(views.carouselIndicator, views.splashCarousel) { _, _ -> }
|
||||
.also { it.attach() }
|
||||
|
||||
carouselController.setData(carouselStateFactory.create())
|
||||
|
||||
val isAlreadyHaveAccountEnabled = vectorFeatures.isOnboardingAlreadyHaveAccountSplashEnabled()
|
||||
|
Loading…
Reference in New Issue
Block a user