Abhishek Dewan
03/08/2021, 2:42 AMNavHost(navController = navController, startDestination = "splash") {
composable("splash") {
SplashScreen(navController)
}
composable("home") {
HomeScreen()
}
}
and you SplashScreen was defined somewhat like this
@Composable
fun SplashScreen(navController: NavHostController) {
val viewModel: SplashViewModel = viewModel()
The injection will not work if your SplashScreenViewModel takes non zero constructor params. In order to fix this you need to inject the viewModel somewhat like this
val viewModel: SplashViewModel = viewModel(
factory = HiltViewModelFactory(
LocalContext.current,
navController.getBackStackEntry("splash")
)
)
and this is possible by using the androidx.hilt:hilt-navigation:1.0.0-alpha03
library.
I spent the last hour trying to debug why despite everything being right, the injection wouldn’t work 😄Neal Sanche
03/08/2021, 4:08 AMsystemGestureExclusionRects
for gesture navigation? Alternatively, is it possible to obtain the screen bounds of a particular composable so I can use it to set these?Indu
03/08/2021, 6:56 AMJason Ankers
03/08/2021, 7:44 AMLazyColumn
inside a bottom sheet from dismissing the sheet? is it possible to disable the sheet swipe gestures within a certain boundary? (in my case I want to disable them over the LazyColumn
)pawegio
03/08/2021, 8:37 AMBackHandler
seems to not intercept system back presses on AppCompatActivity
restart in my case (in nested NavHost
composables). Is it a known issue? 🤔Ravi
03/08/2021, 9:04 AMzhuinden
03/08/2021, 9:38 AMPiotr Prus
03/08/2021, 9:40 AMSinan Gunes
03/08/2021, 12:12 PMOlivier Patry
03/08/2021, 12:42 PMLinearProgressIndicator(Modifier.fillMaxWidth().height(1.dp))
The implementation hard codes its size it seems:
Canvas(
modifier
.progressSemantics()
.size(LinearIndicatorWidth, LinearIndicatorHeight)
.focusable()
Any solution?julioromano
03/08/2021, 12:53 PMImageBitmap
?Sinan Gunes
03/08/2021, 2:14 PMLauren Yew
03/08/2021, 3:01 PMDaniele B
03/08/2021, 3:04 PM1.0.0-beta01
, and the preferredSize
modifier gives an error. What is the new modifier for that?than_
03/08/2021, 3:41 PMViewModel
and collectAsState
but by doing that I lost the ability to change state in the interactive mode in android studio. Is there something I'm missing?izyaboi
03/08/2021, 3:44 PMvar isPlayingState by remember { mutableStateOf(false) }
and set it in clickable (Box)
isPlayingState = if (player.isPlaying) {
player.pause()
false
} else {
player.play()
true
}
If i navigate to the second tab and navigate back the value ist false and not the last state i set ?why?Igor Brishkoski
03/08/2021, 3:44 PMDeepak Gahlot
03/08/2021, 4:24 PMHalil Ozercan
03/08/2021, 4:31 PMOrhan Tozan
03/08/2021, 4:58 PMSinan Gunes
03/08/2021, 6:13 PM#AndroidDevChallenge
… My github actions fails on this test:
com.example.androiddevchallenge.ExampleInstrumentedTest > sampleTest[test(AVD) - 10] FAILED
254
kotlin.UninitializedPropertyAccessException: lateinit property remeasurement has not been initialized
255
at androidx.compose.foundation.lazy.LazyListState.snapToItemIndexInternal$foundation_release(LazyListState.kt:186)
I haven’t touch that part. Any of you faced similar?alexsullivan114
03/08/2021, 6:33 PMalexsullivan114
03/08/2021, 7:22 PMArkadii Ivanov
03/08/2021, 8:30 PMGabriel Melo
03/08/2021, 9:27 PMeygraber
03/08/2021, 11:11 PMJoseph D
03/08/2021, 11:46 PMTash
03/09/2021, 12:36 AMkey
Composable. Noticed its usage in Jetcaster’s Pager:
for (page in minPage..maxPage) {
val pageData = PageData(page)
val scope = PagerScope(state, page)
key(pageData) {
Box(contentAlignment = Alignment.Center, modifier = pageData) {
scope.pageContent()
}
}
}
What exactly is the purpose of key
here?
Would love some more insight into how/what it does in general. The implementation of key
doesn’t betray its functionality, since the function params are “unused”.dewildte
03/09/2021, 1:04 AMColton Idle
03/09/2021, 1:11 AM@Composable
fun PadMyContentWithTitle(
modifier: Modifier = Modifier,
header: String = "",
content: @Composable ColumnScope.() -> Unit
) {
Column(modifier) {
Text(text = header)
content(modifier.padding(horizontal = 16.dp))
}
}
I want to have a composable with that essentially takes in another compasable (slot) but pads it on the left and right and adds a Text on top of it. This is what I came up with but I can't actually call content(modifier.padding(horizontal = 16.dp))
. Is the way around this just to nest the context in a Box/Column and apply padding to that?Colton Idle
03/09/2021, 1:11 AM@Composable
fun PadMyContentWithTitle(
modifier: Modifier = Modifier,
header: String = "",
content: @Composable ColumnScope.() -> Unit
) {
Column(modifier) {
Text(text = header)
content(modifier.padding(horizontal = 16.dp))
}
}
I want to have a composable with that essentially takes in another compasable (slot) but pads it on the left and right and adds a Text on top of it. This is what I came up with but I can't actually call content(modifier.padding(horizontal = 16.dp))
. Is the way around this just to nest the context in a Box/Column and apply padding to that?Timo Drick
03/09/2021, 2:14 AMcontent: @Composable ColumnScope.(PaddingValues) -> Unit
Scaffold do it this way. But it depends on what you want.Colton Idle
03/09/2021, 3:05 AMcontent(ColumnScope, PaddingValues(horizontal = 16.dp))
I did look into the Scaffold source but I am admittedly a little bit lost.Ian Lake
03/09/2021, 3:34 AMTimo Drick
03/09/2021, 8:44 AM@Composable
fun PadMyContentWithTitle(
modifier: Modifier = Modifier,
header: String = "",
content: @Composable ColumnScope.() -> Unit
) {
Column(modifier) {
Text(text = header)
Column(modifier.padding(horizontal = 16.dp)) {
content()
}
}
}
Colton Idle
03/09/2021, 3:59 PM