Vinay Gaba
12/20/2020, 2:11 AMModifier
// Not allowed
fun TestComponent(
modifier: Modifier = Modifier.fillMaxWidth().preferredSizeIn(maxHeight = 200.dp)
)
// Instead, it recommends that you do this
fun TestComponent(
modifier: Modifier = Modifier
)
Could someone shed some more light on why this is a guideline? Since this is intentionally enforced, I’m sure there is a very good reason to do this. It’s obviously more reusable which makes complete sense but I wonder if this is one place where it would be okay to have some flexibility.Colton Idle
12/20/2020, 4:08 AMbuildFeatures {
compose = true
}
composeOptions {
kotlinCompilerVersion '1.4.21'
kotlinCompilerExtensionVersion '1.0.0-alpha09'
}
kotlinOptions with useIR = true and jvmTarget set to 1.8
What else could be going wrong? I'm getting a crash at runtime. Everything in the IDE (latest canary) looks fine.
Gist: Latest everything. No compile issues. Runtime issue when just hitting setContent
and nothing else.
Edit: Only other thing I can think of is that I use some dependency that is forcing an older version of kotlin? I tried to use ./gradlew dependencies to figure out, but everything looks like its 1.4.21
Another edit: There literally has to be a better way to get a better error message. Literally have no idea whats going on 😭 I already have been able to get compose working in past projects. I quadruple checked that I followed these steps correctly https://developer.android.com/jetpack/compose/setup#add-compose (except that I'm using kotlin 1.4.21, alpha09 of compose, and Canary 3 of AS. Could really use any bump in the right direction. Thanks!Kshitij Patil
12/20/2020, 10:26 AMJohn O'Reilly
12/20/2020, 10:38 AM@Binding
?Alexander Karkossa
12/20/2020, 10:46 AM<R, T : R> LiveData<T>.observeAsState(initial: R, *policy: SnapshotMutationPolicy<R>*): State<R>
Kshitij Patil
12/20/2020, 5:50 PMExperimentalFocus
annotation right? Not sure if it was removed in alpha08
or alpha09
Alexander Karkossa
12/20/2020, 7:08 PMBottomDrawerLayout
. Since the use of nestedScroll
within the BottomDrawerLayout
, Lists in the Views won't scroll anymore. Even if we set gesturesEnabled = false
, the Drawer opens when trying to scroll a list.
Any ideas?Mehdi Haghgoo
12/21/2020, 6:34 AMtasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
}
Kshitij Patil
12/21/2020, 7:21 AMadapter.retry()
?Mehdi Haghgoo
12/21/2020, 7:53 AMCould not find androidx.ui:ui-tooling:1.0.0-alpha09
The ui-tooling artifact has not been updated? Should I stick to the previous version?Wang
12/21/2020, 9:28 AM@Composable
fun NetworkImage(url: String, modifier: Modifier) {
var imageBitmap by remember { mutableStateOf<ImageBitmap?>(null) }
imageBitmap?.let {
Image(bitmap = imageBitmap!!, modifier = modifier, contentScale = ContentScale.Crop)
}
onCommit(url) {
ImageLoader.instance
.loadUrl(url)
.listen {
if (it.status == Status.success) {
imageBitmap = it.content
}else{
println("image load failed.")
}
}
.exec()
}
}
Cyril Find
12/21/2020, 11:10 AMLazyColumn
scroll position aver navigating with compose navigation ?
I thought hoisting a LazyListState
up to my NavHost
would work but it doesn’t apparentlyJohn O'Reilly
12/21/2020, 12:05 PMAndroidView
with TabRow
....content for other tabs are fine but one with the AndroidView is overlapping tabs....though I could be missing something basic I should be doing with modifiers etc (screenshots in thread)?Kshitij Patil
12/21/2020, 1:20 PMMarcin Środa
12/21/2020, 1:25 PMLazyColumn
like ScrollableColumn
with reverseScrollDirection = true
?David Attias
12/21/2020, 2:13 PMScrollableColumn
to the right offset. I have a TextField
that I want to be visible when the keyboard appears and resize the view. Any idea ?bodo
12/21/2020, 3:26 PMrsktash
12/21/2020, 10:50 PMzoha131
12/22/2020, 3:46 AMNana Vong
12/22/2020, 12:20 PMjim
12/22/2020, 3:15 PMandroidx-master-dev
to androidx-main
. You will need to check out the new branch if you're building at home and/or just watching the repository for interest. If you are contributing, changes should please be sent to the androidx-main
branch instead of the old branch.Kshitij Patil
12/22/2020, 3:55 PMCyril Find
12/22/2020, 4:48 PMTextField
, I randomly get cases where the keyboard doesn’t come up, is it a know issue ? do I need to do something special ?Kshitij Patil
12/22/2020, 6:02 PMBryan Herbst
12/22/2020, 6:54 PMThis version (1.0.0-alpha09) of the Compose Compiler requires Kotlin version 1.4.21 but you appear to be using Kotlin version 1.4.20 which is not known to be compatible.Everywhere my project defines a Kotlin dependency we are using 1.4.21. I can see in my Gradle dependency report that something is forcing Kotlin to 1.4.20 in the
kolinCompilerClasspath
configuration, but I don’t see anything that would indicate what is doing that.
Any tips on troubleshooting?Lauren Yew
12/22/2020, 8:29 PMProviders
and Ambients
like a Dagger inject where I can get a dependency without passing it as a param anywhere? Is there a best practice on their use? https://developer.android.com/reference/kotlin/androidx/compose/runtime/AmbientSam
12/22/2020, 10:47 PMrememberLazyListState
with LazyColumn
for a chat interface? JetChat in compose-samples
still uses ScrollableColumn
so it doesn’’t help much, especially in these areas:
• How do we smooth scroll to show a new incoming message? Since we only have relative-based smoothScrollBy
instead of smoothScrollTo(0f)
(on reverseLayout = true
), it’s hard to get to the right spot and snapToIndex(0)
is unnatural
• How do we get measurements of the specific message component sizes to make the right relative scrolling calculation? I’ve seen chatScrollState.layoutInfo.visibleItemsInfo
but i’m not sure how to get updates when layoutInfo
changes, sticking it inside LaunchedEffect
doesn’t fire
• How do we know when we are getting to the end of the LazyColumn
so that we can fetch older messages and add them to the list?
• In the case where new messages are coming in or old messages are being added, how do we maintain existing scroll position without the whole list jumping around?Neal Sanche
12/23/2020, 12:16 AMTextField
in it, and a row of buttons to close, save the record, and delete the record. If I tap into any of the text fields, the keyboard pops up, and pretty much the only decent thing to do at this point is use windowSoftInputMode
set to adjustResize
on the base activity. Now, my problem is, the keyboard stays up after the bottom sheet is collapsed. I found AmbientTextInputService
has a hideSoftwareKeyboard
method, but I don't know where I'm supposed to get the required input session token from? Anyone know? So far, I'm finding text editing to be really complicated in Compose. What am I missing here? I'll drop the code I have into the thread.bodo
12/23/2020, 10:41 AM@Composable
fun ShowAnimatedHeader(oldTitle: String, newTitle: String) {
Box {
AnimatedVisibility(visible = false, exit = slideOutVertically()) {
Text(text = oldTitle)
}
AnimatedVisibility(visible = true, enter = slideInVertically()) {
Text(text = newTitle)
}
}
}
Every time the oldTitle or newTitle change i want to animate the old one out and the new one in. but it is only executed the first time the composable is calledKirill Grouchnikov
12/23/2020, 5:24 PM