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

    streetsofboston

    10/24/2019, 5:41 AM
    @Cody Engel What about a ViewModel property that is of a type of a
    @Model
    class?
    c
    l
    • 3
    • 16
  • l

    Luca Nicoletti

    10/24/2019, 8:07 AM
    If I add this property I get an error:
    Could not find method compose() for arguments [true] on BuildType container of type org.gradle.api.internal.FactoryNamedDomainObjectContainer.
    Untitled
    l
    j
    • 3
    • 5
  • i

    Icaro Temponi

    10/24/2019, 12:15 PM
    org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'kotlinPlugin' not found
    With AGP 4.0.0-alpha01 and Kotlin gradle plugin 1.3.60-eap-25, what else do I need to add to gradle to enable this? (as shown in the compose tutorial: https://developer.android.com/jetpack/compose/setup#compose-compiler) PS: Also not working with Kotlin plugin version
    1.3.60-eap-76
    .
    ☝️🏼 1
    l
    j
    • 3
    • 7
  • i

    Icaro Temponi

    10/24/2019, 1:19 PM
    Caused by: java.lang.AssertionError: IR backend shouldn't call KotlinTypeMapper.mapType: AppMain
    Well that's sad, just when I was trying to add Compose to an existing app to be the first to use it at production, I get this with 3 different versions of Kotlin, looks like Play Store will be compose free for some more time :troll:. PS: Fixed by commenting the following lines:
    buildFeatures {
        compose = true
    }
    ➕ 1
    k
    • 2
    • 1
  • t

    Tristan Caron

    10/24/2019, 1:50 PM
    Is there something like dependency injection or BLOC or environmental object?
    j
    f
    +2
    • 5
    • 13
  • w

    waqas

    10/24/2019, 1:55 PM
    I’m on
    Android Studio 4.0 Canary 1 Build #AI-192.6817.14.36.5959023, built on October 23, 2019
    but I don’t see any import from sample option. I wanted to import
    JetNews
    and play around with it. Anybody else facing similar issue? Basically this first step:
    If you're in the Welcome to Android Studio window, select Import an Android code sample. If you already have an Android Studio project open, select File > New > Import Sample from the menu bar.
    s
    • 2
    • 2
  • i

    Icaro Temponi

    10/24/2019, 2:35 PM
    There you go, even though it's just a stateless confirm dialog, it's made with Compose and it's shipped to Play Store 🙂, now we have Composables on production somewhere.
    😂 17
    l
    a
    s
    • 4
    • 11
  • w

    wasyl

    10/24/2019, 3:30 PM
    Another question 🙂 I see that
    Layout
    function calls
    LayoutNode
    with some paramerters and passes children. However I can’t seem to find
    LayoutNode
    function anywhere, and the class has no constructor, so where is it coming from? Does Compose plugin handle Node subclasses somehow and generate functions for them?
    j
    • 2
    • 3
  • j

    jim

    10/24/2019, 4:28 PM
    @Luca Nicoletti Haha, because we were too busy trying to finish up AS 4.0 and get it ready for you all, we didn't have time to install it in our own repository. 🙂. I have a CL to upgrade our repository, just need update the agp4 dependencies before landing it.
    l
    • 2
    • 3
  • n

    Neal Sanche

    10/24/2019, 4:37 PM
    I've been trying to do something that I thought was going to be simple. I want to make a material card with a text inside it that fills the width of the screen. All I can do is making it look like it's wrapping content. Code is so far like this:
    @Preview
    @Composable
    fun MainScreen() {
        MaterialTheme {
            Row(mainAxisSize = LayoutSize.Expand) {
                Greeting("Android")
            }
        }
    }
    
    @Composable
    fun Greeting(name: String) {
        Card(shape = RoundedCornerShape(4.dp), elevation = 10.dp) {
            Text(text = "Yo $name!", style = +themeTextStyle { button })
        }
    }
    and my preview looks like:
    l
    l
    m
    • 4
    • 11
  • i

    Icaro Temponi

    10/24/2019, 5:56 PM
    Is there an ETA for not needing to add kotlin-reflection as dependency to use Compose? I want to use it on more "safe" (simple and stateless) places in production but don't want to increase the aab size by ~1mb.
    r
    • 2
    • 1
  • j

    jim

    10/24/2019, 6:25 PM
    Where are you seeing
    kotlin-reflection
    in the tutorial? Can I get a link?
    l
    • 2
    • 3
  • k

    kioba

    10/24/2019, 9:50 PM
    can we decode Vector assets with
    +imageResource(R.drawable.ic_face_primary_24dp)
    ? The method fails to generate the bitmap and throws
    IllegalArgumentException("Problem decoding into existing bitmap")
    I am not sure if I mess up or we can only decode Bitmaps atm
    j
    • 2
    • 2
  • a

    andrew

    10/25/2019, 12:09 AM
    Do we have a
    colorResource
    for decoding color references?
    k
    j
    • 3
    • 7
  • k

    kioba

    10/25/2019, 12:47 AM
    in case of
    Column { Text() }
    the text is wrapped to the next line but with `Row { Column{ Text() } } a long text is cropped. Is there any way to limit the width of the Text to the size of its container?
    • 1
    • 1
  • i

    itnoles

    10/25/2019, 2:15 AM
    No Compose version of BottomNavigationView?
    k
    r
    a
    • 4
    • 3
  • m

    mzgreen

    10/25/2019, 4:54 AM
    How does Compose relate to current View system? I mean, Android UI Compose. Is there somewhere down the stack an actual Android View used? From the ADS talk I assume that for at least some of the components there is (for example WebView, MapView maybe TextView?). If so then where is this layer in the stack that was showed on ADS presentation? Are there Compose Components that are completely independent of current View system that are written completely from scratch using Compose? And last question is about @GenerateView annotation - what does it do? Does it translate Compose code into View code under the hood? Or maybe it generates an xml or something?
    g
    l
    +4
    • 7
    • 28
  • r

    Rafal

    10/25/2019, 11:18 AM
    Hello, how can I create rectangle shape with
    width=4dp
    and
    height=match_parent
    in compose?
    m
    a
    p
    • 4
    • 13
  • j

    Jakub Valigura

    10/25/2019, 12:54 PM
    Hello guys, I wanted to try Compose in my current project, however when I try to build the project I get the following error java.lang.IllegalStateException: Backend Internal error: Exception during code generation Caused by: java.lang.AssertionError: IR backend shouldn’t call KotlinTypeMapper.mapType: EULAFragment (not using any Compose in that Fragment) Any idea why? (If I delete the class the same happens with the next one) If I create a new project it works flawlessly, same with the demo Project JetNews
    k
    j
    • 3
    • 6
  • m

    mzgreen

    10/25/2019, 1:02 PM
    It should be possible. You can use
    @GenerateView
    to consume Compose UI like normal views. But remember that Compose is not production ready yet.
    f
    a
    +2
    • 5
    • 6
  • t

    tieskedh

    10/25/2019, 1:16 PM
    I guess the oposite isn't possible either? (I need to include a logo inside my TopAppBar, but I use FitStart... A work-around for creating an image as title isn't difficult, but I don't know how to do FitStart...)
    a
    • 2
    • 3
  • b

    Bruno_

    10/25/2019, 5:32 PM
    how do I change view? (in other words - navigate to other Composable) I tried to do the same thing as in Jetnews sample but it didn't work the only thing I did different is instead of
    MaterialTheme
            ModalDrawerLayout(
                bodyContent = { AppContent { onDrawerStateChange(DrawerState.Opened) } }
            )
        }
    i placed inside Material theme
    AppContent()
    directly
    f
    w
    p
    • 4
    • 21
  • d

    david.vavra

    10/25/2019, 6:23 PM
    Hi, beginner question: What's the meaning of '+' in Jetpack Compose? For example in
    +vectorResource(R.drawable.ic_face_primary_24dp)
    . When it should be used and when not? Couldn't find it in the tutorial or ADS talks.
    f
    w
    a
    • 4
    • 6
  • s

    Sergey B

    10/25/2019, 7:54 PM
    Hi everyone. I'm really exited about jetpack compose. I know this is just a dev preview but I built "Jetnews" sample application and there is some lags when screen changes, I guess there planned some performance improvements. Also, I wanted to is there any solution for navigation eg. handling backpress etc?
    a
    a
    m
    • 4
    • 10
  • s

    SrSouza

    10/25/2019, 8:26 PM
    Hi guys, I run the Jetnews but I have a question, when a enter in a post, if I press the back button he closes the app. The back stack is not implemented yet for compose?
    a
    • 2
    • 2
  • a

    andrew

    10/25/2019, 9:22 PM
    I don’t know if anyone pointed these small UI issues out, but scrolling doesnt slow down on a curve
    a
    • 2
    • 1
  • a

    andrew

    10/25/2019, 9:22 PM
    and theres no overflow effect
    a
    c
    +2
    • 5
    • 8
  • a

    andrew

    10/25/2019, 9:23 PM
    I’m also impressed with how smooth this is for something that’s in alpha
    c
    • 2
    • 1
  • a

    andrew

    10/25/2019, 9:43 PM
    Is recompose kinda like invalidate?
    l
    m
    j
    • 4
    • 16
  • b

    Blundell

    10/26/2019, 6:02 AM
    Is it possible to see these examples referenced in the JavaDocs, from AndroidStudio?
    l
    w
    a
    • 4
    • 5
Powered by Linen
Title
b

Blundell

10/26/2019, 6:02 AM
Is it possible to see these examples referenced in the JavaDocs, from AndroidStudio?
l

Luca Nicoletti

10/26/2019, 6:51 AM
Download the repo :troll:
You can then explore the entire project, with the latest - breaking as well, sometime 😞 - changes
w

wasyl

10/26/2019, 10:42 AM
I believe if you open help popup (F1) it shows the embedded example
Although it does seems that for most functions the samples are unresolved 😞
a

Andrey Kulikov

10/26/2019, 1:06 PM
yeah, we didn't yet figure out how to embed samples with the library binary. not convinient, but you have to find them in aosp atm
👍 1
View count: 2