Jayalakshmi Android
01/09/2023, 12:32 PMKiprop Victor
01/09/2023, 2:55 PMzt
01/09/2023, 6:14 PMval videos = viewModel.videos.collectAsLazyPagingItems()
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 14.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
items(
items = videos,
key = { it.id }
) { video ->
if (video == null) return@items
VideoCard(video)
}
}
Thomas Dougherty
01/09/2023, 9:23 PMThomas Dougherty
01/09/2023, 9:25 PMzsperske
01/09/2023, 10:13 PMRow(modifier = Modifier.fillMaxWidth().padding(8.dp),
verticalAlignment = CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween) {
Text(modifier = Modifier.defaultMinSize(minWidth = 100.dp), text = "Some text that gets really long and keeps going and going", overflow = TextOverflow.Ellipsis, maxLines = 1)
Text(modifier = Modifier.defaultMinSize(minWidth = 100.dp), text = "Other text that gets really long", overflow = TextOverflow.Ellipsis, maxLines = 1)
}
ursus
01/09/2023, 10:16 PMSurface
as a root composable in every example? Isn’t it supposed to be some sort of Background
(which doesnt exist in material theme)?
(also, why not expose the BoxScope
in the content lambda? Now I need to add another needless Box
if I need alignment)zt
01/10/2023, 12:15 AMLucas Kivi
01/10/2023, 12:38 AMCircularProgressIndicator
and Text
. I want the button to stay the same size across content changes. This is easy enough if we just convert the text size in Sp
to Dp
and set the CircularProgressIndicator
’s size padding accordingly. However, when we consider that the text may become multiple lines when font size is increased for accessibility this solution no longer works.
I am considering building a SubcomposeLayout
implementation that measures the Text
and sets the button height accordingly and then can conditionally forego placing the Text
. This seems a little computationally expensive. I don’t think Intrinsics
will solve my problem. Does anyone have a suggestion for me before I build out my abstract SubcomposeLayout
solution?Justin Xu
01/10/2023, 1:22 AMsen
01/10/2023, 3:18 AMsen
01/10/2023, 3:45 AMPopup
and attempting to resize the window, the Popup
is not removed unlike other applications. This appears to be the default behavior? Is there any work around to hide the Popup
when the user tries to resize the window, as it causes the Popup
to be in the improper place (technically the "right" place, but it shouldn't be there).Vrihas Pathak
01/10/2023, 10:25 AMthen()
" and "returning a modifier directly" while creating a custom modifier?Hasan Nagizade
01/10/2023, 12:06 PMZaki Shaikh
01/10/2023, 2:11 PMOmkar Amberkar
01/10/2023, 3:56 PMjava.lang.IllegalArgumentException: detached
at MobilePlayerViewModel$createSurfaceViewOnAttachStateChangeListener$1.onViewDetachedFromWindow(MobilePlayerViewModel.kt:356)
at android.view.View.dispatchDetachedFromWindow(View.java:21362)
at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:3949)
at android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:5785)
at androidx.compose.ui.viewinterop.AndroidViewHolder.setView$ui_release(AndroidViewHolder.android.kt:95)
at androidx.compose.ui.viewinterop.AndroidViewHolder$layoutNode$1$4.invoke(AndroidViewHolder.android.kt:310)
at androidx.compose.ui.viewinterop.AndroidViewHolder$layoutNode$1$4.invoke(AndroidViewHolder.android.kt:307)
at androidx.compose.ui.node.LayoutNode.detach$ui_release(LayoutNode.kt:420)
at androidx.compose.ui.node.LayoutNode.detach$ui_release(LayoutNode.kt:432)
at androidx.compose.ui.node.LayoutNode.detach$ui_release(LayoutNode.kt:432)
at androidx.compose.ui.node.LayoutNode.detach$ui_release(LayoutNode.kt:432)
at androidx.compose.ui.node.LayoutNode.detach$ui_release(LayoutNode.kt:432)
at androidx.compose.ui.node.LayoutNode.onChildRemoved(LayoutNode.kt:314)
at androidx.compose.ui.node.LayoutNode.removeAt$ui_release(LayoutNode.kt:288)
at androidx.compose.ui.node.UiApplier.remove(UiApplier.android.kt:35)
at androidx.compose.runtime.ComposerImpl$realizeMovement$1.invoke(Composer.kt:3835)
at androidx.compose.runtime.ComposerImpl$realizeMovement$1.invoke(Composer.kt:3835)
at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:808)
at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:839)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:995)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
at androidx.compose.runtime.Recomposer$HotReloadable.clearContent(Recomposer.kt:385)
at androidx.compose.runtime.Recomposer$RecomposerInfoImpl.saveStateAndDisposeForHotReload(Recomposer.kt:369)
at androidx.compose.runtime.Recomposer$Companion.saveStateAndDisposeForHotReload$runtime_release(Recomposer.kt:1285)
at androidx.compose.runtime.HotReloader$Companion.saveStateAndDispose(Composition.kt:1136)
at dalvik.system.VMDebug.nativeAttachAgent(Native Method)
at dalvik.system.VMDebug.attachAgent(VMDebug.java:656)
at android.app.ActivityThread.attemptAttachAgent(ActivityThread.java:4220)
at android.app.ActivityThread.handleAttachAgent(ActivityThread.java:4230)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2296)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
ursus
01/10/2023, 4:09 PMcollectAsState()
vs collectAsStateWithLifecycle()
on a viewmodel state in a app where screens are fragments.
I found out, surprisingly, that they behave the same.
If I push a new fragment, then the current fragment’s view gets destroyed, therefore compose “instance” there dies, and nothing is collected (observed), so no need for the withLifecycle
Guess that is nice and ultimately expected.
However, what I found as well, is that the state collection stops as well when app goes to background (still using collectAsState, not the withLifecycle
How is this possible? Does compose have some implicit hooks into the Activity
? Since in this case the fragment’s view does not get destroyedHåkon Pettersen
01/10/2023, 6:35 PMzsperske
01/10/2023, 9:19 PMModifier.minimumTouchTargetSize()
expands the actual size of the componentursus
01/10/2023, 9:44 PMActivity
lifecycle?Gonzalo Renedo
01/10/2023, 10:10 PMCarl Benson
01/11/2023, 8:14 AMMoritz Post
01/11/2023, 11:25 AMby
delegate, how do you deal with the case that the value is null? An if
check is an option but the value can not be smart-cast. What are you doing in that case? Example:
val user by viewModel.user.collectAsState(null)
if (user != null) {
// user? can not be cast to user?
}
For one observable flow you could also let
but that is very cumbersome when multiple values should be consumed. Any tips?Guilherme Delgado
01/11/2023, 12:47 PMLazyColumn
with stickyHeader
and itemsIndexed
. To build it I’m using .forEach { (header, data) ->
. Let’s say I would have a “today” button, how can I scroll to a desired stickyHeader
position making it the first item visible? As far as i know I don’t have access to stickyHeader
indexes 🤔Omkar Amberkar
01/11/2023, 2:01 PMTobias Preuss
01/11/2023, 3:20 PMcom.google.android.material.textfield.TextInputLayout
incl. hint outline, character limit text, error handling? Is there any recommendable open source library out there?CLOVIS
01/11/2023, 3:21 PMApplier
implementations need to be thread-safe? e.g. is it safe to create a Node
implementation that uses an ArrayList
to store its children?Landry Norris
01/11/2023, 3:31 PMTolriq
01/11/2023, 7:08 PMLandry Norris
01/11/2023, 8:15 PMjava.lang.IllegalStateException: calling recordModificationsOf and applyChanges concurrently is not supported
Landry Norris
01/11/2023, 8:15 PMjava.lang.IllegalStateException: calling recordModificationsOf and applyChanges concurrently is not supported