Colton Idle
08/01/2022, 5:26 PMjames
08/02/2022, 10:54 AMCan Korkmaz
08/01/2022, 11:56 AMColumn(
Modifier
.fillMaxSize()
.verticalScroll(scrollState)
.background(colorResource(id = R.color.colorBackground))
) {
SwipeRefresh(state = swipeRefreshState, onRefresh = {
scope.launch {
pagingData.refresh()
delay(TradeHistoryFragment.REFRESH_ATTEMPT_DELAY)
}
}) {
Column(Modifier.fillMaxWidth().wrapContentHeight()) {
Marko Novakovic
08/01/2022, 4:10 PMModalBottomSheetLayout
sheetContent
never leaves composition. is tracking offset the only way to observe is it visible or not?Stylianos Gakis
08/01/2022, 10:28 AMagrosner
07/29/2022, 5:29 PMPiotr Prus
07/30/2022, 8:37 PMonValueChangedFinished
when use on slider with steps and snapping. It do not have a value parameter, so I am taking the parameter from my remembered field. The value that is stored in the moment of onValueChangedFinished
is not the value that slider will snap to. It is the value from the moment I released the finger. I do not understand the point of this lambda and I do not know how to properly update the slider value, since I allow only these values from step point, not float from the middle. Code and example in the thread 🧵 👇Aaron Waller
08/02/2022, 1:54 PMscope.launch {
val snackbarResult = scaffoldState.snackbarHostState.showSnackbar(
"Grant permission to modify device audio",
actionLabel = "Settings"
)
when (snackbarResult) {
SnackbarResult.Dismissed -> Log.d("SnackbarDemo", "Dismissed")
SnackbarResult.ActionPerformed -> Log.d("SnackbarDemo", "Snackbar's button clicked")
}
}
I want to launch an Intent on the “Settings” label click but it calls Dismissed when I click the label of the SnackBar. What am I doing wrong? When is it calling ActionPerformed?KotlinLeaner
08/02/2022, 1:44 PMCasey Brooks
08/02/2022, 2:09 PMLandry Norris
08/02/2022, 2:46 PMLilly
07/29/2022, 6:18 AMfun someViewModelCall() {
viewModelScope.launch(Dispatchers.Default) { // light stuff }
}
EDIT: Alternate question would be, if it is common that skipped frames happen ocasionally?iroyo
08/02/2022, 3:37 PMLazyColumn
for phone and a LazyVerticalGrid
for tablets.
• Just a LazyVerticalGrid
with a different column value (1 for phones) columns = GridCells.Fixed ()
Chuck Stein
08/02/2022, 4:17 PMLazyListState.animateScrollToItem
? I noticed that ScrollableState.animateScrollBy
accepts an animationSpec
but animateScrollToItem
does notColton Idle
08/02/2022, 5:41 PMText
and instead am required to use CustomText
and so I need to pass in the colors. I thought TextFieldDefaults.textFieldColors().labelColor()
would work.
label = { CustomText(
text = labelText,
style = MyTextStyle.body,
TextFieldDefaults.textFieldColors().labelColor(),
)
},
Kevin Worth
08/02/2022, 6:08 PMText
with testTag == "title"
) and Image (object with stateDescription == "foo"
)
2. Swipe left to go to Screen B
3. Screen B has Title(Text
with testTag == "title"
) and Image (object with stateDescription == "foo"
)
So, how might one ensure that the swipe was successful (and finished)? How can we be confident we are seeing a new screen and we aren't accidentally still on Screen A? Note: We don't want to hardcode things such as "swiping from A to B means you first see 'Title A' and then you see 'Title B'", because we have many variants and many pages (not feasible to program everything through to "swiping from variantQ screen G takes you to variantQ screen H"). We just want to make sure that the user is able to swipe through all the pages (App Intro Slides) and then get to the app's home screen/activity at the end.
We've found it's feasible to capture the node id of either the Title or the Image and then make sure we don't get the same node Id after the swipe...but it feels like the type of thing that would likely be discouraged.
Any suggestions? Thanks for your time.Jasmin Fajkic
08/02/2022, 6:29 PMJasmin Fajkic
08/02/2022, 7:15 PMMicko Cabacungan
08/02/2022, 7:52 PMLazyColumn
Dirk Seewald
08/02/2022, 8:13 PMfillMaxWidth()
because that would expand the column. The column doesn't have a fixed size.
This is my code:
Box(propagateMinConstraints = true) {
Column(Modifier.wrapContentWidth().padding(24.dp).background(Color.Green.copy(alpha = 0.5f))) {
Row(Modifier) {
CompositionLocalProvider(Material3TextStyle provides MaterialTheme3.typography.headlineMedium) {
title()
}
}
Spacer(Modifier.height(32.dp))
Box {
//rowConstraints = constraints
CompositionLocalProvider(Material3TextStyle provides MaterialTheme3.typography.bodyLarge) {
Column(verticalArrangement = Arrangement.Center) {
content()
}
}
}
Spacer(Modifier.height(32.dp))
Row(
Modifier.background(Color.Red.copy(alpha = 0.4f)),
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End)
) {
dismissButton(scope)
confirmButton(scope)
}
}
}
ritesh
08/03/2022, 4:03 AMSharedFlow/PublishSubject
in composable? When we talk about uni-directional data flow, aren't we deviating from it when we start collecting the Shared/Publish
in an effect-handler or uni-directional flow just talks about events flowing from composable - up in the tree.Luis Daivid
08/03/2022, 5:41 AMSearch
, and there is B TextField whose ime is Next
. If you click A, ime is displayed as Search, but if you click B while the keyboard is shown, it is still Search
ime.
Is this Compose bug? or There any way to solve it?Tlaster
08/03/2022, 7:34 AMonValueChange
, but when we build a complex screen, we will get a lot of states and lots of onValueChange
, there will be many parameters for the composable method, is there any optimization we can do to reduce the parameters?
• If we have onValueChange
inside a very deep composable, it will pass all the way up to the top screen to actually handle the onValueChange
, is there a better way to do it instead of passing it all the way up to the top screen?deviant
08/03/2022, 8:25 AMderivedStateOf
should be always wrapped into remember
, i decided to make this helper
@Composable
fun <T> rememberDerived(calculation: () -> T) = remember {
derivedStateOf(calculation)
}
do you see any issues with it?Jasmin Fajkic
08/03/2022, 8:45 AMPiotr Prus
08/03/2022, 10:24 AMdeviant
08/03/2022, 12:45 PMBino
08/03/2022, 1:39 PMBino
08/03/2022, 1:39 PMCan Korkmaz
08/03/2022, 2:33 PMInside fragment::
transferWithdrawViewModel.asset.observe {
amountInput.setMaxNumberOfDecimalDigits(it.precision.toInt()) **this line
}
AndroidView(
modifier = modifier,
factory = { ctx ->
// Creates custom view
CurrencyEditText(ctx, null).apply {
Can Korkmaz
08/03/2022, 2:33 PMInside fragment::
transferWithdrawViewModel.asset.observe {
amountInput.setMaxNumberOfDecimalDigits(it.precision.toInt()) **this line
}
AndroidView(
modifier = modifier,
factory = { ctx ->
// Creates custom view
CurrencyEditText(ctx, null).apply {
Adam Powell
08/03/2022, 2:53 PMval asset by transferWithdrawViewModel.observeAsState()
AndroidView(
// ...
factory = { context ->
CurrencyEditText(context)
}
) { view ->
// update block - this observes `asset` and runs when it changes
view.setMaxNumberOfDecimalDigits(asset.precision.toInt())
}
Can Korkmaz
08/03/2022, 3:00 PM