Stylianos Gakis
08/16/2022, 9:10 AMJérémy CROS
08/16/2022, 10:08 AMgalex
08/16/2022, 10:24 AMTextField
s and we hide and show those depending on some conditions.
I wonder how to manage correctly the "next button" of the keyboard 🤔
If a TextFied
is inside AnimatedVisibility() {}
, when not visible, is it part of the composition still or not? Will the keyboard go to the next one?Louis Pullen-Freilich [G]
08/16/2022, 11:59 AMStylianos Gakis
08/16/2022, 2:29 PMcontentPadding
which is super convenient to do smth like this LazyColumn(contentPadding = WindowInsets.safeDrawing.asPaddingValues())
.
However when working with something that does not provide this convenient contentPadding
parameter, one has to do something like this instead
Column(Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)).verticalScroll(rememberScrollState())) {
Spacer(Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(<http://WindowInsetsSides.Top|WindowInsetsSides.Top>)))
Stuff()
Spacer(Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom)))
}
Is this simply the way to go or am I missing some API?Tolriq
08/16/2022, 3:29 PMStylianos Gakis
08/16/2022, 10:00 PMBox {
SomeScrollableContent(Modifier.fillMaxSize())
BottomAnchoredItem(Modifier.align(Alignment.BottomCenter))
}
Is there a way to make sure that my scrollable content is providing enough extra space at the end of the scrollable content so that when I’m scrolled all the way to the bottom the items are over this bottom anchored item?Stylianos Gakis
08/16/2022, 11:01 PMFakePreviewImageLoader()
on each of those previews, but I must imagine someone else has had this before, so I wonder if there’s something better I could do.spierce7
08/16/2022, 11:44 PMEllen Spertus
08/17/2022, 2:50 AMIn Compose, you call the composable function again with new data. Doing so causes the function to be recomposed--the widgets emitted by the function are redrawn, if necessary, with new data. The Compose framework can intelligently recompose only the components that changed.
For example, consider this composable function which displays a button:
```@Composable
fun ClickCounter(clicks: Int, onClick: () -> Unit) {
Button(onClick = onClick) {
Text("I've been clicked $clicks times")
}
}```
Every time the button is clicked, the caller updates the value ofI don't understand why the last sentence is true. We don't see the.clicks
onClick
function. Are we supposed to infer that it is () -> clicks++
and that clicks
is bound to the parameter?Asad Mukhtar
08/17/2022, 6:22 AMderivedStateOf {
buildAnnotatedString {
withStyle(
style = SpanStyle(
color = PrimaryTextColor,
fontSize = TextUnit(12f, TextUnitType.Sp),
fontFamily = FontFamily(listOf(Font(R.font.poppins_regular)))
)
) {
append(stringResource(R.string.dont_have_an_account))
}
withStyle(
style = SpanStyle(
color = BlueColor,
fontSize = TextUnit(12f, TextUnitType.Sp),
fontFamily = FontFamily(listOf(Font(R.font.poppins_semibold)))
)
) {
append(" Create Here")
}
}
}
Jason Ankers
08/17/2022, 6:40 AMUnconfinedTestDispatcher
in tests? It creates some weird scenarios. I.e. a network request followed by a navigate call inside a coroutine launched with rememberCoroutineScope
will fail because it wont swap back to the main threadTlaster
08/17/2022, 9:12 AMandroidx.compose.material.MaterialTheme.colors.isLight
in androidx.compose.material3.MaterialTheme.colorScheme
?Aashit Shah
08/17/2022, 10:11 AM1.2.0-beta02
java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
at androidx.compose.runtime.snapshots.SnapshotKt.readError(Snapshot.kt:1827)
at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1822)
at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1813)
at androidx.compose.runtime.SnapshotMutableStateImpl.getValue(SnapshotState.kt:130)
at androidx.compose.animation.core.AnimationState.getValue(AnimationState.kt:344)
at androidx.compose.animation.core.SuspendAnimationKt.animateDecay(SuspendAnimation.kt:190)
at androidx.compose.animation.core.SuspendAnimationKt.animateDecay$default(SuspendAnimation.kt:182)
at androidx.compose.foundation.gestures.DefaultFlingBehavior.performFling(Scrollable.kt:442)
at androidx.compose.foundation.gestures.ScrollingLogic$doFlingAnimation$2.invokeSuspend(Scrollable.kt:358)
at androidx.compose.foundation.gestures.ScrollingLogic$doFlingAnimation$2.invoke(Unknown Source:8)
at androidx.compose.foundation.gestures.ScrollingLogic$doFlingAnimation$2.invoke(Unknown Source:4)
at androidx.compose.foundation.gestures.DefaultScrollableState$scroll$2$1.invokeSuspend(ScrollableState.kt:148)
at androidx.compose.foundation.gestures.DefaultScrollableState$scroll$2$1.invoke(Unknown Source:8)
at androidx.compose.foundation.gestures.DefaultScrollableState$scroll$2$1.invoke(Unknown Source:4)
at androidx.compose.foundation.MutatorMutex$mutateWith$2.invokeSuspend(MutatorMutex.kt:160)
at androidx.compose.foundation.MutatorMutex$mutateWith$2.invoke(Unknown Source:8)
at androidx.compose.foundation.MutatorMutex$mutateWith$2.invoke(Unknown Source:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at androidx.compose.foundation.MutatorMutex.mutateWith(MutatorMutex.kt:153)
at androidx.compose.foundation.gestures.DefaultScrollableState$scroll$2.invokeSuspend(ScrollableState.kt:145)
at androidx.compose.foundation.gestures.DefaultScrollableState$scroll$2.invoke(Unknown Source:8)
at androidx.compose.foundation.gestures.DefaultScrollableState$scroll$2.invoke(Unknown Source:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at androidx.compose.foundation.gestures.DefaultScrollableState.scroll(ScrollableState.kt:144)
at androidx.compose.foundation.lazy.grid.LazyGridState.scroll(LazyGridState.kt:279)
at androidx.compose.foundation.gestures.ScrollableState$DefaultImpls.scroll$default(ScrollableState.kt:51)
at androidx.compose.foundation.gestures.ScrollingLogic.doFlingAnimation-QWom1Mo(Scrollable.kt:345)
at androidx.compose.foundation.gestures.ScrollingLogic.onDragStopped(Scrollable.kt:335)
at androidx.compose.foundation.gestures.ScrollableKt$pointerScrollable$4$1.invokeSuspend(Scrollable.kt:216)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:68)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1225)
at android.view.Choreographer.doCallbacks(Choreographer.java:1024)
at android.view.ChoreographerExtImpl.checkScrollOptSceneEnable(ChoreographerExtImpl.java:319)
at android.view.Choreographer.doFrame(Choreographer.java:913)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1212)
E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:233)
at android.os.Looper.loop(Looper.java:344)
at android.app.ActivityThread.main(ActivityThread.java:8191)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@31e98ee, androidx.compose.runtime.BroadcastFrameClock@cb3d18f, StandaloneCoroutine{Cancelling}@603fc1c, AndroidUiDispatcher@2b1025]
Asad Mukhtar
08/17/2022, 12:59 PMagrosner
08/17/2022, 1:23 PM@Composable
override fun rememberUpdatedInstance(interactionSource: InteractionSource): IndicationInstance {
//..
remember(interactionSource) {
PressableIndicationInstance(
isPressed = isPressed,
cornerRadiusSizeInPx = cornerRadiusSize,
scale = scale,
overlayColor = color,
overlayOpacity = config.overlayOpacity,
hasOverlay = config.hasOverlay
)
}
}
nothing too crazy.dimsuz
08/17/2022, 1:39 PMpointerInput
to convert drag gestures into "rotary" input with polar coordinates and custom layout which keeps rotating buttons "upright" (using Modifier.rotate
wouldn't work here for them).
I have made it using "slots": slot for "rotating base" and slot for "button", so it's customizable. Maybe one day turn it into a small lib.deviant
08/17/2022, 2:13 PMColton Idle
08/17/2022, 3:53 PMcomposable(
Screen.FakeModal.route,
enterTransition = {
slideIntoContainer(AnimatedContentScope.SlideDirection.Up, animationSpec = tween(1500))
},
exitTransition = {
slideOutOfContainer(AnimatedContentScope.SlideDirection.Down, animationSpec = tween(1500))
},
Marko Novakovic
08/17/2022, 4:05 PMChuck Stein
08/18/2022, 2:18 AMrememberSaveable
with inputs
but despite what the javadoc says, the init
block is not rerun when the inputs
change. I need the value to be reinitialized when we return to this screen by popping the backstack and giving it new inputs
. Is this not possible?Kyant
08/18/2022, 6:02 AMAmrJyniat
08/18/2022, 8:56 AMjannis
08/18/2022, 9:03 AMActivity#addOnNewIntentListener()
within Compose. It works fine in general. However it's registered too later after a process death occurred. Code in 🧵PHondogo
08/18/2022, 9:14 AMsvenjacobs
08/18/2022, 9:51 AMval uiState: StateFlow<UiState> =
combine(
firstFlow,
secondFlow,
thirdFlow,
) { first, second, third ->
UiState(
first = first,
second = second,
third = third,
)
}.stateIn(...)
K Merle
08/18/2022, 10:16 AMKotlinLeaner
08/18/2022, 11:48 AMonActivityResult()
.
1. I am reading this stack overflow they are using LaunchEffect. So should I use this in my composable function.
2. I see @ianhanniballake stackoverflow using DisposableEffect so what's the use of this?
3. In normal xml activity we set setResult(RESULT_OK, intent)
on Activity B when we want to submit something. So what do we use in compose function? Now I am adding my code.AmrJyniat
08/18/2022, 11:59 AMLazyVerticalGrid
with fixed columns, which makes the width of the items controlled based on column count, but I want to set the item width from itself and the rest space be blank.
code in 🧵Trym Nilsen
08/18/2022, 1:41 PMLazyColumn
inside of a Surface
(styled to look like a bottomsheet) composable with a nestedScroll
modifier. Things work when I use my fingers, but when I turn on talkback and navigate the list using swiping to jump to the next items none of the methods on my NestedScrollConnection
is invoked, making the surface not reacting correctly to the scroll and not be translated correctly together with the scrolls of the lazy column. Has anybody else experienced this or know if there is a fix or workaround?Trym Nilsen
08/18/2022, 1:41 PMLazyColumn
inside of a Surface
(styled to look like a bottomsheet) composable with a nestedScroll
modifier. Things work when I use my fingers, but when I turn on talkback and navigate the list using swiping to jump to the next items none of the methods on my NestedScrollConnection
is invoked, making the surface not reacting correctly to the scroll and not be translated correctly together with the scrolls of the lazy column. Has anybody else experienced this or know if there is a fix or workaround?