https://kotlinlang.org logo
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
  • t

    Thierry

    02/21/2020, 12:14 AM
    AdapterList seems to work well 👏
    z
    l
    +2
    • 5
    • 21
  • s

    SrSouza

    02/21/2020, 12:53 AM
    The composable have a ID that I can get? and three's any callback that I can set when my composable is removed from the SlotTable?
    l
    • 2
    • 5
  • k

    Klaas Kabini

    02/21/2020, 9:50 AM
    Does dev05 support coroutines?
    ☝️ 2
    m
    l
    • 3
    • 2
  • k

    Klaas Kabini

    02/21/2020, 10:18 AM
    What is the difference between Px and IntPx?
    z
    l
    • 3
    • 8
  • a

    ahulyk

    02/21/2020, 10:24 AM
    What is the benefit of using
    Router
    vs
    Navigation Components
    ?
    g
    m
    +3
    • 6
    • 8
  • n

    Nikita Prokopov

    02/21/2020, 1:01 PM
    Hi all! I can’t figure out how to change state and cause a recomposition from outside (not onClick or anything). E.g. from a timer. This:
    val counter = state { 0 }
    timer(period = 16L) { counter.value++ }
    Gives me an exception:
    Exception in thread "Timer-0" java.lang.IllegalStateException: Not in a frame
    	at androidx.compose.frames.FramesKt.currentFrame(Frames.kt:180)
    	at androidx.compose.frames.FramesKt.writable(Frames.kt:461)
    	at androidx.compose.ModelMutableState.setValue(MutableState.kt:176)
    m
    s
    l
    • 4
    • 7
  • c

    Cody Engel

    02/21/2020, 7:03 PM
    Just a heads up, the current setup documentation gives an error when trying to resolve an early access preview of Kotlin associated with dev02, was able to find that it's currently on dev05 but it would be nice if this document called out where to find the current version: https://developer.android.com/jetpack/compose/setup
    l
    • 2
    • 4
  • f

    Filip Zych

    02/21/2020, 7:22 PM
    Not sure if there was already such a question, but will robolectric work with compose?
    l
    a
    • 3
    • 2
  • m

    Miguel A. Ruiz

    02/21/2020, 10:38 PM
    Hi, I have a question, I hope I can explain it properly. I want to show an image with the height fixed (I use a container with a height in dp for that) but I would like to have a width dependent of the image size, I mean to respect the image ratio. How can I achieve that?
    z
    • 2
    • 3
  • c

    carbaj0

    02/22/2020, 7:07 AM
    I download the library and when i try to build the project, Android Studio show me
    The project is using an incompatible version (3.6.0-rc03) of the Android Gradle plugin.
    f
    • 2
    • 4
  • c

    codeslubber

    02/22/2020, 8:23 PM
    I have 9 and dev04 and I am pointing at Canary but it says there is no update? how did some of you guys get 10 and 05?
    f
    a
    • 3
    • 2
  • c

    codeslubber

    02/22/2020, 9:48 PM
    Apparently text in the Button is a modifier now? and drilling down to the JavaDoc on Button helps zero. Crap, this is the major downside of Compose so far. The idea that docs and/or code completion would guide you through setting the basics goes back to the 80s?
    z
    l
    a
    • 4
    • 12
  • z

    Zach Klippenstein (he/him) [MOD]

    02/22/2020, 10:49 PM
    I’m trying to use
    DropdownPopup
    to create a simple Spinner control. I’ve passed
    PopupProperties
    with
    isFocusable = true
    , and the popup shows, but none of the children of the popup seem to be getting any click events and clicking outside the popup neither dismisses it nor sends click events to the underlying window. If I use
    Dialog
    instead of the popup, everything works as expected. Are popups broken?
    👍 1
    i
    g
    • 3
    • 7
  • i

    Ian Warwick

    02/22/2020, 11:46 PM
    Is
    Box
    new? did not see that before, wondering in what way its different to
    Container
    they seem to be quite similar. I see one difference is Container can only have one child however
    Box
    is then also quite similar to
    Stack
    as well I guess 🤔
    l
    a
    c
    • 4
    • 9
  • c

    caelum19

    02/23/2020, 11:31 AM
    Hey, am I doing something wrong? Arrangement seems to have no affect
    val avatar = vectorResource(R.drawable.usertwo)
        val name = "test"
    
        Box(LayoutWidth.Fill + LayoutHeight(65.dp)) {
            Row(arrangement = Arrangement.End) {
                Box(modifier = LayoutWidth(48.dp) + LayoutHeight(48.dp)) {
                    DrawVector(avatar)
                }
                Column {
                    Text(name)
                    Text("Test")
                }
            }
        }
    Dev05
    l
    • 2
    • 2
  • m

    mbonnin

    02/23/2020, 2:35 PM
    Is it possible/recommended to use Ambients from a click listener ? I get
    Composition requires an active composition context
    when trying to do that.
    a
    l
    • 3
    • 10
  • v

    vipulasri

    02/23/2020, 2:51 PM
    Padding
    has been removed in favour of
    LayoutPadding
    in dev-05. I am having issue replicating the this ripple behaviour now.
    Untitled
    a
    l
    • 3
    • 7
  • m

    mbonnin

    02/23/2020, 4:22 PM
    Is there an exemple of how to bind a
    Composable
    to an Activity lifecycle ? With
    Views
    , I could hold a reference to the View and call a method from
    onDestroy
    but I'm not sure how to do with compose ?
    override fun onDestroy() {
            super.onDestroy()
            
            // How do I get a reference to a composable or how do I dispose my composable ?
            composable.dispose()
        }
    m
    a
    +2
    • 5
    • 37
  • c

    codeslubber

    02/23/2020, 7:00 PM
    What happened to
    EditorModel
    in dev05?
    l
    • 2
    • 3
  • c

    caelum19

    02/23/2020, 9:17 PM
    Is there any best practice or opinions on what level of granularity we should create components at, i.e. how much nesting in the absence of reuse should there be (if ever) before creating new components?
    m
    m
    a
    • 4
    • 5
  • z

    Zsolt

    02/23/2020, 11:32 PM
    What's the suggested replacement dev04 -> dev05 for removed TextButtonStyle & ContainedButtonStyle? (also Button no longer has style prop)
    l
    a
    • 3
    • 3
  • b

    bobko

    02/24/2020, 1:32 PM
    I wonder why calling Composable function from regular one doesn't yield any compiler error? (I'm using 1.3.61 Kotlin and latest dev05 compose lib)
    k
    l
    • 3
    • 5
  • c

    Carlos Sessa

    02/24/2020, 4:42 PM
    is there an ETA on when compose is going to be prod ready?
    m
    • 2
    • 1
  • s

    sunnat629

    02/25/2020, 8:05 AM
    What's the alternative of
    Spacing()
    modifier in
    dev05
    ? Or am I missing something?
    i
    m
    • 3
    • 5
  • a

    amar_1995

    02/25/2020, 8:20 AM
    How to close keyboard when imeActionPerformed.
    l
    • 2
    • 4
  • i

    Ian Warwick

    02/25/2020, 8:45 AM
    Any plans for a two way
    Slider
    (range slider?)
    m
    k
    • 3
    • 6
  • m

    Mantas Varnagiris

    02/25/2020, 1:14 PM
    I have a question. I'm not sure if this is for some reason intended or a bug. In Activity if I do this
    setContent {
        onActive {
            Log.d("ASD", "onActive")
        }
        onDispose {
            Log.d("ASD", "onDispose")
        }
    }
    1. Start app -
    onActive
    is called 2. Press back to leave app -
    onDispose
    NOT called 3. Open app again -
    onActive
    is called So if we depend on
    onDispose
    to cleanup resources and it's not called - leaks happen
    s
    m
    +2
    • 5
    • 9
  • k

    Klaas Kabini

    02/25/2020, 6:27 PM
    Can someone explain the purpose of Semantics composable? and when to use it
    z
    r
    • 3
    • 2
  • m

    manueldidonna

    02/25/2020, 8:55 PM
    I have seen that tweet about a Flutter competition to design a clock. Do you think there will be similar initiatives for Jetpack compose? People often argued in favor of Flutter because it's easier to craft beautiful UIs than with native android tools https://twitter.com/FlutterDev/status/1232342125536141314?s=19
    ➕ 1
    a
    • 2
    • 1
  • s

    shikasd

    02/26/2020, 2:56 AM
    hey, I was going through utilities for loading resources and noticed that the
    loadImageResource
    method has some kind of lru cache inside for loaded results (used in
    loadResourceInternal
    ), but it never updates that cache in dev-05
    r
    • 2
    • 4
Powered by Linen
Title
s

shikasd

02/26/2020, 2:56 AM
hey, I was going through utilities for loading resources and noticed that the
loadImageResource
method has some kind of lru cache inside for loaded results (used in
loadResourceInternal
), but it never updates that cache in dev-05
r

Ryan Mentley

02/26/2020, 3:10 AM
A quick look at HEAD suggests it is, at least from the code: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:ui/ui-framework/src/main/java/androidx/ui/res/Resources.kt;l=174?q=%22requestCache.getOrPut%22&ss=androidx
not sure what's in dev05 off the top of my head
s

shikasd

02/26/2020, 3:26 AM
It seems to me that it does for requests here, so if you have two concurrent requests, they do not repeat. But two lines above it uses
resourceCache
which never gets updated.
r

Ryan Mentley

02/26/2020, 10:44 AM
huh...you're right, that does look like a bug.
View count: 4