Zach Klippenstein (he/him) [MOD]
05/21/2020, 9:48 PMmolikto
05/22/2020, 2:43 AMmanueldidonna
05/22/2020, 12:02 PMvar selection by state { TextRange(0, 0) }
var text by state { repository.getText() }
TextField(
value = TextFieldValue(text, selection),
onValueChange = {
selection = it.selection
// there is a a limit on the number of chars.
// The passed text is automatically truncated
text = repository.updateText(it.text)
}
)
When I exceed the number of chars, I have some problems with the keyboard that continues to record the inputs, so I have to press the delete button more times than needed.Socheat KHAUV
05/22/2020, 2:59 PMKlaas Kabini
05/23/2020, 3:30 AMpavi2410
05/23/2020, 1:34 PMpardom
05/23/2020, 2:40 PMAdapterList
? Can it be nested in a VerticalScroller
?Kazemihabib1996
05/23/2020, 3:38 PM(Html.fromHtml(htmlString , Html.FROM_HTML_MODE_LEGACY)));
in compose?camkadev
05/23/2020, 5:47 PMdev11
it’s impossible to extend Brush
class with message '<init>': it is private in 'Brush'
carbaj0
05/24/2020, 10:36 AMKazemihabib1996
05/24/2020, 5:41 PMIntrinsicSize.Min and Max
for example:
@Composable
fun SameWidthBoxes() {
// Builds a layout containing three Box having the same width as the widest one.
//
// Here preferredWidth min intrinsic is adding a width premeasurement pass for the
// Column, whose minimum intrinsic width will correspond to the preferred width of the largest
// Box. Then preferredWidth min intrinsic will measure the Column with tight width, the
// same as the premeasured minimum intrinsic width, which due to fillMaxWidth will force
// the Box's to use the same width.
Stack {
Column(Modifier.preferredWidth(IntrinsicSize.Min).fillMaxHeight()) {
Box(
modifier = Modifier.fillMaxWidth().preferredSize(20.dp, 10.dp),
backgroundColor = Color.Gray
)
Box(
modifier = Modifier.fillMaxWidth().preferredSize(30.dp, 10.dp),
backgroundColor = Color.Blue
)
Box(
modifier = Modifier.fillMaxWidth().preferredSize(10.dp, 10.dp),
backgroundColor = Color.Magenta
)
}
}
}
In this example changin Min
to Max
makes no difference.
I'm trying to understand the difference of them.
but in the below one:
@Composable
fun SameWidthTextBoxes() {
// Builds a layout containing three Text boxes having the same width as the widest one.
//
// Here preferredWidth max intrinsic is adding a width premeasurement pass for the Column,
// whose maximum intrinsic width will correspond to the preferred width of the largest
// Box. Then preferredWidth max intrinsic will measure the Column with tight width, the
// same as the premeasured maximum intrinsic width, which due to fillMaxWidth modifiers will
// force the Boxs to use the same width.
Stack {
Column(Modifier.preferredWidth(IntrinsicSize.Max).fillMaxHeight()) {
Box(Modifier.fillMaxWidth(), backgroundColor = Color.Gray) {
Text("Short text")
}
Box(Modifier.fillMaxWidth(), backgroundColor = Color.Blue) {
Text("Extremely long text giving the width of its siblings")
}
Box(Modifier.fillMaxWidth(), backgroundColor = Color.Magenta) {
Text("Medium length text")
}
}
}
}
it makes difference.
I can't understand why in the SameWidthBoxes
IntrinsicSize.Min
means :
minimum intrinsic width will correspond to the preferred width of the largest Box
why not the smallest Box.
as it is in SameWidthTextBoxes
sample.Socheat KHAUV
05/24/2020, 11:58 PMLeland Richardson [G]
05/25/2020, 2:29 PMDean Djermanović
05/25/2020, 6:06 PMonClick
doesn't trigger when I add ripple
modifier?
Clickable(onClick = { ... }) {
Icon(
...
modifier = Modifier.ripple(false) + Modifier.padding(4.dp)
)
}
When I remove Modifier.ripple(false)
, onClick
triggers normally.caelum19
05/25/2020, 6:11 PMBox(
modifier = Modifier
.preferredSize(500.dp, 500.dp)
.drawBackground(
HorizontalGradient(
0.0f to Color.Red,
0.5f to Color.Green,
1.0f to Color.Blue,
startX = Px.Zero,
endX = 500.dp.toPx()
)
)
)
I'd like for a gradient's end to match the parent's width - is there a nicer way to do this?camkadev
05/25/2020, 6:22 PMRuairi McGuigan
05/26/2020, 4:51 PMe: java.lang.NoSuchMethodError: org.jetbrains.kotlin.codegen.state.GenerationState$Builder.isIrBackend(Z)Lorg/jetbrains/kotlin/codegen/state/GenerationState$Builder;
kagomez
05/27/2020, 12:30 AMTristan
05/27/2020, 1:38 AMLilly
05/27/2020, 4:44 PMpavi2410
05/27/2020, 6:58 PMdoodla
05/27/2020, 7:14 PMAndroidView
in Compose. Is that a separate package? https://developer.android.com/reference/kotlin/androidx/ui/viewinterop/package-summary?hl=hi-inKazemihabib1996
05/27/2020, 7:19 PMrelativePaddingFrom
after preferredSize
centers the children
is that a bug?
it works correctly when applied before preferredSize
Box(
gravity = ContentGravity.BottomStart,
modifier = Modifier
.drawBackground(Color.Green)
.preferredSize(200.dp)
.relativePaddingFrom(FirstBaseline, after = 30.dp)
) {
Text(
text = "Example of after relativePaddingFrom"
)
}
tcracknell
05/27/2020, 8:23 PMMark Murphy
05/27/2020, 9:39 PMdev11
, you could call a top-level composable function from a library via reflection by passing in currentComposer
:
val clazz = Class.forName("com.commonsware.jetc.specimen.basics.ActionCheckboxKt")
val demoMethod = clazz.methods.find { it.name == "ActionCheckboxDemo" }
demoMethod?.let {
it.isAccessible = true
it.invoke(null, currentComposer)
}
In this case, ActionCheckboxDemo()
has zero parameters in terms of the way the source is written. But, if you looked at the compiled class file (e.g., via External Libraries in Studio), you would see that the function was rewritten to take a Composer
.
I'm uncertain how to accomplish this in dev12
. If I look at the compiled class file, it claims to take zero parameters. If I try invoke()
, it claims to take 3 parameters. The release notes support the three-parameter signature, though the docs seem to be somewhat mangled:
A Composable function accepting a single parameter is transformed into a function accepting 3 parameters, the additional parameters are the Composer, a ‘key’ integer. a bitmask integer used to propagate metadata through calls.If I change the invocation to
it.invoke(null, currentComposer, 0, 0)
, it runs. But... should I be deriving better values for those integers from somewhere?romainguy
05/27/2020, 9:46 PMhenrikhorbovyi
05/27/2020, 9:56 PMZach Klippenstein (he/him) [MOD]
05/28/2020, 3:31 AMStateFlow<T>.collectAsFlow()
extension introduced in dev12 (https://android-review.googlesource.com/c/platform/frameworks/support/+/1308154), why does T
have a non-null upper bound? `StateFlow`’s T
is nullable, and I don’t see why this bound should be required for the extension.allan.conda
05/28/2020, 6:08 AM@Composable
function using LiveData#observeAsState
. and modify the list-order internally for rendering (drag-reorder ux), but I can’t get it to work; I guess I lack understanding about MutableState
. Any ideas? The new list doesn’t update the state 😞henrikhorbovyi
05/28/2020, 6:30 AMimageResource()
always return null
. What am I missing?
I'm using version dev12
henrikhorbovyi
05/28/2020, 6:30 AMimageResource()
always return null
. What am I missing?
I'm using version dev12
allan.conda
05/28/2020, 6:31 AMhenrikhorbovyi
05/28/2020, 1:16 PM