https://kotlinlang.org logo
Docs
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
  • z

    zkeme

    03/16/2021, 3:33 PM
    Hi guys, any replacement for FlexRow and FlexColumn? I'm not finding anything..
    o
    a
    m
    • 4
    • 7
  • c

    codeslubber

    03/16/2021, 5:26 PM
    Trying to update to beta02, copped an animating FAB from JetChat and this function lerp has moved, which is fine, problem:
    k
    • 2
    • 4
  • b

    Bryan Herbst

    03/16/2021, 5:53 PM
    I noticed that the README files for week three of the Android Dev Challenge included this note:
    Did you know you can copy the preview as an image by right clicking on it?
    Which doesn’t actually work for me in Android Studio 2020.3 Canary 9. Is this functionality that should be working, or is planned but just not quite working yet?
    j
    c
    • 3
    • 4
  • d

    Daniele B

    03/16/2021, 7:27 PM
    On the Compose icons, I can only find the “filled” Star icon
    Icons.Default.Star
    but not the “empty” one. Anyone knows if it’s available?
    a
    k
    +2
    • 5
    • 10
  • c

    Colton Idle

    03/16/2021, 8:23 PM
    How would you all go about building this? I guess I can just make a Column with two item types. One item type is for the header, and the other is for each typeface item. Each typeface item would just be a row with weight distributed as 40%, 20%, 20%, 20% I just want to make sure there's no other obvious solution here. There's no "grid" or "table" (like html/css) in compose right?
    c
    • 2
    • 1
  • c

    Colton Idle

    03/16/2021, 10:04 PM
    This is a great little article on the UX of preview in compose https://medium.com/androiddevelopers/a-ux-journey-of-compose-preview-3c95e1f0a8bf Two things in :thread-please:
    👍 2
    • 1
    • 1
  • j

    Jakub Ledwon

    03/16/2021, 10:11 PM
    Hi there, I'm playing with animations and I encountered a following problem: I have two texts and I'm animting their
    fontSize
    (pulse effect animation). I want an animation to be infinite, but I want to be able to restart an animation from default value when state changes. So basically I have a switch which determines which text should be animating, and when switch changes the animation should reset. As my animation is infinite I tried
    rememberInfiniteTransition
    , but there is no way to restart it (or I didn't find any). What would be the best approach for this problem? I would need something like
    InfiniteTransition
    but I don't want to remember it during state changes.
    d
    • 2
    • 1
  • d

    Deepak Gahlot

    03/17/2021, 4:52 AM
    I can see we have a textOverflow property in Text(), but there is no such option in TextField. How do we achieve ellipsis in TextField
    a
    s
    • 3
    • 7
  • s

    Slackbot

    03/17/2021, 6:46 AM
    This message was deleted.
    ✅ 1
    r
    a
    • 3
    • 2
  • k

    Kshitij Patil

    03/17/2021, 8:01 AM
    I might be stating an obvious fact, but noticed one thing today and thought I should share the same. When you’ve many UI components (Button, Text, Progress bar, etc.) cluttered in smaller region and this region is going to get re-composed highly frequent due to some state changes, I simple
    Row
    Column
    based Composable works way better than
    ConstraintLayout
    . So you might lose some alignment constraint provisions but there won’t be any performance hits.
    ConstraintLayout
    was accumulating lag over the time while
    Row
    ,
    Column
    being simple enough, was able to handle heavy operations.
    g
    • 2
    • 1
  • r

    Rafs

    03/17/2021, 8:28 AM
    What is the difference between
    Modifier.height
    and
    Modifier.requiredHeight
    ?
    g
    a
    +2
    • 5
    • 5
  • d

    Danish Ansari

    03/17/2021, 9:24 AM
    Hello dear developers, I just wanted to ask, now that Compose is in beta, is it safe to use it in already existing production apps? As guided here https://developer.android.com/jetpack/compose/interop
    a
    t
    +3
    • 6
    • 8
  • c

    Colton Idle

    03/17/2021, 10:45 AM
    Is it possible to use the
    border()
    modifier to just draw on the bottom? Right now it's drawing a rectangle, but I'd love to tell it to just draw on bottom.
    👀 1
    v
    n
    • 3
    • 2
  • d

    Daniel Candeias

    03/17/2021, 10:48 AM
    How to define
    includeFontPadding
    in component
    Text()
    ? Is this supported in compose?
    a
    • 2
    • 2
  • u

    ursus

    03/17/2021, 1:43 PM
    silly question does compose render after
    Activity.onStop
    ?
    z
    a
    • 3
    • 25
  • u

    ursus

    03/17/2021, 1:55 PM
    or is viewmodel expected somehow to halt emissions
    a
    • 2
    • 1
  • e

    escodro

    03/17/2021, 2:52 PM
    Hello! 👋 I’m trying to implement some Instrumented Tests but I’m facing some issues with
    performTextReplacement
    because there is a TODO inside the function in Compose 1.0.0-beta02. Is it “expected” for a beta? Should I open an issue tracker? EditingBuffer.kt
    internal fun delete(start: Int, end: Int) {
        val deleteRange = TextRange(start, end)
        if (deleteRange.intersects(TextRange(selectionStart, selectionEnd))) {
            // Currently only target for deleteSurroundingText/deleteSurroundingTextInCodePoints.
            TODO("support deletion within selection range.")
        }
    Thanks! ❤️
    • 1
    • 1
  • y

    Yang

    03/17/2021, 3:01 PM
    Is it possible to detect backspace (soft keyboard) key event?
    • 1
    • 2
  • l

    luke_c

    03/17/2021, 3:26 PM
    Hi all 🙂 Been reading about CompositionLocal and I’m trying to understand when you would use a static CompositionLocal over a dynamic one. Is there any guidance on this anywhere? From my understanding a static CompositionLocal will cause the entire tree below to recompose, which seems worse than always just recomposing the Composable(s) using it
    z
    • 2
    • 1
  • r

    Rolbin

    03/17/2021, 4:01 PM
    I have just started with compose and was going through the docs. In almost all the code snippets of the composable functions, with function passed as an argument, are not inlined (even for a 2-3 line function) Is there any specific reason for that?
    f
    f
    • 3
    • 4
  • d

    David Attias

    03/17/2021, 4:39 PM
    I keep getting
    .idea/misc.xml
    file updated by Android Studio every time I open a Compose Preview. I've read that I should keep this file under version control but it is very annoying. Anyone managed to handle this situation properly ?
    g
    • 2
    • 8
  • s

    Samir Basnet

    03/17/2021, 4:43 PM
    There is no autofill support for TextFields as of now. Or is there? Can anyone confirm this?
    b
    • 2
    • 2
  • j

    julioromano

    03/17/2021, 4:58 PM
    Can the bottom sheet in a
    BottomSheetScaffold
    have an intermediate state like for
    BottomSheetBehavior.STATE_HALF_EXPANDED
    ? Right now I managed to have only 2 states, collapsed (defined by
    sheetPeekHeight
    ) and expanded.
    m
    • 2
    • 1
  • j

    jaqxues

    03/17/2021, 5:29 PM
    I am having issues with
    registerForActivityResult
    . I see the result when I override it in Activity, but the callback of the register.... function is not executing. The Intent in question is a GoogleSignInIntent.
    z
    i
    n
    • 4
    • 22
  • d

    Danish Ansari

    03/17/2021, 7:47 PM
    I'm working on a UI Kit library in Compose So I was wondering how should I develop that it works on Android as well as Desktop. Any heads up?
    k
    • 2
    • 7
  • n

    Noé Casas

    03/17/2021, 8:15 PM
    I am getting an exception related to
    SaveableStateProvider
    that says
    java.lang.IllegalArgumentException: Type of the key XXXX is not supported. On Android you can only use types which can be stored inside the Bundle.
    . What does it mean that a type can be stored inside the Bundle? Here,
    XXXX
    is a mere sealed class, nothing exotic.
    i
    z
    a
    • 4
    • 7
  • n

    Neal Sanche

    03/17/2021, 8:25 PM
    I'm trying to replicate a design that has some static background elements, with a bottom navigation bar, and some content pages. Initially a Scaffold within a Scaffold was used for this, where the outer scaffold holds the bottom navigation and a nav host, and the inner scaffolds can have top app bars, and content. To get the static background elements in there, I've put the top level scaffold in a Box, and have the background as a separate composable. This meant the Scaffold's background colour needed to be set to Transparent. But doing so affects the colour of the text painted on it. I thought I'd stop and ask a question instead of going deeper down this rabbit hole. Will put sample code in the thread.
    l
    • 2
    • 8
  • c

    Colton Idle

    03/17/2021, 8:43 PM
    Possible bug with ripples and animatedVisibility? It's very slight but a ripple looks off when the container it's in open up because the ripple goes from filling in the rectangle, to instead be a circle. You can see that the left and right of the expanding item fills all the way to the corner, but the bottom left and right get a rounded ripple. In a large list of expanding and collapsing items my designer asked me if I could have the ripple continue to fill the entire container and thought it was a valid point. Curious if this is a valid bug worth reporting or working as intended. Code inside thread
    possible_rippe_bug.mp4
    l
    d
    • 3
    • 4
  • v

    Vsevolod Ganin

    03/17/2021, 10:07 PM
    Please advise how can I debug situations when composable doesn’t get recomposed when it should (it seems)? For all I know, I click something inside UI, the callback updates external model (completely outside Compose), then reactive forces get to call
    setContent
    on Activity and then just nothing - nothing updates on screen, nothing bumps into my breakpoints except top-level composable. Don’t know where to look honestly
    ➕ 1
    a
    z
    • 3
    • 35
  • t

    Tlaster

    03/18/2021, 6:58 AM
    Just wonder: using
    compositionLocal
    seems like not a good idea, what about using built-in
    compositionLocal
    like
    LocalContentColor
    ?
    j
    • 2
    • 2
Powered by Linen
Title
t

Tlaster

03/18/2021, 6:58 AM
Just wonder: using
compositionLocal
seems like not a good idea, what about using built-in
compositionLocal
like
LocalContentColor
?
j

jim

03/18/2021, 2:00 PM
Use your best judgement, Sometimes using CompositionLocals is necessary, but it is a good idea to avoid composition locals whenever possible. Also avoiding anything that is platform-specific (eg. AAC ViewModel, ConstraintLayout, and Navigation are Android-only so I'd typically avoid them) and anything that is application specific (eg. direct calls into your application backend) should also be avoided. All CompositionLocals break widget API modularization because any widget which uses your widget is now implicitly exposing additional public API that they may not have intended to expose and may have considered to be an implementation detail. They are also more difficult to reason about the data flow when things happen implicitly, which is especially troublesome for refactoring. So avoid when possible, but ultimately you gotta do what you gotta do to build your app.
t

Tlaster

03/18/2021, 2:53 PM
Thanks! I'm considering removing the use of custom CompositionLocals and platform-specific components (I'm using ViewModel, Navigation and other Jetpack components which blocking the app from cross-platform), I might need to reconsider the app architecture.
🎉 1
View count: 1