bohregard
06/23/2020, 1:43 AMBox(
modifier = Modifier.fillMaxWidth() + Modifier.fillMaxHeight()
) {
AndroidView(view = webView(ContextAmbient.current, "<https://google.com>"))
}
fun webView(context: Context, url: String) = WebView(context).apply {
loadUrl(url)
settings.apply {
javaScriptEnabled = true
domStorageEnabled = true
}
webViewClient = client
}
Any ideas why it would be frozen?ursus
06/23/2020, 4:26 AMCarminelaface
06/23/2020, 9:26 AM/**
* Contains the default values used by [Button]
*/
object Button {
/**
* The default inner padding used by [Button]
*/
val DefaultInnerPadding = ...
/**
* The default disabled background color used by Contained [Button]s
*/
@Composable
val defaultDisabledBackgroundColor
/**
* The default disabled content color used by all types of [Button]s
*/
@Composable
val defaultDisabledContentColor
}
This is not only for the button but for many other views.
I think a better naming for the object would be ButtonDefalutValues
or ButtonDefaluts
and remove the default
suffix from all the properties.aipok
06/23/2020, 10:50 AMRoi Peretz
06/23/2020, 11:39 AMRoman Abaev
06/23/2020, 12:10 PMMantas Varnagiris
06/23/2020, 12:26 PMrawDragGestureFilter
to move stuff around with one finger. Is there a modifier that allows to register multi finger touch? There is scaleGestureFilter
for scale, but I can't find a way to do rotation with 2 fingers. What am I missing?aipok
06/23/2020, 2:47 PMText
value from being selected on long press? I have a Text
element inside Button
and while I long click on button, its text is being selected. Could not find how can I disable it.Guy Bieber
06/23/2020, 11:02 PMHyun
06/24/2020, 5:00 AMTextButton.onClick
.
as onClick
is not Composable.
I can’t use launchInComposition
so, I tried the below. but I’m not sure if this is proper approach or not.
I searched on this channel but. it was difficult to find the discussion.
scope = remember { CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate) }
onDispose { scope.cancel() }
TextButton(onClick={ scope.launch { doSuspendFunction() }})
what is the best approach on this case?Octave Decaux
06/24/2020, 9:04 AMJulius Marozas
06/24/2020, 9:16 AMapp:layout_anchor
with app:layout_anchorGravity
. Is this currently possible in Compose?samueldple
06/24/2020, 12:21 PMfloatingActionButton = if (condition) {
@Composable {
FloatingActionButton(onClick = {backStack.push(Routing.EditDrink(null))}) {
Icon(Icons.Default.Add)
}
} as @Composable() () -> Unit
} else null
Or I get an "Expected type was Nothing?" error, but when casting the cast shows as a useless cast. Am I doing something stupid?mbonnin
06/24/2020, 1:49 PMVinay Gaba
06/24/2020, 5:29 PMromainguy
06/24/2020, 5:39 PMsamueldple
06/24/2020, 7:53 PMToggleable
into a modifier, the bounds on the ripple applied are incorrect.
I have the below code, but the ripple now extends to fill the full square bounds rather than the shape's bounds. How should this be rectified?
Surface(
shape = RoundedCornerShape(8.dp),
modifier = Modifier.toggleable(
value = selected,
onValueChange = { ... }
)
) {
...
}
Do I need to do my own RippleIndication
for this effect?vanpra
06/24/2020, 11:26 PMGuy Bieber
06/24/2020, 11:33 PMfun getScreenShotFromView(view: View, activity: Activity, callback: (Bitmap) -> Unit) {
activity.window?.let { window ->
val bitmap = Bitmap.createBitmap(view.width, view.height, Bitmap.Config.ARGB_8888)
val locationOfViewInWindow = IntArray(2)
view.getLocationInWindow(locationOfViewInWindow)
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
PixelCopy.request(
window,
Rect(
locationOfViewInWindow[0],
locationOfViewInWindow[1],
locationOfViewInWindow[0] + view.width,
locationOfViewInWindow[1] + view.height
), bitmap, { copyResult ->
if (copyResult == PixelCopy.SUCCESS) {
callback(bitmap) }
else {
}
// possible to handle other result codes ...
},
Handler()
)
}
} catch (e: IllegalArgumentException) {
// PixelCopy may throw IllegalArgumentException, make sure to handle it
e.printStackTrace()
}
}
}
kagomez
06/25/2020, 2:46 AMMikael Alfredsson
06/25/2020, 9:47 AMby state
or mutableStateOf
together with remember
, both of them reassign the datamodel to a wrapped variable inside the @Compose scope and i’m not sure how to mutate the data class and force a refresh.bmo
06/25/2020, 11:23 AMjava.lang.IllegalArgumentException: Key 640122159 was already registered. Please call unregister before registering again
The code can be found here https://github.com/bmonjoie/ComposeTipsCalculator
I have seriously no idea what I'm doing wrong so if someone could give me any pointers, that would be really appreciatedTimo Drick
06/25/2020, 12:04 PMandroidx.ui.core.LayoutNode(modifier = currentComposer.materialize(modifier), measureBlocks = measureBlocks) { childrend() }
Which is used in many base composable components. I would like to use especially the way LayzyItems using it to be able to add and remove Nodes during measurement runs.
Why is it hidden from the Public API? Or maybe i just missed something?andylamax
06/25/2020, 12:40 PMlouiscad
06/25/2020, 1:07 PMaipok
06/25/2020, 2:31 PMImage
using an array of DrawableResIds
. Let say to switch an image every second. Does anyone know how to achieve this using Compose animation API or transition? Or might there is some other way to do it?Vince Rickey
06/25/2020, 4:00 PMHyun
06/25/2020, 5:08 PMif (shown) {
Column {
Text("Success")
}
}
but, I would like to use the way below similar to data binding.(android:visiblity="@{model.shown}"
)
as it reduce indent depth, so, seems easy to read UI code. and feel better to separate ui and logic.
Column(Modifier.visible(shown)) {
Text("Success")
}
I tried to customize Modifier. but, it looks difficult.
is there any possible solution?
or is it not recommended approach?manueldidonna
06/25/2020, 7:20 PMListItem
icon is wrapped in a Box
with ContentGravity.TopStart
. I think that a Center Alignment would be more appropriateamar_1995
06/26/2020, 11:52 AMAdapterList
?amar_1995
06/26/2020, 11:52 AMAdapterList
?Andrey Kulikov
06/26/2020, 1:23 PM