Kazemihabib1996
04/30/2020, 12:35 PMTransition(
definition = transDef,
initState = AnimState.StartScale,
toState = AnimState.EndScale
) { state ->
Box(
modifier = Modifier.drawLayer(
scaleX = state[scale],
scaleY = state[scale]
)
) {
Dialog(onCloseRequest = onDismiss) {
...
This doesn't work and I hope this works in future 🙂
And using
Dialog(onCloseRequest = onDismiss) {
Surface(
shape = MaterialTheme.shapes.medium, modifier = Modifier.drawLayer(
scaleX = state[scale],
scaleY = state[scale]
)
) {
...
Just overshoots inside of the dialog not the dialog it self.len
04/30/2020, 1:24 PMText
with outline? This was done with Paint.Style.STROKE
, but there's no painter on Text
parameters. I want to draw a text in white with a black border (like a shadow, but without blur)Klaas Kabini
04/30/2020, 6:24 PMLeland Richardson [G]
04/30/2020, 6:41 PMGuy Bieber
04/30/2020, 8:34 PMmanueldidonna
04/30/2020, 9:43 PMshikasd
04/30/2020, 11:30 PMcodeslubber
05/01/2020, 12:13 AMflosch
05/01/2020, 8:53 AM<activity android:name="androidx.activity.ComponentActivity" />
in the androidTest/AndroidManifest.xml
but have to do it in main/AndroidManifest.xml
? 🤔manueldidonna
05/01/2020, 9:56 AMSheroz Nazhmudinov
05/01/2020, 12:14 PMTransition
in Compose, and had couple of questions.
First is about transitionDefinition
- i see that it’s an equivalent of value animator (correct me if i’m wrong). Is there a way to set the duration to it, and delay before the start?
Second is about the Transition
composable - is there a way to start the transition based on the user event (e.g., click)?
Any hints/suggestions would be appreciated! 🙂Brian Norman
05/01/2020, 3:43 PM@Model
object into the Search Bar composable from the parent then it'll get reset every time I type (I'm guessing this is because the parent re-renders causing the Search Bar re-renders)...
If anyone's done this and could share how they've done it or point me in the right direction that would be super helpful! Thanks 🙂kartoffelsup
05/01/2020, 5:20 PMe: java.lang.AbstractMethodError: androidx.compose.plugins.kotlin.ComposeIrGenerationExtension.generate(Lorg/jetbrains/kotlin/ir/declarations/IrFile;Lorg/jetbrains/kotlin/backend/common/BackendContext;Lorg/jetbrains/kotlin/resolve/BindingContext;)V
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:86)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm$default(JvmBackendFacade.kt:64)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:52)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:36)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:39)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:638)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:198)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:172)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:56)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:85)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:349)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:237)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:79)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:91)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:606)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:99)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1645)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
anything I need to do to get dev10 working? Code is here: https://github.com/kartoffelsup/nuntius-app/commit/754e261591d180031b26cb4030ad27d59726151e - if I downgrade to dev09 it works fine again.Rooparsh
05/02/2020, 2:04 PMSheroz Nazhmudinov
05/02/2020, 2:12 PMkarandeep singh
05/02/2020, 7:20 PMLuca
05/02/2020, 9:54 PMjava.lang.NoSuchMethodError: No static method setContent$default
runtime error.
Is there another way to set kotlinCompilerVersion and kotlinCompilerExtensionVersion with the multiplatform plugin?Lilly
05/03/2020, 12:11 AMkarandeep singh
05/03/2020, 7:26 PM@Composable
fun SomeComposableFunction() {
val t = animatedFloat(0f)
Canvas(modifier = Modifier.fillMaxWidth()) {
// this gives error during compile/build
onActive {
}
//Can't do this as well
val someValue = remember {
}
}
}
is this expected behaviour? we can't access Composables inside lambda's which are in turn inside some composable?Ali Zargar Shabestari
05/03/2020, 8:16 PMe: java.lang.IllegalStateException: Backend Internal error: Exception during code generation
whenever I use view binding in a project with compose enabled. Is that a bug? I'm using dev10
karandeep singh
05/03/2020, 8:28 PMbohregard
05/04/2020, 2:51 AMval context = ContextAmbient.current
Card(modifier = Modifier.padding(8.dp) + Modifier.fillMaxWidth()) {
Button(onClick = {
Log.d(TAG, "Test")
Toast.makeText(context, "Toast me bro", Toast.LENGTH_SHORT)
.show()
}) {
Text(text = "Test")
}
}
}
but this doesn't
Card(modifier = Modifier.padding(8.dp) + Modifier.fillMaxWidth()) {
Button(onClick = {
Log.d(TAG, "Test")
Toast.makeText(ContextAmbient.current, "Toast me bro", Toast.LENGTH_SHORT)
.show()
}) {
Text(text = "Test")
}
}
}
manueldidonna
05/04/2020, 2:08 PMdagomni
05/04/2020, 4:28 PMjava.lang.NoSuchMethodError: org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl.<init>(IILkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
Gabriel Feo
05/04/2020, 5:08 PMZach Klippenstein (he/him) [MOD]
05/04/2020, 5:56 PMAdapterList
performance: with RecyclerView
, when using DiffUtil
to calculate list changes, it’s recommended to run the diff calculation on a background thread since it can be slow. This makes it tricky to use with declarative programming, because state updates to the list don’t synchronously get propagated down the tree (e.g. EditText
in an item view causes a new list to be emitted with new text, but that text doesn’t get bound to the actual view until a few main loop iterations later, which causes state to get out of sync when typing fast). What implications does this have for AdapterList
in Compose?
Add/remove item animations can be done at the per-item level, which seems straightforward enough. But if the list is re-ordered, or items are inserted anywhere other than the end of the list, does AdapterList
preserve composable state/groups by keying on the list items (i.e. using `key`/`Pivotal` machinery)? If it does, does it process those changes more efficiently than DiffUtil
? Does this question not even make sense in the Compose world?bohregard
05/05/2020, 3:44 AMjava.lang.NoClassDefFoundError: Could not initialize class kotlinx.coroutines.Dispatchers at androidx.ui.core.WrappedComposition$setContent$1.invoke(Wrapper.kt:267) at androidx.ui.core.WrappedComposition$setContent$1.invoke(Wrapper.kt:-1) at androidx.compose.internal.RestartableFunction.invoke(RestartableFunction.kt:131) at androidx.compose.internal.RestartableFunction.invoke(RestartableFunction.kt:-1) at androidx.compose.ComposerKt.invokeComposable(Composer.kt:2106) at androidx.compose.Recomposer.recompose$compose_runtime_release(Recomposer.kt:67) at androidx.compose.CompositionImpl.setContent(Composition.kt:120) at androidx.ui.core.WrappedComposition.setContent(Wrapper.kt:266) at androidx.ui.core.WrappedComposition$setContent$2.invoke(Wrapper.kt:277) at androidx.ui.core.WrappedComposition$setContent$2.invoke(Wrapper.kt:-1) at androidx.ui.core.SavedStateDelegate.stopWaitingForStateRestoration(SavedStateDelegate.kt:84) at androidx.ui.core.AndroidComposeView.onMeasure_Original(AndroidOwner.kt:455) at androidx.ui.core.AndroidComposeView.onMeasure(AndroidOwner.kt:-1) at android.view.View.measure_Original(View.java:24552) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:24516) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6828) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure_Original(View.java:24552) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:24516) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6828) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure_Original(View.java:24552) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:24516) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481) at android.view.View.measure_Original(View.java:24552) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:24516) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6828) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure_Original(View.java:24552) at android.view.View_Delegate.measure(View_Delegate.java:80) at android.view.View.measure(View.java:24516) Copy stack to clipboard Tip: Try to refresh the layout.
Karthick
05/05/2020, 5:50 AMSam Woodall
05/06/2020, 12:20 AMsetContent {
Stack(Modifier.fillMaxSize()) {
Box(backgroundColor = Color.Green, modifier = Modifier.tapGestureFilter(onTap = { ... }).preferredSize(200.dp).offset(200.dp, 200.dp))
Box(backgroundColor = Color.Red, modifier = Modifier.preferredSize(100.dp))
}
}
Kazemihabib1996
05/06/2020, 5:33 PM@Composable
fun testBlending2(modifier: Modifier = Modifier) {
val paint = remember { Paint() }
Canvas(modifier = modifier, onCanvas = {
save()
val rect = Rect(0f, 0f, 100f, 100f)
drawRect(rect, paint.apply { color = Color.Red })
saveLayer(Rect.fromLTWH(0f, 0f, size.width.value, size.height.value), paint.apply { BlendMode.multiply })
drawRect(
rect.shift(Offset(20f, 20f)),
paint.apply { color = Color.Blue }
)
restore()
restore()
})
}
It's supposed to be
but it just produces this image: https://i.stack.imgur.com/q3In0.png▾
Kazemihabib1996
05/06/2020, 5:33 PM@Composable
fun testBlending2(modifier: Modifier = Modifier) {
val paint = remember { Paint() }
Canvas(modifier = modifier, onCanvas = {
save()
val rect = Rect(0f, 0f, 100f, 100f)
drawRect(rect, paint.apply { color = Color.Red })
saveLayer(Rect.fromLTWH(0f, 0f, size.width.value, size.height.value), paint.apply { BlendMode.multiply })
drawRect(
rect.shift(Offset(20f, 20f)),
paint.apply { color = Color.Blue }
)
restore()
restore()
})
}
It's supposed to be
but it just produces this image: https://i.stack.imgur.com/q3In0.png▾
romainguy
05/06/2020, 5:39 PMsaveLayer()
at all in this examplepaint.apply { blendMode = BlendMode.multiply }
BlendMode
to anythingKazemihabib1996
05/06/2020, 5:43 PM@Composable
fun donat(modifier: Modifier = Modifier) {
val icingPaint = remember {
Paint().apply {
asFrameworkPaint().pathEffect = ComposePathEffect(CornerPathEffect(40f), DiscretePathEffect(60f, 25f))
color = Color(0xFF53250F)
}
}
Canvas(modifier = modifier, onCanvas = {
val center = Offset(size.minDimension.value / 2, size.minDimension.value / 2)
val holePath = Path().apply {
addOval(Rect.fromCircle(center, size.minDimension.value / 6))
}
val icing = Path().apply {
addOval(Rect.fromCircle(center, size.minDimension.value / 2.5f))
op(this, holePath, operation = PathOperation.difference).also {
Log.d("OP RESULT", it.toString())
}
}
drawPath(icing, icingPaint)
})
}
but it doesn't work, but it works without asFrameworkPaint().pathEffect = ComposePathEffect(CornerPathEffect(40f), DiscretePathEffect(60f, 25f))
asFrameworkPaint().pathEffect = ComposePathEffect(CornerPathEffect(40f), DiscretePathEffect(60f, 25f))
nativeCanvas.clipPath(holePath.asAndroidPath(), Region.Op.DIFFERENCE)
with out removing that pathEffect.romainguy
05/06/2020, 9:21 PMKazemihabib1996
05/06/2020, 9:28 PMasFrameworkPaint().pathEffect = DiscretePathEffect(1f, 1f)
but didn't help.drawRect(rect, paint.apply { color = Color.Red })
saveLayer(Rect.fromLTWH(0f, 0f, size.width.value, size.height.value), Paint().apply { blendMode = BlendMode.dstOut })
drawRect( rect.shift(Offset(20f, 20f)), paint.apply { color = Color.Blue } )
restore()
This example with `BlendMode.dstOut`not works correctly just the blue rectangle becomes black I don't understand why this happens.
2)
drawRect(rect, paint.apply { color = Color.Red })
drawRect( rect.shift(Offset(20f, 20f)), paint.apply {
color = Color.Blue, blendMode = BlendMode.dstOut }
)
This one is without saveLayer and just by applying the blendMode to the paint
it works for multiply
but doesn't work for dstOut
and produced the same result like the previous one.
3)
But if I call`saveLayer` with default blendMode of Paint, before both drawings in the above example it works I don't even need to restore
it.
saveLayer(Rect.fromLTWH(0f, 0f, size.width.value, size.height.value), paint = Paint())
drawRect(rect, paint.apply { color = Color.Red })
drawRect(
rect.shift(Offset(20f, 20f)),
paint.apply {
color = Color.Blue
blendMode = BlendMode.dstOut
}
)
I don't understand it, why this happens?
based on the docs
* Saves a copy of the current transform and clip on the save stack, and then
* creates a new group which subsequent calls will become a part of. When the
* save stack is later popped, the group will be flattened into a layer and
* have the given `paint`'s [Paint.colorFilter] and [Paint.blendMode]
* applied.
I think the saveLayer
must be called between the first and second drawRect
and then I should call the restore
but here I should call it before both drawings and even I don't need to call restore
.romainguy
05/07/2020, 7:51 PMsaveLayer
basically creates a temporary render targetDstOut
) may only provide the desired results you want when starting from a transparent contentDstOut
does alpha composition, hence the saveLayer
saveLayer
calls have a cost (memory and rendering performance) so use them sparingly (or at least watch performance)saveLayer
for just one of the draw callsKazemihabib1996
05/07/2020, 8:03 PMBlendMode.kt
there are links to flutter docs and also the docs in that file is equal to to <https://api.flutter.dev/flutter/dart-ui/BlendMode-class.html>
that was reason for using flutter docs and samples for learning this stuff 😁romainguy
05/07/2020, 8:03 PM