mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Use fade transition in Voyager screens to mimic existing Conductor change handler
This commit is contained in:
		| @@ -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 }, | ||||
|                             ) | ||||
|                         }, | ||||
|                     ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user