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

    ursus

    07/24/2019, 12:14 AM
    whats a rough timeline on this? a year?
    t
    • 2
    • 1
  • s

    sngrekov

    07/24/2019, 1:19 PM
    Isn't Compose's Positional Memoization is essentially the same as Incremental DOM? I can see a lot of similarities
    🤔 1
    l
    • 2
    • 1
  • c

    Ch8n

    07/25/2019, 5:56 AM
    Hey, I'm getting started with compose. Can anyone guide me to good getting started guide or blogs. Also learning more about reacts declarative ui will help in better understanding in compose?.. will state and event management like thing will be required for Android too now?
    j
    c
    f
    • 4
    • 3
  • l

    Leland Richardson [G]

    07/31/2019, 5:10 PM
    At risk of this channel just becoming shameless self-promotion… the recording of my Chain React talk about compose just came out. Some folks here asked me to post it, so here it is!

    https://www.youtube.com/watch?v=4EFjDSijAZU▾

    🎉 5
    👍 30
    🔝 12
    🙏 6
    😆 10
    i
    d
    v
    • 4
    • 3
  • m

    moetouban

    08/02/2019, 11:15 PM
    So with compose, would it make sense to architect your data flow and manage state using redux maybe with the help of https://github.com/ReKotlin/ReKotlin ?
    e
    p
    • 3
    • 2
  • l

    Leland Richardson [G]

    08/03/2019, 12:02 AM
    i also haven’t used the above library, but pretty much all redux-like libraries will be able to easily interop with compose. Looking at the readme, and targeting current Compose APIs (which are subject to change), you could easily interop with ReKotlin like so:
    // normal API to create a store based on readme example
    val mainStore = Store(
         reducer = ::counterReducer,
         state = null
    )
    
    // effect-based API to select/subscribe to store in composition
    fun <TSlice, TState> Store<TState>.select(selector: (TState) -> TSlice) = effectOf<TSlice> {
      val result = +state { selector(state) }
      +onCommit(selector) {
        val observer = StoreSubscriber<TSlice> { result.value = it }
        subscribe(observer, selector)
        onDispose {
          unsubscribe(observer)
        }
      }
      result.value
    }
    
    // usage
    @Composable fun SomeView() {
      val count = +mainStore.select { it.counter }
      Text("Count: $count")
    }
    👍 2
    m
    p
    a
    • 4
    • 4
  • a

    Adam Powell

    08/04/2019, 1:38 PM
    yes, quite a bit of lifecycle discussion. It's my goal to have pure-compose activities handle their own config changes, i.e. not tear down and recreate the activity. With a reactive system it's redundant. In many ways you can think of Android's activity recreation as a very coarse-grained reactive rebuild of a UI and compose can do it granularly.
    😍 16
    k
    • 2
    • 2
  • l

    Leland Richardson [G]

    08/05/2019, 7:50 PM
    breakpoints should work without anything special. what logging do you want to enable?
    p
    • 2
    • 1
  • m

    Mark Murphy

    08/05/2019, 10:41 PM
    Are there particular issues with using Compose in a fragment? This code builds and runs fine, though admittedly it does not do much:
    class SampleRosterFragment : Fragment() {
        override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
            inflater.inflate(R.layout.empty_frame, container, false)
    
        override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
            (view as ViewGroup).setContent {
                Padding(10.dp) {
                    
                }
            }
        }
    }
    This code causes the IDE and Gradle to go ballistic, with inscrutable error messages:
    class SampleRosterFragment : Fragment() {
        override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
            inflater.inflate(R.layout.empty_frame, container, false)
    
        override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
            (view as ViewGroup).setContent {
                MaterialTheme {
                    Padding(10.dp) {
    
                    }
                }
            }
        }
    }
    Yet that same
    MaterialTheme
    construction works fine from an activity. I notice that the demos seem activity-centric, though I'm not certain if that is due to current Compose limitations or is tied to other concerns for how you are using those activities.
    l
    t
    • 3
    • 9
  • a

    alexsullivan114

    08/06/2019, 2:31 PM
    I have a question about the general philosophy moving forward with compose. Is the the thought that in the future we'll typically move away from activities and fragments and just have compose views all the way down? Or is the plan to integrate compose and activities/fragments to retain some of the current approaches to navigation.
    m
    u
    +4
    • 7
    • 11
  • a

    Amirul Zin

    08/07/2019, 6:11 AM
    Hi all. I’ve been Googling around but can’t seem to find an answer for this. Does JetPack compose support (or planning to support) resource qualifiers? Something that is currently easy to do in Android is supporting multiple configurations e.g. density based, RTL layouts, localizations etc. Powered by DataBinding null-aware inflation, this made supporting all this configurations quite trivial to implement. If it wasn’t supported, maybe something of the below (haven’t look thru the Compose code yet) would work?:
    @Qualifiers("sw600dp")
    @Composable
    fun someView(){
       ...
    }
    Or maybe just pass in the current qualifiers to the composable function? If I got off the wrong starting point, please enlighten me. Thanks!
    j
    a
    • 3
    • 2
  • a

    Andrey Stepankov

    08/13/2019, 11:44 PM
    Hi all. Is Compose Android-only ui library or can we use it for the kotlin multiplatform? Since this library will be delivered separately from Android, will it be possible to use it without the android framework?
    s
    t
    +4
    • 7
    • 7
  • l

    louiscad

    08/16/2019, 10:25 AM
    Hi, Does Compose UI have a first-class API for user input like multi-touch gestures, mouse/touchpad input (think Chromebooks), keyboards, and arbitrary input soures? Or will we need to use platform API? Or maybe it's planned?
    m
    s
    • 3
    • 6
  • l

    louiscad

    08/17/2019, 9:18 AM
    If found the following comment in Compose codebase:
    // onConfigurationChange is the correct hook to update configuration, however it is
    // possible that the configuration object itself may come from a wrapped
    // context / themed activity, and may not actually reflect the system. So instead we
    // use this hook to grab the applicationContext's configuration, which accurately
    // reflects the state of the application / system.
    (from https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt#170) and I'm concerned it would break the usage of
    Context.createConfigurationContext()
    usually used when you want to change the language to be different from the default one in the system, or use an app local custom configuration for other purposes. Why not use the configuration from the given context instead?
    i
    • 2
    • 1
  • m

    Mark Murphy

    08/19/2019, 5:13 PM
    Should the automatic recomposition feature of
    @Model
    be working in the current Compose code? I created this based on the
    @Model
    KDoc:
    @Model
        data class AgreementViewState(var terms: Boolean = true, var privacy: Boolean = false) {
            val canProceed = terms && privacy
        }
    
        @Composable
        private fun Agreement() {
            Padding(8.dp) {
                val viewState = +model { AgreementViewState() }
    
                Column(mainAxisAlignment = MainAxisAlignment.Start, crossAxisAlignment = CrossAxisAlignment.Start) {
                    Row(mainAxisAlignment = MainAxisAlignment.Start) {
                        Checkbox(
                            checked = viewState.terms,
                            onCheckedChange = { viewState.terms = it }
                        )
                        Text(text = "I agree to the terms and conditions")
                    }
                    Row(mainAxisAlignment = MainAxisAlignment.Start) {
                        Checkbox(
                            checked = viewState.privacy,
                            onCheckedChange = { viewState.privacy = it }
                        )
                        Text(text = "I agree to the privacy policy")
                    }
                    Text(text = if (viewState.canProceed) "You may proceed" else "Please indicate your agreement")
                }
            }
        }
    The initial state works (the top
    Checkbox
    is checked). And via logging I can confirm that my
    onCheckedChange
    lambdas are being called. However, the UI is not being recomposed as I update the
    AgreementViewState
    , so the checkboxes and text remain fixed. By contrast, this works with automatic recomposition as I update the `checkboxState`:
    @Composable
        private fun SimpleCheckbox() {
            Padding(8.dp) {
                val checkboxState = +state { true }
    
                Checkbox(
                    checked = checkboxState.value,
                    onCheckedChange = { checkboxState.value = it }
                )
            }
        }
    I'm trying to determine if there's something that I'm doing wrong or if this is just a current limitation. Thanks!
    m
    s
    l
    • 4
    • 15
  • t

    themishkun

    08/19/2019, 9:44 PM
    Any updates on coroutines working with compose? Getting “An operation is not implemented: not implemented while generating code for”
    j
    l
    r
    • 4
    • 5
  • t

    themishkun

    08/20/2019, 8:47 AM
    And what about SAM conversions inside effect hooks (not sure how these constructs called properly)?
    @Composable
    fun foo() {
        +onActive {
            (0..10).maxWith(Comparator<Int> { a, b -> a.compareTo(b) })
        }
    }
    this code above throws long compilation error but this code below runs fine
    @Composable
    fun foo() {
        +onActive {
            (0..10).maxWith(object : Comparator<Int> {
                override fun compare(a: Int, b: Int): Int {
                    return a.compareTo(b)
                }
            })
        }
    }
    error_output
    l
    j
    • 3
    • 7
  • l

    Luca Nicoletti

    08/21/2019, 7:58 AM
    Yesterday I was playing around with Jetpack Compose and I found out there’s a new
    Compose Activity
    from the
    New File > Activity
    menu. This creates some files but the code inside of them is broken. any clue? 🙂
    k
    • 2
    • 4
  • l

    Luca Nicoletti

    08/21/2019, 4:35 PM
    What does this:
    Caused by: java.lang.IllegalStateException: Composition requires an active composition context
    mean? What are the possible causes?
    k
    r
    c
    • 4
    • 11
  • r

    romainguy

    08/22/2019, 8:23 PM
    @Mark Murphy This kind of widgets will very likely use child windows
    m
    • 2
    • 9
  • a

    Andrey Danilov

    08/24/2019, 6:26 PM
    How will compose ui testing look like? Do you plan to improve Espresso or you will create brand-new testing framework similar to Flutter Driver?
    👍 1
    l
    j
    • 3
    • 2
  • j

    jim

    08/26/2019, 5:44 PM
    On Friday, we merged in the IR rebase, which means that a whole bunch of Kotlin features which previously didn't work are now working! The backend IR is still a WIP, so not everything is working, but it should be better than before. For example, SAM types (passing lambda where a single method interface is accepted) are now working! Feel free to do a repo sync and try it out!
    👍 4
    👏 38
    l
    • 2
    • 1
  • t

    tk

    08/27/2019, 1:22 PM
    Hi. This is my first post. I would like to know how to create a new activity for trying Jetpack Compose. I have already downloaded ASOP in my computer. I tried creating a new
    Compose Activity
    via
    File -> New -> Activity
    on
    ui-demos
    folder. But some extra xml files and codes added in
    build.gradle
    , so that the project could not build at all.
    l
    • 2
    • 5
  • b

    ben.oberkfell

    08/28/2019, 6:36 PM
    https://speakerdeck.com/benoberkfell/prototyping-with-jetpack-compose
    🙌 22
    👍 12
    a
    s
    +2
    • 5
    • 8
  • s

    Simon Schubert

    08/29/2019, 10:33 AM
    I'm also working on a little game, actually 3 mini games, written in Jetpack Compose🎉. I don't have slides but the source code: https://github.com/SimonSchubert/Braincup It's almost ready to be shipped into production(joking😬) but I get an ANR in 1 minigame and I can't figure out why. Because the other 2 games run fine and I don't see what I'm doing significant different. Stacktrace and class are in the comments. Maybe someone has a hint or feedback in general.
    👍 4
    r
    • 2
    • 6
  • l

    Luca Nicoletti

    08/30/2019, 7:54 PM
    Can anyone tell why this piece of code is throwing the exception?
    Untitled
    f
    • 2
    • 6
  • l

    Luca Nicoletti

    09/01/2019, 10:05 AM
    Hello, trying to achieve a Todo List in Compose, however, when I create a
    @Model
    class which has a list, adding elements to that list don’t trigger the drawing of the model on the screen. In order to have it working I added a
    counter
    to that model class. Increasing that
    counter
    whenever I add something to the list triggers the drawing of the model on the screen. (https://gist.github.com/lnicolet/039d2fe76e19e859582e32625ac411e7, https://gist.github.com/lnicolet/cb49c5a4021efc3b784bf95ec5755321). Working and not working examples in the links. Is there a different way to have it working with
    lists
    ?
    t
    s
    w
    • 4
    • 6
  • j

    Jeremy White

    09/01/2019, 6:35 PM
    What's the best way of keeping up to date on changes to Compose? I'm taking the Ray Wenderlich tutorial series on Compose and have run into a case where a component (CraneWrapper) is no longer available.
    a
    l
    • 3
    • 7
  • i

    Icaro Temponi

    09/01/2019, 7:06 PM
    https://android-review.googlesource.com/c/platform/frameworks/support/+/1112008 Oh boy, we're finally getting near to a release outside of androidx, awesome.
    😱 8
    👏 22
    🎉 34
    😮 18
    p
    c
    +3
    • 6
    • 8
  • k

    kioba

    09/03/2019, 3:39 PM
    is there a flag to render component bounds and paddings for compose? something similar to flutter's
    debugPaintSizeEnabled
    g
    • 2
    • 1
Powered by Linen
Title
k

kioba

09/03/2019, 3:39 PM
is there a flag to render component bounds and paddings for compose? something similar to flutter's
debugPaintSizeEnabled
g

George Mount

09/03/2019, 3:39 PM
Not yet
😢 2
👍 1
View count: 1