thelumiereguy
11/22/2022, 10:19 AMitem
in LazyColumn/LazyRow? I know that it helps with items
2. What’s the key
composable for? I saw a code snippet recently where people were wrapping the content with key
composable - inside an items
block. Is there a difference between wrapping with key
vs specifying the key in the items parameter itself.
3. Suppose that we’re sending a state object to a composable, but we’re not reading/getting the value. And now, if the state changes, would this cause a recomposition?Clemens Kozmich
11/22/2022, 10:32 AMmyanmarking
11/22/2022, 11:07 AMdimsuz
11/22/2022, 11:57 AMLocalMinimumTouchTargetEnforcement
is working only on material3 components? What is the correct way to add similar functionality to a composable not based on Material component? For example I have custom button of height 32.dp and I want to add invisible touch area around it to make effective touch area of 48.dp height.PHondogo
11/22/2022, 12:08 PMharry248
11/22/2022, 2:48 PMLisandro Di Meo
11/22/2022, 3:06 PMTower Guidev2
11/22/2022, 3:41 PMAle Stamato
11/22/2022, 4:32 PMmyanmarking
11/22/2022, 5:17 PManimateFloatAsState(
targetValue = progress.percentage,
animationSpec = tween(
durationMillis = 1000,
easing = LinearEasing
)
)
to support a ‘pause’ state ?Arjan van Wieringen
11/22/2022, 7:22 PMIntrinsicSize.Min
on the Column and used fillMaxWidth
on the contents. But that doesn't work here. Any tips?
The gist is here: https://gist.github.com/avwie/9b0ee5f2882e8d26517f4ab7fc2b0408lhwdev
11/22/2022, 11:42 PMzt
11/23/2022, 2:23 AM@Composable
fun Player(
modifier: Modifier = Modifier,
player: Player
) {
AndroidView(
modifier = Modifier
.aspectRatio(16f / 9f)
.then(modifier),
factory = { context ->
SurfaceView(context)
},
update = { surfaceView ->
player.setVideoSurfaceView(surfaceView)
}
)
}
xxfast
11/23/2022, 4:52 AMLazyGridState
, when the columns are set to GridCells.Adaptive
?eygraber
11/23/2022, 6:22 AMPHondogo
11/23/2022, 9:21 AMK Merle
11/23/2022, 12:28 PMHold
a screen?Taeho Kim
11/23/2022, 12:56 PMclass MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
var age by remember { mutableStateOf(0) }
val person by remember {
derivedStateOf { "my age is $age" }
}
Column(modifier = Modifier.padding(16.dp)) {
Button(onClick = {
age += 1
Log.e("person", person)
}) {
Text(text = person)
}
Text(
text = person)
}
}
}
}
davechuks
11/23/2022, 5:17 PMKotlinLeaner
11/23/2022, 5:58 PMmutableStateOf("need value in here").
So anything we can use in compose ?Gonzalo Renedo
11/24/2022, 1:38 AMShankar Gollakota
11/24/2022, 3:56 AMKotlinLeaner
11/24/2022, 5:30 AMPHondogo
11/24/2022, 1:29 PMKotlinLeaner
11/24/2022, 1:32 PMColumn
inside my ColumnScope.ScanDeviceList
If I removed inside Column
form ColumnScope.ScanDeviceList
my views are misaligned. Is this because of AnimatedVisibility
? If yes, what is the solution for this? I am using AnimatedVisibility
because I want to give basic animation’s to my view and it also checking the condition. Many thanksSudhir Singh Khanger
11/24/2022, 5:34 PMSean Keane
11/24/2022, 6:19 PMGonzalo Renedo
11/24/2022, 7:25 PMPlease someone help me, yesterday I upgraded my phone to android 12 version, since then if I put installSplashScren() or something else before the setContent{} of the MainActivity.kt it fails and doesn't pass to the NavGraph(), when I remove it If it works fine, I don't understand what happens because navGraph doesn't work for me now and any other composable does, and the other way also works for me, removing the installSplashScreen if navGraph() works for me. I don't understand anything...
eygraber
11/24/2022, 8:31 PMbuildFeatures.compose = true
in my build.gradle.kts
?
If I don't set it, the IDE doesn't recognize files with compose in them, and doesn't show the preview window. If I do set it the preview window shows, but if I use certain composables the preview (and running the app) breaks with a NoSuchMethodError
. For example if my composable has a Text
, it fails with:
java.lang.NoSuchMethodError: 'void androidx.compose.material3.TextKt.Text-nZBYWUE(java.lang.String, androidx.compose.ui.Modifier, long, long, androidx.compose.ui.text.font.FontStyle, androidx.compose.ui.text.font.FontWeight, androidx.compose.ui.text.font.FontFamily, long, androidx.compose.ui.text.style.TextDecoration, androidx.compose.ui.text.style.TextAlign, long, int, boolean, int, int, _layoutlib_._internal_.kotlin.jvm.functions.Function1, androidx.compose.ui.text.TextStyle, androidx.compose.runtime.Composer, int, int, int)'
Daniel Okanin
11/24/2022, 9:36 PMDaniel Okanin
11/24/2022, 9:36 PMdewildte
11/24/2022, 10:10 PMLazyListState#layoutItemInfo
has this infomation.james
11/25/2022, 1:51 AMcanScrollForward
and canScrollBackward
properties to ScrollableState.. and it sounds like that’s exactly what you need
if you do need to deliver this functionality immediately then just grab the current value
and the maxValue
of your scroll state and compare them (if you’re checking for end of list)Daniel Okanin
11/25/2022, 6:46 AMjames
11/27/2022, 10:04 PMval scrollState = rememberScrollState()
val canScrollBackward by remember {
derivedStateOf {
scrollState.value > 0
}
}
then in your back handler code you can simply check if (canScrollBackward) { your scroll-to-top code } else { your dismiss code }
once you get that working you might even want to take it a little further and introduce some threshold, because if the user has scrolled a tiny bit (eg. only a few pixels) then they’re effectively still at the “top” already, but canScrollBackward
will be true because the scroll state is >0, and so the behaviour might feel a bit strange to the user.. but I’ll leave that one up to you 😄