Manuel Lorenzo
08/24/2022, 1:59 PMandrew
08/24/2022, 2:34 PMJasmin Fajkic
08/24/2022, 7:04 PMSimona Stojanovic
08/24/2022, 8:02 PM1.3.0-beta01
Compose release, we are introducing some major changes to the way the Compose Modifier API works under the hood (⚠️ no public APIs have changed and it’s backwards compatible). If you notice any issues with modifiers or have any feedback when upgrading to 1.3.0-beta01
, please let us know here or by creating an issue. For more details around this change, check out the release notes.
Thanks all! 🤙Wojciech Rozwadowski
08/24/2022, 8:49 PMvalue class
with String
as key
for LazyColumn
item. Unfortunately I received
Type of the key testString is not supported. On Android you can only use types which can be stored inside the BundleIs there any chance to add custom
Saver
to LazyColumn
or to add support for value class
?Aaron Waller
08/24/2022, 11:03 PMsaveState = true
.
When I restart the application it of course fetches the up to date data from my graphql endpoint.
Is a SSOT system the only way to solve it?
Is it even possible in my case due to the constantly changing and user generated content?
P.S I’m using GraphQL Apollo + MVVM + Clean Architecture.mattinger
08/25/2022, 4:55 AMshow
or animateTo
functions of the ModalBottomSheetState outside of a composition, or i get this error: A MonotonicFrameClock is not available in this CoroutineContext. Callers should supply an appropriate MonotonicFrameClock using withContext
. I’ve boiled this down to a pretty simple example, which i will put in the thread. But the basic strategy i seem to have to resort to is to keep mutableState object, and then in the setContent
block, i can create a LaunchedEffect and collect that value and call the animateTo method instead.Shafayat Bin Mamun
08/25/2022, 5:19 AMK Merle
08/25/2022, 5:35 AM@Composable
fun Parent() {
val argument = {
// Do something
}
Child(param = argument)
}
fun Child(param: () -> Unit) {}
vs
@Composable
fun Parent() {
Child(param = {
// Do something
})
}
fun Child(param: () -> Unit) {}
Philip S
08/25/2022, 7:43 AMLazyColumn
is not hidden by soft keyboard and TextInput
when scrolled to bottom? Basically I want "This is message 5" to still be visible when opening keyboard. The activity uses android:windowSoftInputMode="adjustResize"
and I tried using some padding values from https://google.github.io/accompanist/insets/ without effect.KotlinLeaner
08/25/2022, 8:45 AMColumn {
items.forEachIndexed { index, item ->
if (index != items.lastIndex) {
Column(
Modifier.padding(0.dp, 0.dp, 0.dp, dimensionResource(R.dimen.item_view_padding))
) { }
}
}
}
Can Korkmaz
08/25/2022, 9:12 AMimageView.animateByResource(R.anim.shrink_animation) {
imageView.setScaleBoth(0f)
}
would that default to initial value at every compositon. Like adding a lifecycleEventObserver in update state, it would be added many times since it is added every recomposition. I pass update block as lambda parameter by the way. If the way I understand the update block mechanics is correct, then I should wrap updates that I want to execute only once in an Event, and use with getIfNotHandled(). Or with additional control blocks.nuhkoca
08/25/2022, 11:57 AMIf you are using LazyColumn/Row please make sure you provide a unique key for each item.
Did anybody face a similar problem with LazyList
?Zoltan Demant
08/25/2022, 2:08 PM1.3.0-beta01
had a huuuge impact on performance with debug builds (in a good way). What changed? Did the modifier refactor have this big of an impact? Its almost on-par with a release build now 🙌🏽Slackbot
08/25/2022, 2:18 PMJosé González D'Amico
08/25/2022, 3:09 PMhttps://youtu.be/-ZExs9Gncic▾
gsala
08/25/2022, 4:17 PMPaddingValues
. Sometimes I would like to combine padding values like WindowInsets.ime.asPaddingValues - PaddingValues(bottom = 30.dp)
. Other times I would just like to override some default padding values like BottomSheetDefaults.ContentPadding.copy(bottom = 0.dp)
. Shouldn’t this be easier in the compose APIs ? Or am I missing the right way to do this?Marco Pierucci
08/25/2022, 4:20 PMfocusManager.clearFocus()
If I expect text field to clear its focus upon button clicks?Igor Stevanovic
08/25/2022, 5:01 PMdimsuz
08/25/2022, 5:13 PMfun MyComposable(
value: Boolean,
slot1: @Composable () -> Unit = if (value) { Content1() } else { Content2() },
slot2: @Composable (() -> Unit)? = if (value) { Content1() } else null,
)
I recall having some state-related problems with one of those (or both), but can't recall exactly which ones.
Maybe one of the slots is ok and another is not? Or both ok/not ok?Leland Richardson [G]
08/25/2022, 5:21 PMContent1()
returns a @Composable () -> Unit
it should work fine. i think there used to be a bug related to this type of thing but shouldn’t be any more. please file one if it doesn’t workGarrett Coughlin
08/25/2022, 7:52 PMallan.conda
08/25/2022, 11:45 PMAmrJyniat
08/26/2022, 9:45 AMLaunchEffect()
has natural behavior like distinctUntilChanged()
?
I have an event for showing toast but it seems that show the toast only once.
Code in 🧵uli
08/26/2022, 12:11 PMStylianos Gakis
08/26/2022, 2:40 PMsetApplicationLocales()
recreates your Activity
, unless your app handles locale configuration changes by itself.”
Now I remember reading some discussions here, like this one where @Adam Powell suggests that compose handles those itself anyway.
Shouldn’t that mean that the documentation should reflect this behavior if it’s also the case for this config change too? It’d be great to know that directly from there without needing to be part of this slack channel.Colton Idle
08/26/2022, 2:44 PMGuilherme Almeida
08/26/2022, 4:10 PM@Composable
public fun NaiveWaveform(
waveform: Waveform,
progress: Float,
) {
Box(
modifier = Modifier
.width(256.dp)
.height(64.dp)
) {
Canvas(modifier = Modifier.fillMaxSize()) {
drawWaveform(waveform) // heavy drawing, rarely changes
drawProgress(progress) // changes every 500ms
}
}
}
The waveform is basically a wrapper for a FloatArray and progress is a float that goes from 0..1.
The problem here is that the waveform can have thousands of points to be drawn which makes it hard to be drawn alongside the progress line that updates every 500 ms.
Therefore I thought of creating two different Composables, one for each component. By doing that I should be able to leverage smart recomposition (Waveform is @Immutable) and only draw the waveform when it changes, keeping it independent from the progress line. Something like:
@Composable
public fun StackedWaveform(
waveform: Waveform,
progress: Float,
) {
Box(
Modifier
.width(256.dp)
.height(64.dp)
) {
WaveformCanvas(waveform = waveform)
ProgressCanvas(progress = progress)
}
}
@Composable
public fun ProgressCanvas(
progress: Float,
) {
println("ProgressCanvas")
Canvas(
modifier = Modifier.fillMaxSize(),
) {
println("Drawing Progress")
drawProgress(progress)
}
}
@Composable
public fun WaveformCanvas(
waveform: Waveform,
) {
println("WaveformCanvas")
Canvas(
modifier = Modifier.fillMaxSize(),
onDraw = {
println("Drawing waveform")
drawWaveform(waveform)
},
)
}
And now comes the bit I can’t understand quite well, the logs for these (with the progress animating):
I/System.out: WaveformCanvas
I/System.out: ProgressCanvas
I/System.out: Drawing waveform
I/System.out: Drawing Progress
-- this initial setup makes sense 👆, compose goes through each composable and draws on each Canvas, but then:
I/System.out: ProgressCanvas
I/System.out: Drawing waveform
I/System.out: Drawing Progress
I/System.out: ProgressCanvas
I/System.out: Drawing waveform
I/System.out: Drawing Progress
...
(repeats while progress is increasing)
Ideally, that second section in the logs should only have “ProgressCanvas” and “Drawing Progress” logs, but somehow it is also redrawing the waveform!
Looking at the logs, Compose seems to be skipping WaveformCanvas
(it only calls it once in the beggining, as intended), but moving forward the canvas inside still redraws the waveform everytime the progress changes 🤔
If anyone knows a better way to approach this please let know, thanks in advance!Jeremiah Jordan
08/26/2022, 7:29 PMimplementation "com.google.android.gms:play-services-maps:$play_maps_version"
implementation "com.google.maps.android:android-maps-utils:$maps_compose_version"
implementation "com.google.maps.android:maps-compose:$maps_compose_version"
And after googling a bit, it looks like it belongs to this package:
implementation "com.google.maps.android.compose:$maps_compose_version"
Although it doesn't seem to actually load when I use it, even though I don't have any gradle errors.
I'm assuming that if it loaded correctly, I'd be able to use the experimental maps annotation @MapsComposeExperimentalApi
, but so far I haven't figured out the gradle-kung fu to get that to happen.mattinger
08/26/2022, 7:30 PMmattinger
08/26/2022, 7:30 PMStylianos Gakis
08/26/2022, 7:34 PMBasicText
as it's the one you're falling back to if you want the barebones text which you have full control over. It'd be surprising if the material one functioned that way I'd say, not this one.Siyamed
08/26/2022, 7:43 PMzsperske
08/27/2022, 12:13 AM