Lilly
06/12/2020, 9:28 PMScaffold(bodyContent = { // code here is called twice })
is called twice? I'm using dev13 but same problem with dev12. I can't test the other versions because my project fails otherwise.nonameden
06/12/2020, 9:56 PMText()
composable?Lilly
06/12/2020, 10:18 PMScannerScreenContent
ist called twice and everytime val state by viewModel.device.observeAsState()
is triggered, ScannerScreenContent
is called again which leads to a list with always 1 item. Does someone have an idea?Diego Marulanda
06/12/2020, 10:35 PMThis version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.
but I already have the latest version of canary installed, what should I do?Octave Decaux
06/13/2020, 10:55 AMJohn O'Reilly
06/13/2020, 12:02 PMClass 'kotlin.Unit' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
I'm using AS 4.2 Canary 1.....and if I just use new project option to create "Empty Compose Activity" I see same issue (it also creates project with dev13 of Compose and Kotlin 1.4-M2). If I create say basic fragment/viewmodel project then it builds/runs fine. Anyone else seeing this?Merhawifissehaye
06/13/2020, 1:16 PMcomposeOptions {
kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
kotlinCompilerExtensionVersion "0.1.0-dev13"
}
I am on a multi module project, and I have added the option to both build.gradle files.zalewski.se
06/13/2020, 5:46 PMnotifyItemMoved()
from RecyclerView with Compose AdapterList
?Mark Murphy
06/13/2020, 8:57 PM@Preview
@Composable
fun ListifyLambda() {
AdapterList(data = listOf("foo", "bar", "goo")) {
ListItem(it)
}
}
@Preview
@Composable
fun ListifyFnRef() {
AdapterList(data = listOf("foo", "bar", "goo"), itemCallback = ::ListItem)
}
@Composable
fun ListItem(item: String) {
Text(item)
}
Here, ListifyLambda()
and ListifyFnRef()
seem like they should be equivalent. ListifyLambda()
compiles and runs without issue. ListifyFnRef()
fails to compile, with:
Type mismatch: inferred type is KFunction1<String, Unit> but (String) -> Unit was expected
(dev13
and AS 4.2 C1)
It doesn't seem like the Kotlin itself is flawed. Function references that match the function type should be usable, and ListItem()
seems to match the itemCallback
. If you try swapping compatible lambda expressions and function references outside of composables, it works as expected.
I have run into this a few times and just wrote it off as being glitchy prerelease stuff, but https://stackoverflow.com/q/62362663/115145 spurred me to try to get to the bottom of this. Are we doing something wrong, or is this a bug/limitation of something (e.g., Kotlin compiler plugin)?Andrew Kuryan
06/14/2020, 11:46 AMBorder
?enighma
06/14/2020, 6:32 PMKazemihabib1996
06/14/2020, 7:21 PMinterface LayoutModifier : Modifier.Element {
fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints,
layoutDirection: LayoutDirection
): MeasureScope.MeasureResult
How exactly LayoutModifier works?
instead of list of measurables for each child, there is only one measurable.
and I've playing with it, when I tried placeable.place(50.ipx, 50.ipx)
it applied for all children.
I think there is some thing I misunderstood about it.Zach Klippenstein (he/him) [MOD]
06/15/2020, 3:44 AMVinay Gaba
06/15/2020, 4:07 AMkclerc
06/15/2020, 11:54 AMLilly
06/15/2020, 3:41 PMDropdownMenuItem
is not fired?? I'm on dev13. Is it a bug or did I miss something?allan.conda
06/15/2020, 5:47 PM> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)
Octave Decaux
06/16/2020, 8:39 AMgsala
06/16/2020, 8:55 AMArtur Matsehor
06/16/2020, 2:45 PM@Composable
fun SampleScreen() {
SampleScreenBody(viewModel = SampleViewModel())
}
@Composable
fun SampleScreenBody(viewModel: SampleViewModel) {
Button(onClick = {
viewModel.doSmth("Parameter") { response ->
if (response == "Success") {
//TODO: this is where I want to, for ex, move to another screen
//or show a dialog.
//How?
}
}
}) {
Text("Text")
}
}
Guy Bieber
06/16/2020, 4:57 PMzalewski.se
06/16/2020, 6:00 PMAdapterList
to the top? I can’t find any way to get access to scrollable modifierSam Woodall
06/16/2020, 9:02 PMbohregard
06/16/2020, 10:35 PMval savedIcon = state { post.saved.icon }
Image(
modifier = Modifier.weight(1f) + Modifier.clickable(onClick = {
post.toggleSave()
savedIcon.value = post.saved.icon
}),
asset = vectorResource(id = savedIcon.value)
)
On toggle, the icon resource should swap. It works the first time (outline to solid) but on the second time the outline shows on top (shown in the pictures below). Any reason why this is happening?Ash
06/17/2020, 12:09 AMval intentChannel = Channel<Intent>()
val state: StateFlow<ChannelState>
// Setup Ambient
val CurrAppState = ambientOf<ChannelState> { ChannelState.Edit }
In a Composable want to use the Ambient
@Composable
fun Foo(appState: StateFlow<ChannelState>){
val currState by appState.collectAsState(initial = ChannelState.NotEdit)
CurrAppState.provides(currState)
Passing currState
down the tree everything works perferct but if use CurrAppState.current
get the wrong state.
Think I am doing something dumb. Thanks for the help.Val Salamakha
06/17/2020, 4:25 AMbohregard
06/17/2020, 4:43 AMMantas Varnagiris
06/17/2020, 8:29 AMAndroidView()
composable. I'm curious if there will be a way to show `Fragment`s in composables? Maybe it's already possible (I haven't tried yet). Maybe we can wrap fragment within a FrameLayout
or something?
The reason why I'm asking is that we're thinking of moving our app navigation to be within composables. All our screens are Fragment
s at the moment and ideally we would like to avoid converting each fragment to a custom view (before we can convert each of them to be composables)E Smits
06/17/2020, 9:32 AMobject NavStatus {
var currentScreen by mutableStateOf<Screen>(Screen.Home)
}
fun navigateTo(destination: Screen) {
NavStatus.currentScreen = destination
}
This is fine if you specify onclicks in the UI. However the hardware button closes the app. Usually you would handle an onKeyListener in your fragments or onBackPress in an activity. I could imagine that you could keep an array of recent navigated screens and just pop one using the onbackpress listener in the MainActivity.Zsolt
06/17/2020, 10:51 AMjava.lang.IllegalStateException: new updateScope not found in result type of endRestartGroup
This happens as soon as I add the first @Composable annotated fun to the code (even if it’s completely empty).
Any idea what I’m doing wrong?