mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-28 01:49:23 +01:00
Fixing missing clear on TabLayoutMediator when view is destroyed
This commit is contained in:
parent
5daf82a32a
commit
b2e64e6265
@ -51,6 +51,8 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
|||||||
private val carouselStateFactory: SplashCarouselStateFactory
|
private val carouselStateFactory: SplashCarouselStateFactory
|
||||||
) : AbstractFtueAuthFragment<FragmentFtueSplashCarouselBinding>() {
|
) : AbstractFtueAuthFragment<FragmentFtueSplashCarouselBinding>() {
|
||||||
|
|
||||||
|
private var tabLayoutMediator: TabLayoutMediator? = null
|
||||||
|
|
||||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueSplashCarouselBinding {
|
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueSplashCarouselBinding {
|
||||||
return FragmentFtueSplashCarouselBinding.inflate(inflater, container, false)
|
return FragmentFtueSplashCarouselBinding.inflate(inflater, container, false)
|
||||||
}
|
}
|
||||||
@ -60,10 +62,19 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
|||||||
setupViews()
|
setupViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
tabLayoutMediator?.detach()
|
||||||
|
tabLayoutMediator = null
|
||||||
|
views.splashCarousel.adapter = null
|
||||||
|
super.onDestroyView()
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupViews() {
|
private fun setupViews() {
|
||||||
val carouselAdapter = carouselController.adapter
|
val carouselAdapter = carouselController.adapter
|
||||||
views.splashCarousel.adapter = carouselAdapter
|
views.splashCarousel.adapter = carouselAdapter
|
||||||
TabLayoutMediator(views.carouselIndicator, views.splashCarousel) { _, _ -> }.attach()
|
tabLayoutMediator = TabLayoutMediator(views.carouselIndicator, views.splashCarousel) { _, _ -> }
|
||||||
|
.also { it.attach() }
|
||||||
|
|
||||||
carouselController.setData(carouselStateFactory.create())
|
carouselController.setData(carouselStateFactory.create())
|
||||||
|
|
||||||
val isAlreadyHaveAccountEnabled = vectorFeatures.isOnboardingAlreadyHaveAccountSplashEnabled()
|
val isAlreadyHaveAccountEnabled = vectorFeatures.isOnboardingAlreadyHaveAccountSplashEnabled()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user