Instantly share code, notes, and snippets.
A Sr. Software Architect with 26 years of software development experience and 15 years on Android. I enjoy hiking, backpacking, and losing myself in a good book
- Seattle, WA
- https://www.francescvilarino.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun SharedTransitionScope.ListScreen( | |
animatedVisibilityScope: AnimatedVisibilityScope, | |
onItemClick: (String) -> Unit, | |
modifier: Modifier = Modifier | |
) { | |
LazyColumn( | |
modifier = modifier, | |
verticalArrangement = Arrangement.spacedBy(8.dp), | |
contentPadding = PaddingValues(all = 16.dp), |
fvilarino
/ shared_elem_details_calling.kt
Created
April 20, 2024 23:29
Shared Elem - Details Calling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composable( | |
route = "details/{url}" | |
) { backstackEntry -> | |
val encoded = backstackEntry.arguments?.getString("url") ?: error("No URL") | |
val url = URLDecoder.decode(encoded, "UTF-8") | |
DetailsScreen( | |
url = url, | |
animatedVisibilityScope = this@composable, | |
onClick = { navController.popBackStack() }, | |
modifier = Modifier.fillMaxSize(), |
fvilarino
/ shared_elem_animated_details.kt
Created
April 20, 2024 23:26
Share Elem - Animated Details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
// 1 | |
fun SharedTransitionScope.DetailsScreen( | |
url: String, | |
// 2 | |
animatedVisibilityScope: AnimatedVisibilityScope, | |
onClick: () -> Unit, | |
modifier: Modifier = Modifier, | |
) { | |
Column( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composable( | |
route = "list" | |
) { | |
ListScreen( | |
// 1 | |
animatedVisibilityScope = this@composable, | |
onItemClick = { item -> | |
val encoded = URLEncoder.encode(item, "UTF-8") | |
navController.navigate("details/$encoded") | |
}, |
fvilarino
/ shared_elem_animated_list.kt
Last active
April 21, 2024 19:27
Shared Elem - Animated List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
// 1 | |
fun SharedTransitionScope.ListScreen( | |
// 2 | |
animatedVisibilityScope: AnimatedVisibilityScope, | |
onItemClick: (String) -> Unit, | |
modifier: Modifier = Modifier | |
) { | |
LazyColumn( | |
modifier = modifier, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Home(modifier: Modifier = Modifier) { | |
val navController = rememberNavController() | |
// 1 | |
SharedTransitionLayout( | |
modifier = modifier, | |
) { | |
NavHost( | |
navController = navController, | |
startDestination = "list", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[versions] | |
navigationCompose = "2.8.0-alpha07" | |
uiCompose = "1.7.0-alpha07" | |
animationCompose = "1.7.0-alpha07" | |
foundationCompose = "1.7.0-alpha07" | |
[libraries] | |
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" } | |
androidx-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "uiCompose" } | |
androidx-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "animationCompose" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun Home(modifier: Modifier = Modifier) { | |
val navController = rememberNavController() | |
NavHost(navController = navController, startDestination = "list", modifier = modifier) { | |
composable( | |
route = "list" | |
) { | |
ListScreen( | |
onItemClick = { item -> | |
val encoded = URLEncoder.encode(item, "UTF-8") |
fvilarino
/ shared_elem_baseline_details.kt
Created
April 20, 2024 22:05
Shared Elem - Baseline Details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DetailsScreen( | |
url: String, | |
onClick: () -> Unit, | |
modifier: Modifier = Modifier, | |
) { | |
Column( | |
modifier = modifier | |
.clickable( | |
interactionSource = remember { MutableInteractionSource() }, |
fvilarino
/ shared_elem_baseline_list.kt
Last active
April 21, 2024 19:26
Shared Elem - Baseline List
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun ListScreen( | |
onItemClick: (String) -> Unit, | |
modifier: Modifier = Modifier | |
) { | |
LazyColumn( | |
modifier = modifier, | |
verticalArrangement = Arrangement.spacedBy(8.dp), | |
contentPadding = PaddingValues(all = 16.dp), | |
) { |