Don't play enter transtition when launcher is already in foreground
This commit is contained in:
parent
b0ee0c63d8
commit
c0a97d0d67
@ -143,10 +143,12 @@ abstract class SharedLauncherActivity(
|
|||||||
.currentTransition
|
.currentTransition
|
||||||
.flowWithLifecycle(lifecycle, Lifecycle.State.RESUMED)
|
.flowWithLifecycle(lifecycle, Lifecycle.State.RESUMED)
|
||||||
.collect {
|
.collect {
|
||||||
enterTransitionProgress.value = 0f
|
if (it != null) {
|
||||||
enterTransition = it
|
enterTransitionProgress.value = 0f
|
||||||
enterTransitionProgress.animateTo(1f)
|
enterTransition = it
|
||||||
enterTransition = null
|
enterTransitionProgress.animateTo(1f)
|
||||||
|
enterTransition = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +232,7 @@ abstract class SharedLauncherActivity(
|
|||||||
.imePadding()
|
.imePadding()
|
||||||
)
|
)
|
||||||
enterTransition?.let {
|
enterTransition?.let {
|
||||||
|
if (it.startBounds == null || it.targetBounds == null) return@let
|
||||||
val dX = it.startBounds.center.x - it.targetBounds.center.x
|
val dX = it.startBounds.center.x - it.targetBounds.center.x
|
||||||
val dY = it.startBounds.center.y - it.targetBounds.center.y
|
val dY = it.startBounds.center.y - it.targetBounds.center.y
|
||||||
val s =
|
val s =
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import androidx.compose.ui.geometry.Offset
|
|||||||
import androidx.compose.ui.geometry.Rect
|
import androidx.compose.ui.geometry.Rect
|
||||||
|
|
||||||
data class EnterHomeTransition(
|
data class EnterHomeTransition(
|
||||||
val startBounds: Rect,
|
val startBounds: Rect? = null,
|
||||||
val targetBounds: Rect,
|
val targetBounds: Rect? = null,
|
||||||
val icon: (@Composable (animVector: Offset, progress: () -> Float) -> Unit)? = null
|
val icon: (@Composable (animVector: Offset, progress: () -> Float) -> Unit)? = null
|
||||||
)
|
)
|
||||||
@ -30,7 +30,7 @@ class EnterHomeTransitionManager {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentTransition.tryEmit(null)
|
currentTransition.tryEmit(EnterHomeTransition())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clear() {
|
fun clear() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user