https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • d

    Davide Giuseppe Farella

    08/28/2020, 3:59 PM
    Does compose provide some standalone way to deal with Strings and translations without xml resources?
    a
    • 2
    • 10
  • e

    Esmaeel Nabil

    08/28/2020, 4:01 PM
    what is the right way of making something like a page with multiple pages inside like viewPager and tab layouts , also how to handle the state of moving through them?
    a
    • 2
    • 3
  • m

    merono

    08/28/2020, 4:31 PM
    🤔 Did recomposing on
    Configuration
    changes stop working recently? That’s what it seems like when I use the code snippet below and specify
    android:configChanges="uiMode"
    in my manifest.
    MaterialTheme(
        colors = if (isSystemInDarkTheme()) darkColors() else lightColors()
    ) {
        Box(
            Modifier.size(48.dp),
            backgroundColor = MaterialTheme.colors.onBackground
        )
    }
    The color of the
    Box
    doesn’t change when I toggle dark mode on my device (pixel 3), but I feel like it did on an older version of compose. The color does get updated correctly if I kill the app and re-open it. I’m seeing this behavior on
    alpha01
    and
    dev17
    , using API 29. I also tried similar things by using
    ConfigurationAmbient.current
    directly, and saw the same behavior. When debugging the app, I was able to see
    AndroidComposeView.onConfigurationChanged
    get called with the new
    Configuration
    though.
    l
    • 2
    • 6
  • v

    Vinay Gaba

    08/28/2020, 5:19 PM
    Hey everyone! I am thrilled to introduce Airbnb’s latest open source project - 🔦 Showkase 🔦 Showkase is an annotation processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements. It auto-generates a UI browser app for you ✨ More info in the thread 👇🏼
    🎉 34
    👏 2
    😮 6
    p
    a
    • 3
    • 10
  • m

    mattinger

    08/28/2020, 5:46 PM
    Also struggling to figure out how to load an xml drawable. Apparantly the imageResource function isn’t appropriate for that.
    r
    a
    n
    • 4
    • 9
  • j

    JCollardBovy

    08/28/2020, 6:29 PM
    Is it possible to use Jetpack Compose within multiplatform modules?
    j
    • 2
    • 5
  • n

    Nemanja Mladenović

    08/28/2020, 7:17 PM
    Beginner's question: how to interact with outside world from compose, lets say I have on click on a button and lets say that I want to start a service with that. Or the other way around, I get a message from service in a an activity holding composable, do I need to pass it to viewmodel and trigger recomposition via live data for example or do I have some other options?
    z
    a
    • 3
    • 4
  • j

    jaqxues

    08/28/2020, 7:43 PM
    Having an issue with getting started with Compose. I only copy pasted these dependencies and configs in an existing project https://developer.android.com/jetpack/compose/setup
    d
    n
    • 3
    • 14
  • s

    Sergey Y.

    08/28/2020, 9:48 PM
    Playing around with Jetsnack sample. The project compiles and works fine. But the preview is broken because it is unable to handle the SystemUI padding modifier. Under the hood is NPE about InsetAmbient.current is NULL. I believe this is the case when the Preview can't provide the framework's Window(or any other components) and it breaks. Will Preview support such things in the future or we(developers) have to avoid of passing any Contexts, Windows, etc to composable functions that must work inside Preview?
    a
    • 2
    • 5
  • s

    Sergey Y.

    08/28/2020, 10:25 PM
    Jetchat sample. Is it a known issue? Huge performance tanking when selecting the text.
    jetchat_performance.mp4
    👀 8
    a
    • 2
    • 1
  • j

    Javier

    08/28/2020, 11:14 PM
    Compose Preview doesn’t work with Multiplatform modules. The next use cases are not working • Android module with Compose implements a Multiplatform module with JVM target (didn’t try with Android target) • Compose inside Multiplatform module But it is working perfectly if Compose is in an Android module and it implements a Kotlin JVM module
    • 1
    • 1
  • a

    ansman

    08/28/2020, 11:45 PM
    Where should bugs against material components be filed? Regular issue tracker?
    l
    c
    m
    • 4
    • 4
  • c

    Colton Idle

    08/29/2020, 4:23 AM
    Just starting to really use compose. Going through the tutorial it starts with
    Text("A day in Shark Fin Cove")
            Text("Davenport, California")
            Text("December 2018")
    and then tells you to wrap it in a column
    Column {
            Text("A day in Shark Fin Cove")
            Text("Davenport, California")
            Text("December 2018")
        }
    Is there an easy way to wrap elements in a layout? I think swift UI had an easy way to highlight and right click > wrap with X layout or something. I could see myself using that a lot. Would also be nice to get a list of all layouts when you "surround with" or something. Unless this already exists... and I'm missing it.
    w
    i
    • 3
    • 2
  • c

    Colton Idle

    08/29/2020, 4:28 AM
    Other thoughts from going through the tutorial, maybe someone from the team will find my beginner point of view interesting? Starting a thread:
    r
    • 2
    • 25
  • z

    Zhelyazko Atanasov

    08/29/2020, 7:40 AM
    Where can I file issues related to the docs on developer.android.com? If we can do pull-requests it'll be even better 😄 Sometimes I see references to APIs/Composables that have been renamed or deprecated - e.g. this one.
    VerticalScroller
    was deprecated in dev15 and
    ScrollableColumn
    is the Composable to be used. Also
    LazyColumnItems
    was renamed to
    LazyColumnFor
    in dev16.
    p
    • 2
    • 1
  • p

    Philip Blandford

    08/29/2020, 9:42 AM
    Is anyone seeing this error:
    Caused by: java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
    at androidx.compose.runtime.snapshots.SnapshotKt.readError(Snapshot.kt:1495)
    at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1491)
    at androidx.compose.runtime.snapshots.SnapshotKt.readable(Snapshot.kt:1482)
    at androidx.compose.runtime.SnapshotMutableState.getValue(MutableState.kt:294)
    ...then my code
    It's happening pretty randomly, in code WAY down in my base layers that has absolutely nothing to do with Compose, and at expressions that are very simple and shouldn't fail (one example is just creating a Fraction instance from the apache library).
    z
    m
    a
    • 4
    • 3
  • h

    Halil Ozercan

    08/29/2020, 10:18 AM
    Although this is not directly related to compose, it's about AS 4.2 Canary 8 and Gradle 6.6. I'm getting the following error when I try to build my compose project which is using gradle kotlin dsl, with the specified AS and gradle versions
    Unable to load class 'kotlin.KotlinNothingValueException'.
    
    This is an unexpected error. Please file a bug containing the idea.log file.
    j
    j
    d
    • 4
    • 12
  • j

    jannis

    08/29/2020, 11:50 AM
    I’m always getting the following error:
    e: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.cli.common.messages.MessageCollector$DefaultImpls.report$default(org.jetbrains.kotlin.cli.common.messages.MessageCollector, org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity, java.lang.String, org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation, int, java.lang.Object)'
    
    Execution failed for task ':app:kaptGenerateStubsDebugKotlin'.
    > Internal compiler error. See log for more details
    Anyknow knows how to solve this? (AS 4.2, Canary 8, Gradle 6.6, Gradle Plugin 4.2 beta Alpha 8, Kotlin 1.4.0, Compose 1.0.0-alpha01)
    • 1
    • 2
  • d

    Davide Giuseppe Farella

    08/29/2020, 12:35 PM
    Is this the right way to use a ViewModel in compose?
    @Composable
    fun SearchMovie(viewModel: SearchViewModel, query: String) {
    
        val vm = remember(0) { viewModel }     
        vm.search(query)
        val state by vm.result.collectAsState()
    
        ...
    Also is there a way to “assign” a
    CoroutineScope
    to a given
    @Composable
    function? My ViewModel does not inherit from the Android’s one, so I’m free to pass a Scope in the constructor and cancel it, but I’m not sure how to deal with a Composable’s life-cycle
    t
    j
    a
    • 4
    • 100
  • c

    Chatterjeekaustav11

    08/29/2020, 12:37 PM
    just wondering as compose is now in alpha , still we need AS canary for this?
    :yes: 1
    t
    • 2
    • 2
  • j

    Jan Skrasek

    08/29/2020, 7:25 PM
    Ambients - why sometimes ambients are "registered" with the value directly and sometimes you pass a remembered state of the value? What's is the logic/meaning behind this? I thought that there is already a logic in ambient how to compare new provided value to the previous.
    a
    • 2
    • 9
  • j

    Jan Skrasek

    08/29/2020, 8:21 PM
    Material's Colors has all its fields as a state - documented as an optimization to when the color changes not to recompose everything, but only composables depending on the particular color. But I can't find any place that would modify any color. So is this a preoptimized for some user-land use-cases? And what they could be?
    a
    l
    • 3
    • 7
  • c

    Colton Idle

    08/29/2020, 9:02 PM
    In the Layout Codelab I don't get this part
    For example, if you wanted to add some outer spacing, change the background color of the composable, and round the corners of the ripple, you could use the following code:
    specifically the "round the corners of the ripple". This is the code snippet they're talking about:
    Row(modifier
            .padding(8.dp)
            .clip(RoundedCornerShape(4.dp))
            .background(MaterialTheme.colors.surface)
            .clickable(onClick = { /* Ignoring onClick */ })
            .padding(16.dp)
        ) {
    We're not actually rounding the corner of the ripple, we're more so rounding the corner of the row, and so the ripple only goes up to the clipped area which gives you a rounded corner ripple... right?
    l
    • 2
    • 3
  • a

    Afzal Najam

    08/29/2020, 9:09 PM
    Also, a
    CircularProgressIndicator
    inside an
    AlertDialog
    seems like it's not as smooth outside of it. I'll post a video of this + sample code in a few hours.
    j
    • 2
    • 1
  • c

    Colton Idle

    08/29/2020, 9:23 PM
    Layouts codelab; "Compose also comes with some predefined Material icons you can use, for example the close, favorite and menu icons." Does this mean my apk automatically includes all material icons? Or do they only get packaged in if I reference them in a composable?
    l
    s
    • 3
    • 3
  • j

    Jan Skrasek

    08/29/2020, 10:10 PM
    I'd like to style my "components". Let's say I have specific color for my button. Ideally, I like to call
    Button(backgroundColor = Color.MyColor)
    , but of course, also content color has to be handled. Explicit passing of such seems to be pretty verbose, but there is not probably any way to modify contentColorFor() behavior for my color. Other options is to create own Button implementation but that's not much elegant.
    j
    l
    z
    • 4
    • 8
  • s

    Sergey Y.

    08/30/2020, 12:01 AM
    Sure. I didn't mean to sound inaccurate. I will file an issue on Kotlin issue tracker as well.
    r
    • 2
    • 1
  • d

    dimsuz

    08/30/2020, 12:21 AM
    Is there a way to make LazyColumn/LazyRow snap items after fling/scroll ended? If there was this would be a working view pager out of the box :)
    a
    t
    • 3
    • 6
  • s

    Slackbot

    08/30/2020, 3:54 AM
    This message was deleted.
    r
    k
    • 3
    • 5
  • m

    Mehdi Haghgoo

    08/30/2020, 8:38 AM
    I see a some discussion around Flow in this channel. Given my zero experience with Flow, is there any intrinsic connection between Compose and Flow?
    g
    z
    • 3
    • 2
Powered by Linen
Title
m

Mehdi Haghgoo

08/30/2020, 8:38 AM
I see a some discussion around Flow in this channel. Given my zero experience with Flow, is there any intrinsic connection between Compose and Flow?
g

gildor

08/30/2020, 9:23 AM
No, there is no direct connection, compose just provides support for flow out of the box (same as for RxJava and LivrData)
👌 1
👍 1
z

Zach Klippenstein (he/him) [MOD]

08/30/2020, 1:52 PM
Not about Flow specifically, but Adam pointed out that compose and coroutines have an interesting relationship: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1597343950088100?thread_ts=1597342842.082100&cid=CJLTWPH7S
👍 1
View count: 1