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
  • i

    Ian Warwick

    03/20/2020, 10:01 AM
    Any known issues using reflection with Compose, keep getting this simply just trying to get at a function name
    c
    m
    +2
    • 5
    • 10
  • c

    caelum19

    03/20/2020, 7:36 PM
    Hey guys. Perhaps less so with Kotlin, but it seems most projects end up having some sort of "utils" file. Here are some I have for Compose. Are these useful? Or do they reflect solutions to anti-patterns elsewhere in my code? What utils do you have that others may find useful?
    Utils.kt
    z
    l
    a
    • 4
    • 45
  • m

    molikto

    03/21/2020, 5:36 AM
    BottomNavigation(LayoutPadding(bottom = systemInsets.bottom)) {
    It seems to me background is drawn within paddings?
    • 1
    • 1
  • m

    molikto

    03/21/2020, 6:17 AM
    from ObservableColorPalette:
    This allows for large performance improvements when the theme is being changed, especially if it is being animated.
    Animating themes is pretty cool
    ➕ 1
    z
    • 2
    • 1
  • k

    kartoffelsup

    03/21/2020, 4:15 PM
    How can we apply LayoutPadding to all children of either Column or Row?
    a
    • 2
    • 10
  • a

    aryk

    03/21/2020, 6:24 PM
    Is there any place where we can write feedback for the Compose team?
    a
    r
    • 3
    • 2
  • a

    amar_1995

    03/21/2020, 7:19 PM
    What is an alternative for LayoutFlexible ?
    g
    a
    • 3
    • 3
  • a

    aryk

    03/21/2020, 7:59 PM
    When is proper navigation support expected to come out?
    👍 1
    a
    m
    • 3
    • 5
  • a

    amar_1995

    03/22/2020, 2:36 AM
    I am getting this error when moving between activities.
    java.lang.IllegalStateException: Node should be attached to an owner
    It is occuring to me when I upgrade compose version to dev-07.
    a
    • 2
    • 4
  • v

    Val Salamakha

    03/22/2020, 3:55 AM
    It seems that Vectors.kt file is redundant in the projects JetNews (dev-07). A navigation button could seen as:
    navigationIcon = {
                            IconButton(onClick =  {
                                scaffoldState.drawerState = DrawerState.Opened
                                },
                                children = {
                                            Icon(icon = vectorResource(id = R.drawable.ic_jetnews_logo), tint = Color.White)
                                        }
                                    )
    //                        VectorImageButton(R.drawable.ic_jetnews_logo) {
    //                            scaffoldState.drawerState = DrawerState.Opened
    //                        }
                        }
    And VectorImage could be replaced to:
    Icon(icon = vectorResource(id = R.drawable.ic_bookmarked))
    //VectorImage(id = R.drawable.ic_bookmarked)
    k
    • 2
    • 2
  • m

    molikto

    03/22/2020, 9:43 AM
    I've found various cases positional memorization is the "wrong" recompose method, and I actually need a destructive update. Any suggestions better ways to handle this?
    Untitled
    z
    l
    • 3
    • 3
  • a

    Adrian Blanco

    03/22/2020, 3:53 PM
    It seems like extending interfaces or abstract classes containing @Composable annotations has a regression in dev-06+. I have an use case where I have an interface
    interface Foo { val view: @Composable() -> Unit }
    with an implementation in a different module, using dev-06 and above fails at compile time with this error:
    error: cannot access Foo
    public final class FooImpl implements ...Foo {
    
    bad class file: .../classes.jar(.../Foo.class)
    undeclared type variable: N
    l
    a
    • 3
    • 3
  • c

    codeslubber

    03/22/2020, 6:44 PM
    I have been on Canary Channel so I could use Compose, why is AS constantly offering me the beta releases? do they support compose now?
    m
    • 2
    • 16
  • o

    Oscar Sequeiros

    03/22/2020, 9:14 PM
    Is there a way to write @Composable functions after async calls?
    l
    • 2
    • 4
  • m

    molikto

    03/23/2020, 4:27 AM
    One thing really nice with Scala 3 is union types. It will be wonderful if Kotlin support it, then we can have a API
    fun Button(text: String | AnnotatedString | @Composable () -> Unit)
    . or implicit conversions (which is more powerful for better or worse
    ➕ 2
    l
    k
    +2
    • 5
    • 5
  • g

    Guy Bieber

    03/23/2020, 8:28 PM
    Question: How can you make a VerticalScroller stay scrolled to the end of the list as new data is added? Right now my data is added but the list does not move.
    VerticalScroller(
                isScrollable = true,
                child = child
            )
    c
    • 2
    • 2
  • c

    Chase James

    03/24/2020, 2:07 AM
    I'm getting a weird Kotlin compiler error? Anyone know how to solve these?
    Internal error: Couldn't inline method call 'state$default' into @androidx.compose.Composable public inline fun <T> `state$default`(noinline areEquivalent: ((T, T) -> kotlin.Boolean)?, init: () -> T, `$mask0`: <http://kotlin.Int|kotlin.Int>, `$handler`: kotlin.Any?): androidx.compose.MutableState<T> defined in androidx.compose <no source>
    ✔️ 1
    a
    • 2
    • 3
  • v

    Vincent tiensi

    03/24/2020, 4:44 AM
    Heya! I’m having trouble wrapping my head around centering a view vertically in dev06. It looks like this and my code is like this…
    Row {
            // ...
            Container(width = 48.dp, height = 48.dp) {
                DrawVector(profilePlaceholderImage)
            }
            Spacer(modifier = LayoutPadding(start = 16.dp))
            Column {
              //  ...
              drawNameAndStars()
            }
    // This line of code isn't working as expected 
            Container(width = 14.dp, height = 14.dp, modifier = LayoutFlexible(1f) + LayoutAlign.CenterRight) {
                DrawVector(arrowVector)
            }
        }
    m
    a
    z
    • 4
    • 7
  • i

    Isaac Udy

    03/24/2020, 7:26 AM
    Have method references stopped working? I'm trying to pass an @Composable function via method reference, and it fails to run (or compile, depending on how I define the withView function):
    io.khimera.example.weather.SplashScreenViewModelKt$splashScreenRouter$1$1 cannot be cast to kotlin.jvm.functions.Function2
    fun <T> withView(view: T) where T:(@Composable() (VM) -> Unit)  {
            if (this.view != null) throw IllegalStateException("Route already has view")
            this.view = view
        }
    
    ...
    withView(::SplashScreen)
    r
    l
    • 3
    • 2
  • t

    Thiago

    03/24/2020, 6:26 PM
    I would like to request the compose team for a fractional layout modifier. Its works better than LayoutOffset because I don't have to manager pixels. Its make sense?
    data class LayoutFractional(val dx: Float, val dy: Float) : LayoutModifier {
        override fun ModifierScope.modifyPosition(
            childSize: IntPxSize,
            containerSize: IntPxSize
        ): IntPxPosition = IntPxPosition(
            x = childSize.width * dx.coerceIn(MIN_FRACTION, MAX_FRACTION) *
                    if (layoutDirection == LayoutDirection.Ltr) MAX_FRACTION else MIN_FRACTION,
            y = childSize.height * dy.coerceIn(MIN_FRACTION, MAX_FRACTION)
        )
    
        companion object {
            private const val MAX_FRACTION = 1f
            private const val MIN_FRACTION = -1f
    
            val Origin = LayoutFractional(0f, 0f)
        }
    }
    a
    m
    • 3
    • 10
  • v

    Vincent tiensi

    03/25/2020, 7:10 AM
    Hi, is there any support for nested scrolling like NestedScrollView { RecyclerView } ? Right now I’m using a VerticalScroller wrapping an AdapterList which results in a screen with endless scrolling.
    a
    • 2
    • 1
  • a

    aryk

    03/25/2020, 8:48 AM
    Can we use Lottie in Jetpack Compose?
    a
    • 2
    • 1
  • a

    Andrew Rudenko [JB]

    03/25/2020, 10:07 AM
    Hey. Is there some place with a description of Frame and Model concepts? What is the supposed way to modify Model? As I understand compose callbacks like onClick are executed in scope of Frame, but how to manage such scopes outside of such callbacks (from IO events, for example). Thank you.
    a
    • 2
    • 2
  • p

    prat

    03/26/2020, 3:03 AM
    I made an expand-collapse button. sharing it here in case it might be useful for anyone. (It's easy & fun to make with Compose!) https://gist.github.com/pt2121/3fa9e0e3e2659171102d752b33d1b1c7
    👍 14
    z
    s
    +4
    • 7
    • 22
  • t

    Thiago

    03/26/2020, 2:59 PM
    Is compose accepting pull request?
    m
    l
    a
    • 4
    • 4
  • t

    Thiago

    03/26/2020, 5:22 PM
    Any feedbacks are welcome https://github.com/programadorthi/compose-weather-forecast
    👏 4
    😍 2
    s
    d
    • 3
    • 8
  • g

    gabrielfv

    03/26/2020, 6:46 PM
    This might have been answered before, but given the current need for a successful build in order to have a working preview, does it worry you guys that Compose may become unsustainable in larger apps that have a build time greater than one minute? Is anything in the works so that something like a "real-time pre-build" sort of thing allows for a reasonable fidelity preview or something else?
    l
    z
    • 3
    • 12
  • a

    aljosa

    03/27/2020, 9:48 AM
    i was hoping that compose would have a hot reload (similar to react native or flutter) but looking at android studio preview it looks like that will not happen. anybody knows if compose will support hot reload in the future? (also, if there is a project w/ hot reload in android ecosystem please share)
    s
    l
    • 3
    • 2
  • z

    Zach Klippenstein (he/him) [MOD]

    03/27/2020, 4:36 PM
    The
    drawLayer
    modifier is real nice! https://gist.github.com/zach-klippenstein/e2c8e6edf0d950d8ba527cd0681c5b60
    ❤️ 28
    😮 21
    👍 11
    ✨ 9
    r
    k
    +4
    • 7
    • 31
  • k

    Klaas Kabini

    03/27/2020, 5:42 PM
    I have seen commits in androidx-master-dev that adds translationX/Y and pivotX/Y to drawLayer, which is pretty exciting. Should we expect them in dev08 or dev09?
    l
    z
    • 3
    • 5
Powered by Linen
Title
k

Klaas Kabini

03/27/2020, 5:42 PM
I have seen commits in androidx-master-dev that adds translationX/Y and pivotX/Y to drawLayer, which is pretty exciting. Should we expect them in dev08 or dev09?
l

Leland Richardson [G]

03/27/2020, 5:45 PM
dev08 should have them
k

Klaas Kabini

03/27/2020, 5:47 PM
That is awesome @Leland Richardson [G], once they land, I will refactor my code to use them.
z

Zach Klippenstein (he/him) [MOD]

03/27/2020, 6:01 PM
How is pivot different from rotation?
k

Klaas Kabini

03/27/2020, 6:18 PM
The default rotation you see pivots around the center which is probably width/2 and height/2. Having pivotX/Y allows you to specify origin(i. e points) on the XY plane around which the rotation should pivot upon.
👍 1
z

Zach Klippenstein (he/him) [MOD]

03/27/2020, 6:48 PM
oh, awesome!
View count: 1