From 2921be620a2cc2bd3a7be84aaa6d6136c651367c Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 21 Oct 2022 15:29:17 -0400 Subject: [PATCH] Use fade transition in Voyager screens to mimic existing Conductor change handler --- app/build.gradle.kts | 1 - .../ui/setting/SettingsMainController.kt | 33 +++++++++---------- gradle/libs.versions.toml | 1 - 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 10324eb08..4b6f6d9bc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -266,7 +266,6 @@ dependencies { implementation(libs.cascade) implementation(libs.numberpicker) implementation(libs.bundles.voyager) - implementation(libs.materialmotion.core) // Conductor implementation(libs.bundles.conductor) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt index 5476a2cbe..904c18e01 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsMainController.kt @@ -1,11 +1,15 @@ package eu.kanade.tachiyomi.ui.setting import android.os.Bundle +import androidx.compose.animation.ExitTransition +import androidx.compose.animation.core.LinearEasing +import androidx.compose.animation.core.tween +import androidx.compose.animation.fadeIn +import androidx.compose.animation.with import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.core.os.bundleOf -import cafe.adriel.voyager.core.stack.StackEvent import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.transitions.ScreenTransition import eu.kanade.presentation.components.TwoPanelBox @@ -17,14 +21,21 @@ import eu.kanade.presentation.util.LocalBackPress import eu.kanade.presentation.util.LocalRouter import eu.kanade.presentation.util.calculateWindowWidthSizeClass import eu.kanade.tachiyomi.ui.base.controller.BasicFullComposeController -import soup.compose.material.motion.animation.materialSharedAxisX -import soup.compose.material.motion.animation.rememberSlideDistance class SettingsMainController(bundle: Bundle = bundleOf()) : BasicFullComposeController(bundle) { private val toBackupScreen = args.getBoolean(TO_BACKUP_SCREEN) private val toAboutScreen = args.getBoolean(TO_ABOUT_SCREEN) + /** + * Mimics [eu.kanade.tachiyomi.ui.base.controller.OneWayFadeChangeHandler] + */ + private val transition = fadeIn( + animationSpec = tween( + easing = LinearEasing, + ), + ) with ExitTransition.None + @Composable override fun ComposeContent() { CompositionLocalProvider(LocalRouter provides router) { @@ -40,15 +51,9 @@ class SettingsMainController(bundle: Bundle = bundleOf()) : BasicFullComposeCont }, content = { CompositionLocalProvider(LocalBackPress provides this::back) { - val slideDistance = rememberSlideDistance() ScreenTransition( navigator = it, - transition = { - materialSharedAxisX( - forward = it.lastEvent != StackEvent.Pop, - slideDistance = slideDistance, - ) - }, + transition = { transition }, ) } }, @@ -70,15 +75,9 @@ class SettingsMainController(bundle: Bundle = bundleOf()) : BasicFullComposeCont } }, endContent = { - val slideDistance = rememberSlideDistance() ScreenTransition( navigator = it, - transition = { - materialSharedAxisX( - forward = it.lastEvent != StackEvent.Pop, - slideDistance = slideDistance, - ) - }, + transition = { transition }, ) }, ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 773c28b7c..cbce9f6d4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -93,7 +93,6 @@ junit = "org.junit.jupiter:junit-jupiter:5.9.1" voyager-navigator = { module = "cafe.adriel.voyager:voyager-navigator", version.ref = "voyager" } voyager-transitions = { module = "cafe.adriel.voyager:voyager-transitions", version.ref = "voyager" } -materialmotion-core = "io.github.fornewid:material-motion-compose-core:0.10.2-beta" numberpicker= "com.chargemap.compose:numberpicker:1.0.3" [bundles]