iamthevoid
08/09/2021, 9:00 AMexpandIn + slideInVertically
will do the thing. But whatever alignment param looks like it not working at all, i set it as Center
, but next screen expands from side (video, gray background for better vision). Why can be that? (Code in Thread)iamthevoid
08/09/2021, 10:06 AMcomposable
content of navigation graph in animation then animations will always the same whether composable
content appears on first open or it appear from bacstack. What if i want forward animation on first open, but it must be backward when screen appears from backstack?RE
08/09/2021, 10:33 AMNapa Ram
08/09/2021, 10:43 AMFlorian
08/09/2021, 10:53 AMFlorian
08/09/2021, 11:36 AMiamthevoid
08/09/2021, 11:37 AMrememberAnimatedNavController()
from accompanist library? Looks like bugAbdalla Hassanin
08/09/2021, 12:21 PMAndroidView(
factory = { context ->
TextView(context).apply {
text = "Initial Value"
}
},
update = {
it.text = message
}
)
Napa Ram
08/09/2021, 12:40 PMMohammad Jahidul Islam
08/09/2021, 12:48 PMMaxUt
08/09/2021, 12:55 PMChris Miller
08/09/2021, 1:58 PMjava.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels until it is added to the NavController's back stack (i.e., the Lifecycle of the NavBackStackEntry reaches the CREATED state).
My BottomNavigation code is:
@Composable
fun BottomNavBar(navController: NavHostController, bottomNavItems: List<AppScreen>) {
BottomNavigation {
val currentRoute = navController.currentDestination?.route
bottomNavItems.forEach { screen ->
val selected = currentRoute == screen.route
BottomNavigationItem(
icon = { Icon(painter = painterResource(id = screen.iconId), contentDescription = null) },
label = { Text(screen.name) },
selected = selected,
onClick = {
if (!selected) {
navController.navigate(screen.route) {
popUpTo(navController.graph.findStartDestination().id)
launchSingleTop = true
}
}
}
)
}
}
}
It seems to be due to the combination of calling popUpTo() and setting launchSingleTop. If either or both of those lines are removed, the problem goes away. Any ideas what I can do to fix this? Is the problem here, or maybe due to something I'm doing in one of my screens?iamthevoid
08/09/2021, 3:22 PMEnterTransition
[thread] doesn’t run animation, that i expect: screen appears from bottom, and change size from 90% to 100%, but run another animation: screen appears from side.
I think this happens because animation runs in container that size is not match the screen. For example if i pass this transition into AnimatedVisibility
and wrap it with Box(Modifier.fillMaxSize, contentAlignment = Center)
then animation runs exactly as i expect.
But now i use AnimatedNavHost
from accompanist
lib and same wrapping impossible, because i pass transitions right in graph, not wrap anything with AnimatedVisibility
.
So question is - how to avoid incorrect animation behavior when it runs in default container? Is this behavior really incorrect or am i use api incorrectly?Lucien Guimaraes
08/09/2021, 4:09 PMdimsuz
08/09/2021, 4:51 PMBox(modifier = Modifier.heightIn(min = 40.dp)) {
Canvas(modifier = Modifier.fillMaxHeight()) { ... }
OtherContent()
}
and Canvas
composable doesn't fill 40.dp
, and is 0.dp
in height actually. If I swap heightIn
with height(40.dp)
, then it works.
How do I make it so that child either fills 40.dp
or more if total Box height ends up to be larger (due to OtherContent
)?Azam Khan
08/09/2021, 7:05 PMLazyVerticalGrid
inside a Column
, I want to make the whole Column
scrollable, how can I do that? I tried using Modifier.nestedScroll
but not sure how it works
Column {
SomeButtons()
SomeImages()
LazyVerticalGrid()
}
Florian
08/09/2021, 8:38 PMroute
property of the `navBackStackEntry`'s destination
contains the argument syntax. But in order to add arguments later, my own route string needs to be the "base" route without arguments.
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination
val hideBottomNav = fullScreenDestinations.any { destination ->
destination.route == currentDestination?.route
}
So here destination.route
= "AddEditTask"
while currentDestination.route
= "AddEditTask?taskId=taskID"
.
How else could I check what destination we are currently on?
using contains
to compare a sub-string seems error-prone.Dominaezzz
08/09/2021, 10:18 PMModifier.animateContentSize
. Is there a version of this like Modifier.animateContentPosition
? Or how would I go about writing my own? Modifier.layout
doesn't provide a position.Colton Idle
08/09/2021, 10:39 PMNapa Ram
08/09/2021, 11:55 PMJason Inbody
08/10/2021, 12:40 AMMohammad Jahidul Islam
08/10/2021, 5:08 AMAdib Faramarzi
08/10/2021, 5:38 AMNavHost
I immediately get java.lang.ArrayIndexOutOfBoundsException: length=13; index=13
!
The best part is it doesn't have anything to do with the composable themselves (removing any destination fixes it)Napa Ram
08/10/2021, 5:50 AMNapa Ram
08/10/2021, 6:53 AMMaxUt
08/10/2021, 8:17 AMziv kesten
08/10/2021, 8:30 AMAdib Faramarzi
08/10/2021, 9:55 AMback pressed
state for compose-navigation?
popBackStack
does not finish navigation (and instead just removes the destination) but pressing the back key always works perfectly.
This becomes a problem when you have nested navigation as the inner navigation stacks can never pop themselvesPardeep Sharma
08/10/2021, 11:35 AMMaxUt
08/10/2021, 12:37 PMMaxUt
08/10/2021, 12:37 PMVadzim Filipovich
08/10/2021, 1:16 PMColton Idle
08/10/2021, 3:19 PMval painter = rememberImagePainter("http")
val state = painter.state
if (state is ImagePainter.State.Loading) {
} else {
Image(
painter = painter,
modifier = Modifier.size(48.dp)
)
}
does this help?Vadzim Filipovich
08/10/2021, 3:43 PMColton Idle
08/10/2021, 3:49 PMImagePainter.State.Error
instead?Vadzim Filipovich
08/10/2021, 3:57 PMMaxUt
08/10/2021, 3:57 PM@Composable
fun ImageWrapper(painter: ImagePainter, content: @Composable () -> Unit) {
if (painter.state is ImagePainter.State.Success || painter.state is ImagePainter.State.Empty) {
content()
}
}