Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Use fade transition in Voyager screens to mimic existing Conductor change handler

Cette révision appartient à :
arkon 2022-10-21 15:29:17 -04:00
Parent c61a51438d
révision 2921be620a
3 fichiers modifiés avec 16 ajouts et 19 suppressions

Voir le fichier

@ -266,7 +266,6 @@ dependencies {
implementation(libs.cascade)
implementation(libs.numberpicker)
implementation(libs.bundles.voyager)
implementation(libs.materialmotion.core)
// Conductor
implementation(libs.bundles.conductor)

Voir le fichier

@ -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 },
)
},
)

Voir le fichier

@ -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]