diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 18d19fb26..adcec733e 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -609,18 +609,7 @@ open class MainActivity : BaseComposeActivity(), VariableDialog.Callback { ) } - entry( - metadata = NavDisplay.transitionSpec { - fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) - } + NavDisplay.popTransitionSpec { - fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) - } + NavDisplay.predictivePopTransitionSpec { _ -> - fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) - } - ) { route -> + entry { route -> val searchViewModel = koinViewModel() LaunchedEffect(route.key, route.scopeRaw, searchViewModel) { @@ -697,19 +686,28 @@ open class MainActivity : BaseComposeActivity(), VariableDialog.Callback { entry( metadata = NavDisplay.transitionSpec { - if (initialState.key is MainRouteExploreShow) { + val from = initialState.key + val fromStr = from.toString() + if (from is MainRouteHome || from is MainRouteExploreShow || from is MainRouteSearch || + fromStr.startsWith("MainRouteHome") || fromStr.startsWith("MainRouteExploreShow") || fromStr.startsWith("MainRouteSearch")) { fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) + fadeOut(animationSpec = tween(300)) } else null } + NavDisplay.popTransitionSpec { - if (targetState.key is MainRouteExploreShow) { + val to = targetState.key + val toStr = to.toString() + if (to is MainRouteHome || to is MainRouteExploreShow || to is MainRouteSearch || + toStr.startsWith("MainRouteHome") || toStr.startsWith("MainRouteExploreShow") || toStr.startsWith("MainRouteSearch")) { fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) + fadeOut(animationSpec = tween(300)) } else null } + NavDisplay.predictivePopTransitionSpec { _ -> - if (targetState.key is MainRouteExploreShow) { + val to = targetState.key + val toStr = to.toString() + if (to is MainRouteHome || to is MainRouteExploreShow || to is MainRouteSearch || + toStr.startsWith("MainRouteHome") || toStr.startsWith("MainRouteExploreShow") || toStr.startsWith("MainRouteSearch")) { fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) + fadeOut(animationSpec = tween(300)) } else null } ) { route -> @@ -731,18 +729,7 @@ open class MainActivity : BaseComposeActivity(), VariableDialog.Callback { ) } - entry( - metadata = NavDisplay.transitionSpec { - fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) - } + NavDisplay.popTransitionSpec { - fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) - } + NavDisplay.predictivePopTransitionSpec { _ -> - fadeIn(animationSpec = tween(300)) togetherWith - fadeOut(animationSpec = tween(300)) - } - ) { route -> + entry { route -> ExploreShowScreen( title = route.title ?: "探索", sourceUrl = route.sourceUrl,