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

    SrSouza

    01/31/2020, 8:11 PM
    Hi guys, anyone trying to port compose to KotlinJS like what the developer from kotlin-libui is doing?
    s
    m
    • 3
    • 2
  • i

    Ian Warwick

    01/31/2020, 11:30 PM
    Is there a modifier that does something like
    WRAP_CONTENT
    ?
    a
    • 2
    • 14
  • k

    Klaas Kabini

    02/01/2020, 10:01 AM
    Just few questions regarding compose 1. Are there any plans to release composables that implements the same behaviour found in recycler views and view pagers? For curiosity reasons, what is the development status of ScrollingList that was shown on code snippets at Android Dev summit last year? 2. Are there any plans to add support for Lottie style animations? In other words, implementing a composable that can render animations defined in Adobe AfterEffects json file. 3. I understand that view models are scoped to the lifecycle of their Lifecycle owners such as Fragments and Activities.  However, is there a possibility that you add support for scoping ViewModels to lifecycle of composable functions. I am asking this question because it feels so cumbersome to initialise a ViewModel inside an activity then pass down its reference to a composable function in order to call functions inside the view model that fetches data. 4. I have find it impossible to arrange items in a Column or Row with Arrangement.Begin for example to place them at the beginning of main axis but still define fixed spacing between the items to space them evenly without having to manually put Spacers between the items. The problem with SpaceBetween, SpaceEvenly, SpaceAround is that it distributes the items over the main axis based on the width or height of the screen especially when the column is root of a composable. Take a look at the example below. If I want to arrange children of a Column to the beginning but still space them evenly, I have to end up writing this boilerplate code of putting spacers between items.
    Column(modifier = LayoutPadding(16.dp), arrangement = Arrangement.Begin) {
      Text(text = "Klaas", style = MaterialTheme.typography().body1)
      Spacer(LayoutHeight(12.dp))
      Text(text = "James", style = MaterialTheme.typography().body1)
      Spacer(LayoutHeight(12.dp))
      Text(text = "Tom", style = MaterialTheme.typography().body1)
      Spacer(LayoutHeight(12.dp))
      Text(text = "Martin", style = MaterialTheme.typography().body1)
      Spacer(LayoutHeight(12.dp))
      ColoredRect(color = Color.Red, modifier = LayoutWidth.Fill, height = 200.dp)
    }
    Can’t we have something like this where we can arrange the children of a layout to the beginning but still give the fixed spacing to spaces them evenly without having to put spacers between the items.  
    Column(modifier = LayoutPadding(16.dp) + ChildSpacing(16.dp), arrangement = Arrangement.Begin) {
      Text(text = "Klaas", style = MaterialTheme.typography().body1)
      Text(text = "James", style = MaterialTheme.typography().body1)
      Text(text = "Tom", style = MaterialTheme.typography().body1)
      Text(text = "Martin", style = MaterialTheme.typography().body1)
      ColoredRect(color = Color.Red, modifier = LayoutWidth.Fill, height = 200.dp)
    }
    a
    m
    • 3
    • 17
  • i

    Ian Warwick

    02/01/2020, 10:03 AM
    is
    ContextAmbient
    always activity? I need to get at the activity to silently get a
    ViewModel
    behind the scenes using
    ViewModelProvider
    fun getModel(): MyViewModel {
            val context = ambient(ContextAmbient) as AppCompatActivity
            return ViewModelProvider(context).get(MyViewModel::class.java)
        }
    k
    m
    a
    • 4
    • 37
  • a

    Adam Powell

    02/01/2020, 2:40 PM
    WIP
    ❤️ 1
    🚀 1
    i
    z
    • 3
    • 14
  • k

    Klaas Kabini

    02/01/2020, 5:07 PM
    Does
    @Stable
    annotation on the composable functions within the framework mean the composable functions are stable and not subject to change? Is that right ?
    👍 1
    a
    • 2
    • 6
  • k

    Klaas Kabini

    02/01/2020, 5:55 PM
    I watched a talk by @Leland Richardson [G] where he was explaining how the compositions are handled using the Gap Buffer, how positional memoization and recomposition works in compose. It was quite interesting. Now my question is that are the compositions under the scene happening on a single thread(i.e. Main thread) or do you guys runs them on multiple threads to speed up the whole process?
    a
    • 2
    • 1
  • i

    Ian Warwick

    02/01/2020, 9:22 PM
    Is there an equivalent of
    CrossAxisAlignment.Center
    for Row as was in FlexRow in dev04?
    • 1
    • 1
  • z

    Zach Klippenstein (he/him) [MOD]

    02/01/2020, 10:38 PM
    Just reading through the
    AdapterList
    PR, excited to see this start to take shape. I believe Flutter implements their lists on top of a fairly complex “sliver” API which they also use to implement things like fancy Material collapsing AppBars ala
    CoordinatorLayout
    . Does the Compose team have any thoughts about how to implement collapsing app bars with Compose? (The AdapterList PR is here: https://android-review.googlesource.com/c/platform/frameworks/support/+/1218839)
    a
    • 2
    • 1
  • p

    prat

    02/02/2020, 4:52 AM
    I'm getting this exception:
    java.lang.IllegalArgumentException: LayoutNode@dcd3e1b children: 1 measureBlocks: MeasuringIntrinsicsMeasureBlocks@cccb17f{ measureBlock=androidx.ui.foundation.ScrollerKt$ScrollerLayout$1$2@876754c } shouldn't require remeasure. relayoutNodes consists of the top nodes of the affected subtrees
    when trying out
    HorizontalScroller
    and
    BottomDrawerLayout
    . Any thoughts of what might have caused this? I basically put 2 sample code together.
    a
    • 2
    • 2
  • i

    Ian Warwick

    02/02/2020, 10:38 AM
    Its not happening all the time but its when toggling a model boolean property which in turn recomposes part of the UI, in my little card app if you click on a card it recomposes to toggle to the back or front of the card, I was repeatedly clicking it when this happened
    Untitled
    a
    • 2
    • 9
  • g

    grandstaish

    02/02/2020, 3:54 PM
    does anyone know how to do the equivalent of
    layout_weight
    in a
    Row
    in dev04?
    a
    c
    r
    • 4
    • 11
  • k

    Kaushalya Pradeep

    02/03/2020, 4:05 AM
    How one should structure a new android project with the hope of migrating to Compose later in order to make migration smoother as possible? MVVM, MVI, BLOC? @romainguy
    👍 1
    s
    m
    +3
    • 6
    • 14
  • i

    Ian Warwick

    02/03/2020, 9:55 AM
    Composing fun 😆 not that proud of my code though still, it looks cool
    👍 19
    🙏 1
    🎹 6
    • 1
    • 1
  • r

    Roar Gronmo

    02/03/2020, 1:32 PM
    Before begin using me precius time... can Room and Compose coexist in dev04 ?
    i
    s
    m
    • 4
    • 7
  • i

    Ian Warwick

    02/03/2020, 10:37 PM
    Will there be a way to debug previews in future release? 🙂
    a
    c
    l
    • 4
    • 5
  • d

    deniskrr

    02/04/2020, 7:11 PM
    Is there any workaround to make
    Room
    run in a Compose project?
    m
    m
    • 3
    • 5
  • a

    aoriani

    02/04/2020, 10:12 PM
    Is
    LayoutHeight.Fill
    in dev04 the proper replacement for
    ExpandedHeight
    in dev03?
    r
    • 2
    • 2
  • t

    Thierry

    02/04/2020, 11:24 PM
    also, should we use @Model or +state?
    j
    m
    +2
    • 5
    • 53
  • s

    satyan

    02/05/2020, 5:18 PM
    👋 I have a question about a potential onion architecture using jetpack compose. • A single activity with a composable view containing the whole application • Each screen is a composable fnuction • Navigation is done by a `androidx-architecture:navigation-compose`implementation In a nutshell: In our current architecture, we are using fragment to handle each screen, and each fragment have a viewmodel to retain it’s state and call the core layer made of use cases and repositories interfaces (implemented in the data layer). Fragment’s view model are scope by their fragment lifecycle so use cases are disposed when needed (using
    viewModelScope
    ) Is a composable screen going to expose a scope so that we’ll be able to provide a ViewModel associated with such a scope ?
    💯 2
    l
    a
    +2
    • 5
    • 13
  • r

    Rodrigo Fonseca

    02/05/2020, 6:03 PM
    is there any way to use compose with a webview?
    a
    • 2
    • 5
  • i

    Ian Warwick

    02/05/2020, 9:36 PM
    Is there something new to consider using
    DoubleTapGestureDetector
    with
    dev04
    this seemed to work but now it won't 😞
    Clickable(onClick = { onClick(element) }) {
                DoubleTapGestureDetector(onDoubleTap = { onDoubleTap(element) }) {
                    when (element) {
                        is TextElement -> TextElement(
                            element,
                            isSelected,
                            isEditing
                        )
                        is ShapeElement -> ShapeElement(element, isSelected)
                        is PianoRollElement -> PianoRollElement(element, isSelected)
                    }
                }
            }
    s
    • 2
    • 3
  • t

    Thierry

    02/05/2020, 10:57 PM
    anyone already tried to use Glide together with jetpack compose?
    z
    l
    i
    • 4
    • 22
  • m

    molikto

    02/06/2020, 10:58 AM
    It seems closures is used a lot in Compose, for example onClicks and childrens. Because they are created each time when a composible function is called, so they are not equal to the previous closure. So does it cause unnecessary compose? Are there plans to address this (like comparing captured variables)?
    a
    t
    l
    • 4
    • 6
  • m

    Matej Drobnič

    02/06/2020, 12:45 PM
    Is there any documentation out on how compose handles state saving (for both configuration changes and process death)? I'm mostly curious about various state objects that are arbitrary classes and thus cannot be parcelized into saved state bundle.
    a
    k
    • 3
    • 6
  • k

    Karthick

    02/06/2020, 4:56 PM
    What is Ambient and ContextAmbient
    z
    • 2
    • 1
  • t

    Thierry

    02/06/2020, 7:50 PM
    so does MaterialTheme point to your current app theme or to some ready made default theme?
    l
    • 2
    • 3
  • z

    Zach Klippenstein (he/him) [MOD]

    02/07/2020, 1:47 AM
    As of at least dev04 (haven’t tried earlier), it looks like
    Clip
    isn’t doing anything. I can implement
    DrawModifier
    and manually clip the canvas before drawing the children, and that works, but
    Clip
    doesn’t seem to have any effect whatsoever. Is this a known issue?
    a
    • 2
    • 5
  • l

    louiscad

    02/07/2020, 10:55 AM
    Is WearOS first-class support planned for Compose once the API stabilizes?
    a
    c
    • 3
    • 30
  • p

    Paolo Achdjian

    02/07/2020, 12:16 PM
    I'm using PathBuilder in order to create a list of PathNode and then use DrawVector to draw it. My problem is that DrawVector need explicitly the size but I would like draw the path as large as the screen, something as LayoutWidth.Fill So, how can I may have this behaviour ?
    z
    • 2
    • 2
Powered by Linen
Title
p

Paolo Achdjian

02/07/2020, 12:16 PM
I'm using PathBuilder in order to create a list of PathNode and then use DrawVector to draw it. My problem is that DrawVector need explicitly the size but I would like draw the path as large as the screen, something as LayoutWidth.Fill So, how can I may have this behaviour ?
z

Zach Klippenstein (he/him) [MOD]

02/07/2020, 3:39 PM
You could wrap your DrawVector in WithConstraints and use max width and max height from the constraints
p

Paolo Achdjian

02/07/2020, 8:07 PM
Thanks
View count: 3