loloof64
01/08/2022, 9:57 AMLazyColumn
where doing a long click on each of item is supposed to show the same DropDownMenu
but above the item. I know that I can control the position of the DropDownMenu
using a Box
, but what is the most efficient way to handle this feature ? Should I add conditionnaly (with an if
clause) a DropDownMenu
for each item ? I mean, inside each item inside LazyColumn
, use a Box
and if(menuOpened){ DropDownMenu{...}}
? Or should I avoid that ?myanmarking
01/08/2022, 11:24 AMLuis Daivid
01/08/2022, 2:08 PMBy using the saveState and restoreState flags, the state and back stack of that item is correctly saved and restored as you swap between bottom navigation items.
and of course it is recomposed every time even though it is applied. What should I do?Javier
01/08/2022, 2:09 PMOnPointerEvent
common API for Desktop and Android?Solomon Tolu Samuel
01/08/2022, 10:58 PMDavid W
01/09/2022, 6:16 AMLazyVerticalGrid
with adaptive cells?
I searched here and google, but there weren't any solutions.
edit: all set, came up with a different solution.David W
01/09/2022, 8:15 AMStylianos Gakis
01/09/2022, 4:34 PMval lifecycleOwner = LocalLifecycleOwner.current
var audioPlayer: AudioPlayer? by remember {
mutableStateOf(null)
}
DisposableEffect(audioUrl, lifecycleOwner) {
val localAudioPlayer = AudioPlayer(audioUrl, lifecycleOwner)
audioPlayer = localAudioPlayer
onDispose {
localAudioPlayer.cleanup()
}
}
So using DisposableEffect to make sure to cleanup the AudioPlayer in case any of the keys change and I create a new instance of AudioPlayer so I cleanup the old one, or if it leaves the composition.
This feels a bit hacky however, especially with the initial null state above it, making the code below this awkward too. Is there some better approach I could possibly look into instead?Rob
01/09/2022, 5:26 PMdewildte
01/09/2022, 7:02 PMAyfri
01/09/2022, 10:57 PMDavid W
01/10/2022, 4:50 AMBox(
modifier = Modifier
.background(
brush = Brush.horizontalGradient(
colors = listOf(
MaterialTheme.colors.primary.lighten(50).copy(alpha = 0.35f),
Color.Transparent
),
)
)
.size(32.dp)
)
{}
Slackbot
01/10/2022, 10:57 AMdimsuz
01/10/2022, 2:30 PMLocalWindowInsets.current.ime.bottom
does not update after keyboard is hidden. it continues to report padding as though keyboard is visible 🤔Samir Basnet
01/10/2022, 2:34 PMMichael Langford
01/10/2022, 5:32 PMColton Idle
01/10/2022, 9:36 PMBilly Newman
01/10/2022, 10:46 PMSimple nested scrolling requires no action on your part. Gestures that initiate a scrolling action are propagated from children to parents automatically, such that when the child can't scroll any further, the gesture is handled by its parent element.
When I scroll up in the bottom sheet, the bottom sheet first resizes to fill the screen then properly scrolls to the bottom of the content, which is the expected behavior. However, when trying to scroll back to the top of the content (ie dragging down), the bottom sheet starts to collapse instead of scrolling the content down first.eygraber
01/10/2022, 10:58 PMRick Regan
01/11/2022, 12:46 AMlateinit var myState: MutableState<MyState>
then I have to reference with myState.value.myProperty
. If I do var myState: MyState? by mutableStateOf(null)
then I have to reference with myState?.myProperty
(or other ways of dealing with nullable types). Is there a form that lets you use myState.myProperty
with lateinit
?Afzal Najam
01/11/2022, 1:24 AMeygraber
01/11/2022, 1:56 AMexpandedHintEnabled=false
from TextInputLayout
for a TextField
?linus muema
01/11/2022, 4:55 AMeygraber
01/11/2022, 5:00 AMjava.time.LocalDate
to a composable function, or should it be wrapped in something marked as @Immutable
?Scott Kruse
01/11/2022, 5:03 AMSamir Basnet
01/11/2022, 6:04 AMK Merle
01/11/2022, 6:46 AMDeepak Gahlot
01/11/2022, 7:35 AMmyanmarking
01/11/2022, 10:28 AMDamian Kwaśniak
01/11/2022, 11:18 AMsetViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed)
It works fine as long as I am not updating the view when it is still attached to the window. If so, I get an exception added in thread.
1. User enters the RecyclerView where each item has show more button
2. User press show more button what causes the view to redraw (bind method from ViewHolder is called)
3. crash
Any ideas?Damian Kwaśniak
01/11/2022, 11:18 AMsetViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed)
It works fine as long as I am not updating the view when it is still attached to the window. If so, I get an exception added in thread.
1. User enters the RecyclerView where each item has show more button
2. User press show more button what causes the view to redraw (bind method from ViewHolder is called)
3. crash
Any ideas?java.lang.IllegalStateException: View tree for androidx.compose.ui.platform.ComposeView{f43c13c G.E...... ......ID 58,413-912,470 #7f090115 app:id/contactOpportunityItemRelatedContactsComposeView} has no ViewTreeLifecycleOwner
at androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed.installFor(ViewCompositionStrategy.android.kt:109)
at androidx.compose.ui.platform.AbstractComposeView.setViewCompositionStrategy(ComposeView.android.kt:136)
at com.siemens.presentation.contactdetails.viewholder.opportunity.OpportunityViewHolder.bind(OpportunityViewHolder.kt:78)
at com.siemens.presentation.contactdetails.viewholder.opportunity.OpportunityViewHolder.bind(OpportunityViewHolder.kt:49)
at com.siemens.presentation.accountdetails.AccountDetailsAdapter.onBindViewHolder(AccountDetailsAdapter.kt:136)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6194)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6460)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6300)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6296)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1631)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4012)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578)
Arjun Achatz
01/11/2022, 12:52 PMDamian Kwaśniak
01/11/2022, 2:00 PMbinding.lifecycleOwner?.let {
val strategy = ViewCompositionStrategy.DisposeOnLifecycleDestroyed(it)
setViewCompositionStrategy(strategy)
}
and in the init block of my ViewHolder I have to set binding's lifecycleOwner manually with:
init {
binding.lifecycleOwner = parent.findViewTreeLifecycleOwner()
}
but I am not sure if this solution is an equivalent of whet they suggest in the documentation