ste
07/25/2022, 5:34 PMRoudy Korkis Kanaan
07/25/2022, 4:42 AMChannel
doesn't guarantee delivery in some cases. But is it a bad practice to separate the event class from the ui state class? I've attached an example. Mainly because I don't think a ui event should trigger the re-composition of ui state rendered by compose, the OneShotEventEffect
would just re-compose itself. Or are we supposed to have the entire state of the ui in a single class?Sean McQuillan [G]
07/25/2022, 6:45 PMParagraph
?
class MyParagraph: Paragraph {...}
If so, can you share a bit more about what you're doing and why you chose not to wrap it?
class MyParagraphWrapper(val paragraph: Paragraph)
Jasmin Fajkic
07/25/2022, 7:05 PMDaniel Rotenberg
07/25/2022, 8:59 PMzt
07/26/2022, 3:32 AMLazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 14.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
items(videoListItems) { video ->
if (video == null) return@items
VideoCard(
video = video,
onClick = { onClickVideo(video.id) },
onClickChannel = { onClickChannel(video.author!!.id) }
)
}
item {
videoListItems.loadState.apply {
when (append) {
is LoadState.Loading -> {
CircularProgressIndicator(modifier = Modifier.padding(4.dp))
}
is LoadState.Error -> {
(append as LoadState.Error).error.printStackTrace()
Text("An error has occurred")
}
else -> Unit
}
}
}
}
Colton Idle
07/26/2022, 4:53 AMBottomNavigation {
items.forEachIndexed { index, item ->
BottomNavigationItem(
icon = { Icon(Icons.Filled.Favorite, contentDescription = null) },
label = { Text(item) },
selected = selectedItem == index,
onClick = { selectedItem = index }
)}}
but on samsung devices (which are typically "zoomed in" out of the box) the text and icon overlap. If I try to increase the icon size (or add padding) then it grows larger than the bottomBar can support and so my icons are cut off. Surprisingly the BottomNavigationBar doesn't grow in height to support the larger text size or icon size. Is there any "right" way to fix this or should I look to implement an autosize text for the tab text?allan.conda
07/26/2022, 7:31 AMremeasure
instead. Is there an optimization happening somewhere for scrolling?Stylianos Gakis
07/26/2022, 9:46 AMvar width by remember { mutableStateOf(0f) } // 0f or 0 or 0.dp not sure what I need yet
var height by remember { mutableStateOf(0f) }
Canvas can get you a size but can only set it on the next frame to the local state as I understand.
Canvas(Modifier.fillMaxSize()) {
width = this.size.width
height = this.size.height
}
OnGloballyPositioned also on the next frame
.onGloballyPositioned { it.size.height | width }
BoxWithConstraints uses subcomposition.
My use case is trying to get the bounds of my Canvas in order to animate something that’s moving inside of it and make sure it’s not going outside.
What other options do I have? Or is getting it from canvas and saving it to a local state the way to go? Also what if I was not using a Canvas anyway, what other alternatives are there?Lukasz Kalnik
07/26/2022, 12:42 PMProgrammistich
07/26/2022, 3:44 PMcombinedClickable()
have onClick/onDouble/onLong but dont have onHoldLokik Soni
07/26/2022, 6:00 PMval isAlarmOn by viewModel.alarmBtnState.collectAsState()
In ViewModel
val alarmBtnState = isAlarmActivated(Unit).map {
it.successOr(DEF_VAL_ALARM_ACTIVATED)
}.stateIn(viewModelScope, WhileViewSubscribed, DEF_VAL_ALARM_ACTIVATED)
Chuck Stein
07/26/2022, 7:45 PMLazyList
is still under development, but what's the recommendation for animating insertions/deletions into a regular Column
or Row
?Raymond
07/26/2022, 8:09 PMdeviant
07/27/2022, 10:54 AMcompose.material
and compose.material3
in same project (same screen)?Arkadii Ivanov
07/27/2022, 10:55 AMJi Sungbin
07/27/2022, 1:18 PMliveLiterals
plugin option? When I try to apply it, I get this error: Multiple values are not allowed for plugin option androidx.compose.compiler.plugins.kotlin:liveLiterals.
freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:liveLiterals=false"
]
jasu
07/27/2022, 1:35 PMcompose-hilt-navigation
and in one of the screens i’m using BackHandler(onBack = someCall). Somecall is not getting called any idea?
inshort: back handler is not workingRafs
07/27/2022, 5:16 PMFlowRow/Column
but they aren’t available anymore.Ale Stamato
07/27/2022, 5:17 PMBenjamin Deroche
07/27/2022, 7:21 PMArrowCircleLeft
and ArrowCircleRight
icons missing from Android Compose? I use all 4 of them (left, top, right, bottom) in my Kotlin Multiplatform app for Android and JVM. Android Studio show no error, the JVM app compile and run just fine, but the Android app fail to compile because I get an unresolved reference for left and right arrowsitnoles
07/27/2022, 8:02 PMHarold Scissors
07/27/2022, 8:28 PMrepeatOnLifecycle
removed from lifecycle-runtime-ktx
? I'm looking to solve an issue where we need link produceState
based on lifecycle events within a composable function.Harold Scissors
07/27/2022, 11:23 PMLifecycle.State.RESUMED
? I tried this which was posted before on similar threads but it seems because produceState
conflates value
, only the first value causes recomposition. So, on the first resume, we see the value, on the second (if it is the same) we see nothing. Ideally, we'd want to see it on every RESUMED
even if it is the same.oianmol
07/28/2022, 3:51 AMTin Tran
07/28/2022, 4:34 AMModalBottomSheetState
to ViewModel?Ali Khaleqi Yekta
07/28/2022, 5:46 AM1.7.10
, but the latest version uses 1.7.0
. Is there a way to achieve this?
I heard about setting the compiler version for Jetpack Compose, I don't know if it is applicable to JB Compose.
Slack ConversationKazik
07/28/2022, 6:23 AMLaunchedEffect(Unit) {
navController.currentBackStackEntryFlow
.filter { it.destination.route == parentRoute }
.collect { onClose() }
}
zt
07/28/2022, 6:36 AMArun Joseph
07/28/2022, 6:52 AMaccompanist-navigation-animation
and rotation, I observe that the obtained viewmodel
leaks when transitions between screens, when each screen forces certain orientation. Sample code in thread.