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

    amar_1995

    08/21/2020, 2:53 PM
    I want to show data in screen after
    onCommit
    completes. What is the suggested ways to do this ?
    a
    • 2
    • 9
  • z

    Zhelyazko Atanasov

    08/22/2020, 11:11 AM
    Any idea why Compose Preview is not working anymore in Android Studio? Is this a known issue? I'm using AS:
    Android Studio 4.2 Canary 7
    Build #AI-201.7846.76.42.6720134, built on July 30, 2020
    Runtime version: 1.8.0_242-release-1644-b3-6222593 x86_64
    with Gradle
    6.6
    , Android build tools
    4.2.0-alpha07
    , Kotlin
    1.4.0
    and Compose
    0.1.0-dev17
    . When I rebuild the project, the Preview doesn't show anything. It's a brand new project created using the "Compose Activity" template in AS and the Preview was working before updating to the latest dependencies (the template in AS was using Compose
    0.1.0-dev13
    ).
    👍 1
    g
    m
    +3
    • 6
    • 12
  • a

    Archie

    08/22/2020, 6:44 PM
    Guys, is there a way to animate size set to
    .fillMaxSize()
    to
    setPrefferedSize(someValue, someValue)
    ?
    d
    • 2
    • 9
  • v

    Vinay Gaba

    08/22/2020, 8:08 PM
    Just played with
    AnimatedVisibility
    . Really like how simple the API is and fits really well to a host of different use cases. Here is what I implemented to demonstrate list deletion with animation. Thanks for your work on this @Doris Liu 👏🏼 Here is the code with comments if anyone is interested - https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example/blob/master/app/src/main/java/com/example/jetpackcompose/animation/ListAnimationActivity.kt#L53
    👏 7
    😍 10
    🔥 4
    h
    d
    +2
    • 5
    • 8
  • d

    dimsuz

    08/22/2020, 11:06 PM
    Hi! Do I miss some easier way to convert
    dp
    to pixels for Offsets? It's OK but I get a feeling that's a bit verbose.
    drawLine(
          color,
          size.bottomLeft(Offset(1.dp.toPx().value, -1.dp.toPx().value)),
          size.topLeft(Offset(0f, 1.dp.toPx().value)),
          Stroke(width = 2.dp.toPx().value)
        )
    z
    t
    • 3
    • 4
  • d

    dimsuz

    08/22/2020, 11:55 PM
    I have found a bug while using
    dev13
    , does anyone by chance know if its fixed, or should I report it? Asking because upgrading to later versions could require some effort.
    Button(
      modifier = if (enabled || MaterialTheme.colors.isLight) borderModifier else Modifier
    )
    Reversing the order of condition operands fixes compilation. This compiles OK:
    Button(
      modifier = if (MaterialTheme.colors.isLight || enabled) borderModifier else Modifier
    )
    I will post a reported exception in the thread >>
    a
    • 2
    • 4
  • d

    dimsuz

    08/23/2020, 11:50 AM
    I have upgraded to
    dev17
    and
    4.2 Canary 7
    and preview doesn't render anything. Running on emulator renders just fine. Is this a known issue? (Invalidate caches didn't help either)
    f
    • 2
    • 2
  • a

    amar_1995

    08/23/2020, 2:10 PM
    I am trying to use
    ProvidableAmbient
    to pass data from screen1 to screen2. How to update data in screen2 and return back to screen1 ?
    a
    z
    • 3
    • 12
  • t

    tjohnn

    08/23/2020, 2:44 PM
    In what scenario should I use
    remember { state }
    rather than just
    state
    ? I have tried and my app works thesame way.
    a
    • 2
    • 10
  • c

    caelum19

    08/23/2020, 3:39 PM
    Is it usually a bad smell if a @Composable fun doesn't have a modifier parameter?
    a
    • 2
    • 1
  • z

    Zach Klippenstein (he/him) [MOD]

    08/23/2020, 5:17 PM
    I was reading through some CLs and left some comments, I hope that’s not out of line. Happy to keep my thoughts to this slack if they’re not meant for public review 😅
    a
    • 2
    • 1
  • y

    Yamila Gammeri

    08/24/2020, 12:22 AM
    Is anyone else having issues with the keyboard not closing when pressing the close button? It closes if I touch the screen. It was working in dev16 but stopped when I updated the gradle to dev17
    p
    j
    • 3
    • 2
  • r

    Reprator

    08/24/2020, 2:04 AM
    TextField(
        value = textValue,
        keyboardType = KeyboardType.Phone,
        imeAction = ImeAction.Done,
        onValueChange = { textValue = it },
        label = { Text("Enter Your Phone Number") },
        placeholder = { Text(text = "904353455") },
        onImeActionPerformed = { imeAction: ImeAction, softwareKeyboardController: SoftwareKeyboardController? ->
            if (imeAction == ImeAction.Done) {
                if(textValue.text.isEmpty()){
                    return@TextField
                }
    
            }
        },
        modifier = Modifier.fillMaxWidth()
    )
    I want to set error on this text field for phone number, but i don't find any errortext, please let me know how can i set the error on textfield
    j
    • 2
    • 10
  • q

    Quentin Dommerc

    08/24/2020, 7:52 AM
    Did I miss something? 👀 👀
    👀 16
    🎉 1
    🤐 4
    j
    j
    +9
    • 12
    • 16
  • g

    Guy Bieber

    08/24/2020, 6:16 PM
    I have text and image in a column. I am moving from Clickable to making the column containing them Modifer.clickable. It seems like I actually have to click around the image and text to make the column clickable action fire. Any ideas on the best way to clean this up? Do I need to stack a clickable column on top?
    f
    • 2
    • 4
  • g

    Guy Bieber

    08/25/2020, 12:27 AM
    I am using dev17 and the format function isn’t an @Compose function hence this value does not update:
    val mDataModel = remember {dataModel}                    
    
                        ui.TextLabelStyled(
                            text = "%.1f".format(mDataModel.value),
                            color = mDataModel.targetColor,
                            fontSize = valueFontSize,
                            modifier = Modifier
                        )
    Is there a workaround?
    g
    • 2
    • 6
  • b

    brandonmcansh

    08/25/2020, 3:11 AM
    What isn't working?
    n
    g
    r
    • 4
    • 38
  • r

    Reprator

    08/25/2020, 5:40 AM
    How to sort this issue, @Composable invocations can only happen from the context of a @Composable function
    g
    • 2
    • 43
  • m

    Maik

    08/25/2020, 9:11 AM
    Hello everyone, is it possible to work with relative heights or widths? Suppose I have a box with a variable size and now I want to draw an image into the box that only fills a part of the box - for example: height of the image = 0.3 x height of the box Is this supported by the framework?
    j
    • 2
    • 2
  • h

    Halil Ozercan

    08/25/2020, 10:29 AM
    With dev17, I started to get this exception
    java.lang.IllegalArgumentException: LayoutNode@bc99a9c children: 2 measureBlocks: androidx.compose.ui.LayoutKt$measureBlocksOf$1@3018c67 is not ready. layoutState is NeedsRelayout
    There is no mention of my code in the stacktrace. I assume it is related to
    LazyColumnFor
    . I will update this message once I have more information. Edit: Looks like it is related to usage of new
    background
    modifier. It was used on a column with dynamic height which is calculated after a image load request.
    a
    j
    a
    • 4
    • 4
  • h

    Halil Ozercan

    08/25/2020, 2:50 PM
    Lately, I've been trying to implement a reddit client in compose. The first challenge I wanted to take on was to play gifs and videos in a list. Notoriously Recyclerview that present video content has been a difficult problem. However, I thought compose would be different based on the experience from my first Youtube like Video Player project. This required a lot more optimization than I initially anticipated but I think this is close to something usable 🙂
    device-2020-08-25-174601.mp4
    👍 4
    ❤️ 2
    p
    a
    • 3
    • 4
  • d

    David Odari

    08/25/2020, 7:21 PM
    So I updated the default compose app Android Studio creates to
    0.1.0-dev17
    and Kotlin version to 1.4.0 as well as the compose Kotlin compiler. This are the dependencies in the dependencies block
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
        implementation 'androidx.core:core-ktx:1.3.1'
        implementation 'androidx.appcompat:appcompat:1.2.0'
        implementation 'com.google.android.material:material:1.2.0'
        implementation "androidx.compose.foundation:foundation:$compose_version"
        implementation "androidx.compose.material:material:$compose_version"
        implementation "androidx.compose.ui:ui:$compose_version"
        implementation "androidx.compose.animation:animation:$compose_version"
        //For @Preview
        implementation "androidx.ui:ui-tooling:$compose_version"
    The issue I have is on the
    @Preview
    annotation claiming it works on composable functions and my function is a composable function .Is there something I am missing?🤔 👇
    v
    a
    • 3
    • 6
  • g

    Guy Bieber

    08/25/2020, 8:12 PM
    I have a Text function and want the value to change when I change the state. There is no onChange for Text. Is there another composable I should use.
    r
    m
    • 3
    • 13
  • m

    manueldidonna

    08/25/2020, 10:34 PM
    Trying to change a state in the background, sometimes I get the following error "Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied".
    // fetch all the items when the inventory change
        launchInComposition(inventory) {
            val currentInventory = inventory.value
            withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
                // fetchAllItems() update the state
                currentInventory.fetchAllItems()
            }
        }
    j
    c
    +2
    • 5
    • 15
  • a

    amar_1995

    08/26/2020, 5:44 AM
    What is replacement for
    FilledTextField
    and
    OutlinedTextField
    in dev17? And is there any easy way to resolve all the issue while moving from one release version to another 😅. I am moving from dev14 to dev17.
    v
    z
    • 3
    • 3
  • w

    Wajahat Karim

    08/26/2020, 10:29 AM
    What is the replacement for
    Draw
    composable. I can see in previous early versions like dev07 or dev08, there used to be a
    Draw
    composable through which we could render other composables on Canvas. I want to rotate a
    @Composable()
    method. Old code is like this:
    @Composable
          fun Rotate(degree: Float, children: @Composable() () -> Unit) {
              Draw(children = children) { canvas, parent ->
                  val halfWidth = parent.width.value / 2
                  val halfHeight = parent.height.value / 2
    
                  canvas.save()
                  canvas.translate(halfWidth, halfHeight)
                  canvas.rotate(degree)
                  canvas.translate(-halfWidth, -halfHeight)
                  drawChildren()
                  canvas.restore()
              }
          }
    l
    • 2
    • 2
  • v

    Vinay Gaba

    08/26/2020, 4:19 PM
    I am on the verge of being rate limited due to my frantic refreshing of AndroidDevelopers twitter account 😄 Whoever has to press that button, can you please do it soon 😄
    😂 22
    c
    p
    +3
    • 6
    • 12
  • d

    Davide Giuseppe Farella

    08/26/2020, 4:25 PM
    It might be a dumb question, but as I’m at my very beginning with Compose and cannot find an answer. Given I want to have something like
    Text(text = myCustomText)
    , where
    myCustomText: Flow<String>
    , what is the cleanest way to deal with that?
    v
    j
    • 3
    • 6
  • t

    tcracknell

    08/26/2020, 5:04 PM
    We are so excited to announce that Jetpack Compose Alpha is here! For all the details, please check out the blog post at http://goo.gle/jetpack-compose-alpha. You can get it now on Google’s Maven Repository and release notes are available at https://developer.android.com/jetpack/androidx/versions/all-channel. As always, feedback is welcome; please log issues at https://issuetracker.google.com/issues/new?component=612128.
    ✅ 2
    🍾 60
    🚀 16
    🙌 80
    ❤️ 24
    :yes: 40
    🎉 90
    ⚡ 20
    👍🏽 3
    c
    n
    +6
    • 9
    • 8
  • z

    Zach Klippenstein (he/him) [MOD]

    08/26/2020, 5:19 PM
    Congrats to the team!! So much for getting actual work done today…
    💛 23
    😂 14
    v
    • 2
    • 1
Powered by Linen
Title
z

Zach Klippenstein (he/him) [MOD]

08/26/2020, 5:19 PM
Congrats to the team!! So much for getting actual work done today…
💛 23
😂 14
v

Vinay Gaba

08/26/2020, 5:26 PM
This was literally what I was thinking right now. How do I concentrate on my actual work 😄
View count: 1