Use crossfade push/pop handler only on android 14

This commit is contained in:
Jays2Kings 2023-10-25 11:40:18 -07:00
parent 7046baaef4
commit 64604905b3

View file

@ -806,22 +806,17 @@ fun Controller.requestFilePermissionsSafe(
} }
fun Controller.withFadeTransaction(): RouterTransaction { fun Controller.withFadeTransaction(): RouterTransaction {
val isLowRam by lazy { activity?.getSystemService<ActivityManager>()?.isLowRamDevice == true } val isLowRam = activity?.getSystemService<ActivityManager>()?.isLowRamDevice == true
val handler = {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE || isLowRam) {
FadeChangeHandler(isLowRam)
} else {
CrossFadeChangeHandler(false)
}
}
return RouterTransaction.with(this) return RouterTransaction.with(this)
.pushChangeHandler( .pushChangeHandler(handler())
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { .popChangeHandler(handler())
FadeChangeHandler()
} else {
CrossFadeChangeHandler(isLowRam)
},
)
.popChangeHandler(
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
FadeChangeHandler()
} else {
CrossFadeChangeHandler(isLowRam)
},
)
} }
fun Controller.withFadeInTransaction(): RouterTransaction { fun Controller.withFadeInTransaction(): RouterTransaction {