mirror of https://github.com/readrops/Readrops.git
Add screen transitions
This commit is contained in:
parent
fffc3be383
commit
52e8c64d45
|
@ -17,9 +17,10 @@ import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import cafe.adriel.voyager.navigator.CurrentScreen
|
import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi
|
||||||
import cafe.adriel.voyager.navigator.Navigator
|
import cafe.adriel.voyager.navigator.Navigator
|
||||||
import cafe.adriel.voyager.navigator.NavigatorDisposeBehavior
|
import cafe.adriel.voyager.navigator.NavigatorDisposeBehavior
|
||||||
|
import cafe.adriel.voyager.transitions.SlideTransition
|
||||||
import com.readrops.app.account.selection.AccountSelectionScreen
|
import com.readrops.app.account.selection.AccountSelectionScreen
|
||||||
import com.readrops.app.account.selection.AccountSelectionScreenModel
|
import com.readrops.app.account.selection.AccountSelectionScreenModel
|
||||||
import com.readrops.app.home.HomeScreen
|
import com.readrops.app.home.HomeScreen
|
||||||
|
@ -40,7 +41,7 @@ import org.koin.core.component.get
|
||||||
|
|
||||||
class MainActivity : ComponentActivity(), KoinComponent {
|
class MainActivity : ComponentActivity(), KoinComponent {
|
||||||
|
|
||||||
@OptIn(KoinExperimentalAPI::class)
|
@OptIn(KoinExperimentalAPI::class, ExperimentalVoyagerApi::class)
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
installSplashScreen()
|
installSplashScreen()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -80,14 +81,18 @@ class MainActivity : ComponentActivity(), KoinComponent {
|
||||||
screen = if (accountExists) HomeScreen else AccountSelectionScreen(),
|
screen = if (accountExists) HomeScreen else AccountSelectionScreen(),
|
||||||
disposeBehavior = NavigatorDisposeBehavior(
|
disposeBehavior = NavigatorDisposeBehavior(
|
||||||
// prevent screenModels being recreated when opening a screen from a tab
|
// prevent screenModels being recreated when opening a screen from a tab
|
||||||
disposeNestedNavigators = false
|
disposeNestedNavigators = false,
|
||||||
|
disposeSteps = false
|
||||||
)
|
)
|
||||||
) {
|
) { navigator ->
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
handleIntent(intent)
|
handleIntent(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentScreen()
|
SlideTransition(
|
||||||
|
navigator = navigator,
|
||||||
|
disposeScreenAfterTransitionEnd = true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +121,7 @@ class MainActivity : ComponentActivity(), KoinComponent {
|
||||||
HomeScreen.openItemScreen(itemId)
|
HomeScreen.openItemScreen(itemId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
intent.action != null && intent.action == Intent.ACTION_SEND -> {
|
intent.action != null && intent.action == Intent.ACTION_SEND -> {
|
||||||
HomeScreen.openAddFeedDialog(intent.getStringExtra(Intent.EXTRA_TEXT).orEmpty())
|
HomeScreen.openAddFeedDialog(intent.getStringExtra(Intent.EXTRA_TEXT).orEmpty())
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ ksp = "2.0.0-1.0.24"
|
||||||
android_agp = "8.5.1"
|
android_agp = "8.5.1"
|
||||||
compose_bom = "2024.06.00"
|
compose_bom = "2024.06.00"
|
||||||
|
|
||||||
voyager = "1.0.0"
|
voyager = "1.1.0-beta02"
|
||||||
lifecycle = "2.8.4"
|
lifecycle = "2.8.4"
|
||||||
coil = "2.7.0"
|
coil = "2.7.0"
|
||||||
coroutines = "1.8.1"
|
coroutines = "1.8.1"
|
||||||
|
|
Loading…
Reference in New Issue