Tower Guidev2
11/18/2022, 3:58 PMitnoles
11/18/2022, 6:23 PMSlackbot
11/18/2022, 7:25 PMenighma
11/18/2022, 10:28 PMitnoles
11/18/2022, 11:55 PMvar timer by remember { mutableStateOf(time) }
LaunchedEffect(key1 = timer) {
if (timer > 0) {
delay(1000L)
timer -= 1000L
}
}
Is this is best way to do timer per seconds?Colton Idle
11/19/2022, 3:44 AMZaki Shaikh
11/19/2022, 6:58 AMJasmin Fajkic
11/19/2022, 10:47 PMzt
11/20/2022, 5:00 AMv79
11/20/2022, 9:05 AMinit { }
block in a ViewModel called? The init block for Screen A's ViewModel doesn't seem to be triggered when swiping back from Screen B, for instance.Tolga ÇAĞLAYAN
11/20/2022, 11:37 AMGordon
11/20/2022, 1:12 PMpublic val Icons.Filled.Circle: ImageVector
get() {
if (_circle != null) {
return _circle!!
}
_circle = materialIcon(name = "Filled.Circle") {
materialPath {
moveTo(12.0f, 2.0f)
curveTo(6.47f, 2.0f, 2.0f, 6.47f, 2.0f, 12.0f)
reflectiveCurveToRelative(4.47f, 10.0f, 10.0f, 10.0f)
reflectiveCurveToRelative(10.0f, -4.47f, 10.0f, -10.0f)
reflectiveCurveTo(17.53f, 2.0f, 12.0f, 2.0f)
close()
}
}
return _circle!!
}
private var _circle: ImageVector? = null
And i wonder why doesn't it just use lazy initialization?
As in something like this:
public val Icons.Filled.Circle: ImageVector by lazy {
materialIcon(name = "Filled.Circle") {
materialPath {
moveTo(12.0f, 2.0f)
curveTo(6.47f, 2.0f, 2.0f, 6.47f, 2.0f, 12.0f)
reflectiveCurveToRelative(4.47f, 10.0f, 10.0f, 10.0f)
reflectiveCurveToRelative(10.0f, -4.47f, 10.0f, -10.0f)
reflectiveCurveTo(17.53f, 2.0f, 12.0f, 2.0f)
close()
}
}
}
Is it just a style issue? Or the second approach has hidden performance cost?nuhkoca
11/20/2022, 3:45 PMLazyStaggeredGrid
but I want the first item to take the full width. Isn’t there a span strategy as in the LazyGrid
?Ahmed Shehata
11/21/2022, 8:48 AMMarko Novakovic
11/21/2022, 10:39 AMrememberSaveable(viewModel) { viewModel.onCreate(); 1 }
with this I want to call onCreate()
only once and that when @Composable
is first created.
but why is onCreate()
called more than once?
what am missing here?
this can be related to other things in the app like DI setup for this etc. but I want to check is there something am missing about rememberSaveable
Ashish Gautam
11/21/2022, 10:39 AMMoritz Post
11/21/2022, 10:57 AMFlow
which comes from the paging library. Until that flow can acutally be created (it needs some parameters from the user) i would like to create an empty flow that can be observed in compose. Something like
val vacancies: Flow<PagingData<Vacancy>> = emptyFlow()
Now the question is: once i create that PagingData flow, how can i replace the emptyFlow()
with the new paging data flow while still keeping the state observation from compose intact?Tower Guidev2
11/21/2022, 11:54 AMStylianos Gakis
11/21/2022, 1:13 PMFahime Ghasemi
11/21/2022, 2:11 PMFahime Ghasemi
11/21/2022, 2:16 PMNikolas Guillen Leon
11/21/2022, 2:43 PM.onGloballyPositioned { layoutCoordinates ->
imageHeight =
with(localDensity) { layoutCoordinates.size.height.toDp() }
imageWidth =
with(localDensity) { layoutCoordinates.size.width.toDp() }
}
And I'm using them in an offset calculation like this
val offsetTop = windowInfo.screenHeight.minus(imageHeight).div(4)
val offsetStart = windowInfo.screenWidth.minus(imageWidth).div(4)
Nikolas Guillen Leon
11/21/2022, 2:44 PMmyanmarking
11/21/2022, 3:32 PMmyanmarking
11/21/2022, 4:26 PMSam Stone
11/22/2022, 3:22 AMenum
is the iphone 6sK Merle
11/22/2022, 5:58 AMstatmark56
11/22/2022, 6:08 AMTopAppBar
with title
set with Text
composable but with very long text. I expect the AppBar can adjust its height to follow the long text but apparently it sticks with default 56.dp. My question is there a way to automatically adjust the height or I should measure it manually as the only way?rsktash
11/22/2022, 6:55 AMhttps://i.stack.imgur.com/fwlgM.gif▾
ritesh
11/22/2022, 8:23 AMandroidx.compose.ui.platform.AndroidComposeView
inside xml, even though they are marked as internal in platform
module. Why linter isn't throwing any error?