For #4863 - Remove delay in HomeFragment onPreDraw
parent
66a8c04967
commit
7b5ed2673b
|
@ -7,7 +7,6 @@ package org.mozilla.fenix.utils
|
||||||
import androidx.core.view.doOnPreDraw
|
import androidx.core.view.doOnPreDraw
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,14 +22,9 @@ class FragmentPreDrawManager(
|
||||||
fun execute(code: () -> Unit) {
|
fun execute(code: () -> Unit) {
|
||||||
fragment.view?.doOnPreDraw {
|
fragment.view?.doOnPreDraw {
|
||||||
fragment.viewLifecycleOwner.lifecycleScope.launch {
|
fragment.viewLifecycleOwner.lifecycleScope.launch {
|
||||||
delay(ANIM_SCROLL_DELAY)
|
|
||||||
code()
|
code()
|
||||||
fragment.startPostponedEnterTransition()
|
fragment.startPostponedEnterTransition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val ANIM_SCROLL_DELAY = 100L
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue