Dominaezzz
12/06/2020, 5:18 PMonDispose
for remember
?Kshitij Patil
12/06/2020, 8:39 PMFragmentContainerView
hosted inside a LinearLayout but sadly I need to use that LinearLayout in the xml, what can be done to make this work?
java.lang.IllegalStateException: Nesting scrollable in the same direction layouts like ScrollableContainer and LazyColumnFor is not allowed. If you want to add a header before the list of items please take a look on LazyColumn component which has a DSL api which allows to first add a header via item() function and then the list of items via items().
at androidx.compose.foundation.ScrollKt.assertNotNestingScrollableContainers-k00exg4(Scroll.kt:464)
at androidx.compose.foundation.lazy.LazyListState.measure-5vC3nwU$foundation_release(LazyListState.kt:248)
at androidx.compose.foundation.lazy.LazyListKt$LazyList$1.invoke(LazyList.kt:62)
at androidx.compose.foundation.lazy.LazyListKt$LazyList$1.invoke(LazyList.kt)
at androidx.compose.ui.layout.SubcomposeLayoutState$createMeasureBlocks$1.measure-8A2P9vY(SubcomposeLayout.kt:211)
at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:47)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.foundation.layout.PaddingModifier.measure-za8Wrwc(LayoutPadding.kt:210)
at androidx.compose.ui.node.ModifiedLayoutNode.performMeasure-BRTryo0(ModifiedLayoutNode.kt:36)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayerWrapper.performMeasure-BRTryo0(LayerWrapper.kt:67)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt:91)
at androidx.compose.ui.node.OuterMeasurablePlaceable$remeasure$2.invoke(OuterMeasurablePlaceable.kt)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:133)
at androidx.compose.ui.platform.AndroidComposeView.observeMeasureModelReads(AndroidComposeView.kt:482)
at androidx.compose.ui.node.OuterMeasurablePlaceable.remeasure-BRTryo0(OuterMeasurablePlaceable.kt:90)
at androidx.compose.ui.node.OuterMeasurablePlaceable.measure-BRTryo0(OuterMeasurablePlaceable.kt:63)
at androidx.compose.ui.node.LayoutNode.measure-BRTryo0(LayoutNode.kt:1232)
at androidx.compose.ui.layout.RootMeasureBlocks.measure-8A2P9vY(RootMeasureBlocks.kt:36)
at androidx.compose.ui.node.InnerPlaceable.performMeasure-BRTryo0(InnerPlaceable.kt:47)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androidx.compose.ui.node.DelegatingLayoutNodeWrapper.performMeasure-BRTryo0(DelegatingLayoutNodeWrapper.kt:105)
at androidx.compose.ui.node.LayoutNodeWrapper.measure-BRTryo0(LayoutNodeWrapper.kt:124)
at androi
I learned that I was using LazyColumn
inside a Column
and rectified my mistake but this error seems to continue showing regardless of any change.dimsuz
12/06/2020, 10:26 PMList<User>
where User(id, name, isSelected)
and if this list is 100-200 users, then to immutably switch selection of 1 user costs a full realloc of whole List + 1 user object.
In light of this I tend to split into something resembling Pair<List<User(id, name)>, Set<String>>
, i.e. "static" user props and "dynamic" set of selected ids.
It doesn't seem to be Compose specific, but I wonder, is this a good thing to do in general, or will ART optimize this anyway? And also: is there some terminology invented for this rather than mine static/dynamic thing?zsperske
12/06/2020, 10:43 PMonResume
vs onStart
in fragment land. Or am I thinking about this completely wrong?Tlaster
12/07/2020, 7:59 AMpushStringAnnotation('Tag', 'sometext'); ...; pop();
in annotatedString
when my phone is using with some accessibility function like Screen Reader's Select to Speak.
Fatal Exception: java.lang.ClassCastException: java.lang.String cannot be cast to androidx.compose.ui.text.TtsAnnotation
at androidx.compose.ui.text.platform.AndroidAccessibilitySpannableStringKt.toAccessibilitySpannableString(AndroidAccessibilitySpannableString.kt:60)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.populateAccessibilityNodeInfoProperties(AndroidComposeViewAccessibilityDelegateCompat.kt:235)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.createNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.kt:184)
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat.access$createNodeInfo()
at androidx.compose.ui.platform.AndroidComposeViewAccessibilityDelegateCompat$MyNodeProvider.createAccessibilityNodeInfo(AndroidComposeViewAccessibilityDelegateCompat.kt:1600)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfVirtualNode(AccessibilityInteractionController.java:1385)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode(AccessibilityInteractionController.java:1298)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos(AccessibilityInteractionController.java:1096)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread(AccessibilityInteractionController.java:342)
at android.view.AccessibilityInteractionController.access$400(AccessibilityInteractionController.java:75)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage(AccessibilityInteractionController.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Philip Blandford
12/07/2020, 11:04 AMDavide Bertola
12/07/2020, 11:13 AMsalomonbrys
12/07/2020, 1:55 PM@Composable
fun foo() {
val context = AmbientContext.current
}
gives the following error:salomonbrys
12/07/2020, 1:55 PMjava.lang.IllegalStateException: Backend Internal error: Exception during code generation
File being compiled: /Users/salomonbrys/Code/Acinq/phoenix-kmm/phoenix-android/src/main/java/fr/acinq/phoenix/android/utils/logger.kt
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:53)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:156)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm$default(JvmBackendFacade.kt:125)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFiles(JvmBackendFacade.kt:112)
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:40)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:647)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:210)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:162)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:371)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:105)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:249)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:38)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:602)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:93)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1644)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
annotations:
Composable
BLOCK_BODY
VAR name:context type:android.content.Context [val]
CALL 'public final fun <get-current> (): T of androidx.compose.runtime.Ambient [inline] declared in androidx.compose.runtime.Ambient' type=android.content.Context origin=null
$this: TYPE_OP type=androidx.compose.runtime.Ambient<T of androidx.compose.runtime.Ambient> origin=IMPLICIT_CAST typeOperand=androidx.compose.runtime.Ambient<T of androidx.compose.runtime.Ambient>
CALL 'public final fun <get-AmbientContext> (): androidx.compose.runtime.ProvidableAmbient<android.content.Context> declared in androidx.compose.ui.platform.AndroidAmbientsKt' type=androidx.compose.runtime.ProvidableAmbient<android.content.Context> origin=GET_PROPERTY
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:53)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:296)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:313)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate(ClassCodegen.kt:135)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generate$default(ClassCodegen.kt:117)
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:153)
... 38 more
Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call '<get-current>' into
@androidx.compose.runtime.Composable public fun foo(): kotlin.Unit defined in fr.acinq.phoenix.android.utils in file logger.kt
@Composable
fun foo() {
val context = AmbientContext.current
}
Cause: Not generated
File is unknown
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.getCompiledMethodNodeInner(InlineCodegen.kt:581)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.throwCompilationException(InlineCodegen.kt:104)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:149)
at org.jetbrains.kotlin.backend.jvm.codegen.IrInlineCodegen.genCall(IrInlineCodegen.kt:158)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:432)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitCall(ExpressionCodegen.kt:102)
at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:74)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitVariable(ExpressionCodegen.kt:544)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitVariable(ExpressionCodegen.kt:102)
at org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl.accept(IrVariableImpl.kt:74)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitStatementContainer(ExpressionCodegen.kt:379)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:383)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.visitBlockBody(ExpressionCodegen.kt:102)
at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBody.kt:54)
at org.jetbrains.kotlin.backend.jvm.codegen.ExpressionCodegen.generate(ExpressionCodegen.kt:215)
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.doGenerate(FunctionCodegen.kt:125)
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:51)
... 43 more
Caused by: java.lang.IllegalStateException: Couldn't obtain compiled function body for org.jetbrains.kotlin.ir.descriptors.IrBasedPropertyGetterDescriptorWithContainerSource@5096f940
at org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.getCompiledMethodNodeInner(InlineCodegen.kt:581)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen$Companion.createInlineMethodNode$backend(InlineCodegen.kt:545)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.performInline(InlineCodegen.kt:140)
... 57 more
BenjO
12/07/2020, 3:55 PMzsperske
12/07/2020, 5:48 PMvectorResource
? This asset draws as white when placed in the TopAppBar.navigationIcon
of a Scaffold
<vector xmlns:android="<http://schemas.android.com/apk/res/android>"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.1523,2C9.2617,1.957 6.6484,3.1563 4.7969,5.0898L2.8555,3.1445C2.6602,2.9531 2.3398,2.9531 2.1484,3.1445C2.0469,3.2422 2,3.3711 2,3.5L2,8C2,8.5508 2.4492,9 3,9L7.5,9C7.6289,9 7.7539,8.9492 7.8555,8.8555C8.0469,8.6602 8.0469,8.3398 7.8555,8.1484L6.2188,6.5078C8.0273,4.6016 10.75,3.5703 13.6914,4.1758C16.7656,4.8125 19.2305,7.3008 19.8398,10.3789C20.8516,15.5 16.9414,20 12,20C7.8828,20 4.4805,16.8711 4.0469,12.8633C3.9922,12.3672 3.5625,12 3.0625,12C2.4609,12 1.9961,12.5234 2.0625,13.1211C2.6211,18.1094 6.8672,22 12,22C18.1367,22 23,16.4453 21.8242,10.0977C21.0781,6.0742 17.8164,2.8594 13.7891,2.1563C13.2344,2.0586 12.6875,2.0117 12.1523,2.0039ZM12,6C11.4492,6 11,6.4492 11,7L11,12C11,12.2656 11.1055,12.5195 11.293,12.707L13.5859,15C13.9766,15.3906 14.6094,15.3906 15,15C15.3906,14.6094 15.3906,13.9766 15,13.5859L13,11.5859L13,7C13,6.4492 12.5508,6 12,6ZM12,6"
android:fillColor="#3498DB"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</vector>
frankelot
12/07/2020, 6:13 PMplaceable.placeRelative(x = 0, y = 0)
but I don’t have a way of asking the view where it wants to be placedDaniele B
12/07/2020, 6:22 PMNat Strangerweather
12/07/2020, 7:23 PMCard(
Modifier
.clickable(indication = null, onClick = {}
I want my card to be clickable only if the "isEnabled" Boolean is true. Something like .if (isEnabled) clickable()
...Val Salamakha
12/07/2020, 9:19 PMzsperske
12/07/2020, 9:23 PMandroidx.ui.material.samples.FancyIndicator
Sam
12/07/2020, 9:38 PMalpha08
app from the latest android studio arctic fox canary 2 project template, the only code is this:
Column(Modifier.fillMaxSize()) {
Text("title")
ScrollableColumn {
Text("message")
}
val text = remember { mutableStateOf(TextFieldValue()) }
OutlinedTextField(
value = text.value,
onValueChange = { text.value = it },
placeholder = { Text(text = "Watch me animate...") },
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp)
)
}
My question is, why is it that when I focus the software keyboard on a Pixel 4a device, does everything get shifted up so that the keyboard stays in view? How can I disable this behavior so that I have more fine grained control, for example using accompanist
lib for insets?zsperske
12/07/2020, 10:06 PMimplementation("androidx.navigation:navigation-fragment-ktx:2.3.2")
implementation("androidx.navigation:navigation-ui-ktx:2.3.2")
implementation("androidx.navigation:navigation-compose:1.0.0-alpha03")
zsperske
12/08/2020, 1:59 AMNavHost
s? Or should the entire graph be defined at the top level?tylerwilson
12/08/2020, 11:36 AMjaqxues
12/08/2020, 12:15 PMzoha131
12/08/2020, 3:21 PMScrollableColumn
?Heba
12/08/2020, 3:29 PMcodeslubber
12/08/2020, 5:31 PMzsperske
12/08/2020, 6:08 PMSam
12/08/2020, 6:34 PMziv kesten
12/08/2020, 6:55 PMzsperske
12/08/2020, 9:25 PMsindrenm
12/08/2020, 10:17 PMoperator fun <T> State<T>.component1(): T = value
? Being able to destructure a State
is very useful when the value of the State
is nullable. Such as:
val (content) = viewModel.content.collectAsState()
if (content != null) {
SomeContent(content)
} else {
MissingContent()
}
(Using a StateFlow
here, but applies for any other way of retrieving a State
as well.)
I don't find the property delegate very useful in this situation, as smart-casting can't be done in that case (custom getter and all that). Is this something that would make sense to even add to the standard lib?Noé Casas
12/08/2020, 11:37 PMTextField
’s text vertical alignment to “top”? How? By default the text is in the middle. Setting Modifier.align(<http://Alignment.Top|Alignment.Top>)
does not help.