Devesh Sanghvi
07/07/2021, 11:23 PMColton Idle
07/08/2021, 5:13 AMharry248
07/08/2021, 7:45 AMken_kentan
07/08/2021, 8:42 AMDaniele Segato
07/08/2021, 9:37 AMModifier.onSizeChange()
doesn't work in Preview?
var cardSize by remember { mutableStateOf<IntSize?>(null) }
Box(
modifier = Modifier
.background(Color.White)
.aspectRatio(1f)
.fillMaxSize()
.onSizeChanged { cardSize = it }
) {
Text(text = "Size is = $cardSize")
}
the preview always show "Size is null" while if I run it I get the size as I expect?
Is there a way to fix the preview?Daniele Segato
07/08/2021, 10:29 AM@Preview
placeholder feature? For instance if I'm creating a custom Painter
and I want to provide a preview for that?
Example: I've a QRCode to be generated and I want to provide a preview that look like a QRCode without actually running the code to generate itPrashast Rastogi
07/08/2021, 10:35 AM@Composable
fun CircularProgressIndicator(
/@FloatRange(from = 0.0, to = 1.0)/
progress: Float,
modifier: Modifier = Modifier,
color: Color = MaterialTheme.colors.primary,
strokeWidth: Dp = ProgressIndicatorDefaults.StrokeWidth
) {
val stroke = with(LocalDensity.current) {
Stroke(width = strokeWidth.toPx(), cap = StrokeCap.Butt)
}
Canvas(
modifier
.progressSemantics(progress)
.size(CircularIndicatorDiameter)
.focusable()
) {
// Start at 12 O'clock
val startAngle = 270f
val sweep = progress * 360f
drawDeterminateCircularIndicator(startAngle, sweep, color, stroke)
}
}
Chris Miller
07/08/2021, 10:37 AMArtur Schwarz
07/08/2021, 12:02 PMMarek Hlava
07/08/2021, 12:15 PMButton(
modifier = Modifier.semantics {
contentDescription = "my-button"
},
onClick = {},
) {
Text("Click me")
}
What works is moving the modifier to the Text instead but I can't find this behavior change mentioned in release notes.
Update: cannot put contentDescription on TextFields either.Gaurav Tyagi
07/08/2021, 12:54 PMandroid:digits="0,1,2,3,4,5,6,7,8,9,*,qwertzuiopasdfghjklyxcvbnm"
how can implement "android:digits" functionality with BasicTextField in composeDaniele Segato
07/08/2021, 1:10 PMiamthevoid
07/08/2021, 1:36 PMremember
function? What happens with remembered value when composable leave the composition? For exapmle
if (loading) {
Loading()
} else {
View(someLogic::calculateParam) // here inside remember 'someLogic::calculateParam' result has called
}
For example on next composition composition loading
is true, on next one false. In log i see that calculateResult changes, but what happens with previous? Is anywhere strong reference to it?iamthevoid
07/08/2021, 3:55 PMMarcin Mazurek
07/08/2021, 4:08 PM@Composable
private fun CheckboxImpl(
enabled: Boolean,
value: ToggleableState,
modifier: Modifier,
colors: CheckboxColors
) {
....
drawBox(
boxColor = boxColor,
borderColor = borderColor,
radius = RadiusSize.toPx(),
strokeWidth = strokeWidthPx
)
Chris Johnson
07/08/2021, 4:24 PMview.getLocalVisibleRect(rect)
in compose? Also, is there another way to get the rect of a compose view without using onGloballyPositioned
from the modifier?Gaurav Tyagi
07/08/2021, 4:45 PMis there an equivalent to android:digits in compose?
Yuri Drigin
07/08/2021, 5:26 PMJan
07/08/2021, 5:30 PMbrandonmcansh
07/08/2021, 5:52 PMPeter Mandeljc
07/08/2021, 7:54 PMModalBottomSheetLayout
fully expand? Calling state.show()
only half expands it.therealbluepandabear
07/08/2021, 9:42 PMtad
07/08/2021, 11:25 PMSnapshotStateList
thread-safe? e.g. can two threads append and prepend to the list simultaneously?Andy Yang
07/09/2021, 4:59 AMLazyColumn
-> ContentPadding
last item padding not working?
e.g.
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(vertical = 30.dp),
) {
// ... items
// but last item doesn't with bottom padding
}
Shakil Karim
07/09/2021, 5:31 AMNikola Milovic
07/09/2021, 7:07 AMMarcin Mazurek
07/09/2021, 8:06 AMalorma
07/09/2021, 8:16 AMLayout(
modifier = modifier,
content = content
) { measurables, constraints ->
// Don't constrain child views further, measure them with given constraints
// List of measured children
val placeables = measurables.map { measurable ->
// Measure each child
measurable.measure(constraints)
}
}
But, with RC01, whenever I try to import and create one, Layout
has a new parameter called measurePolicy: MeasurePolicy
... what should we do with this one?Daniel Burnhan
07/09/2021, 8:44 AMMagnus Gudmandsen
07/09/2021, 10:04 AMMagnus Gudmandsen
07/09/2021, 10:04 AMattachBaseContext
in activity, and wrap the context.
This works as expected everywhere else:
Locale.getDefault() returns the overriden language.
Calling getString in Fragment.onStart
(or outside onStart) returns the overriden language string
However:
Calling getString inside of a Composable
block gives me the string from the device language. Doesn’t matter how I call it: fragment.getString
, activity.getString
, or using the Compose stringResources
function.Albert Chang
07/09/2021, 10:19 AMMagnus Gudmandsen
07/09/2021, 12:06 PMattachBaseContext
part actually works, and my issue was 100% unrelated to Compose. It was all due to missing an important step in generating translations in our translation library that we’re using 😅
Thanks for the help anyway 🙂