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

    jannis

    12/06/2021, 3:47 PM
    Any idea how to show a vertical
    LinearProgressIndicator
    , meaning full height, small width, animating from top to bottom? I tried to simply rotating it by 90°, which surprisingly worked somehow, e.g.:
    Modifier
        .height(8.dp)
        .fillMaxWidth()
        .graphicsLayer {
            rotationZ = 90f
            transformOrigin = TransformOrigin(0f, 0f)
        }
    But it seems limited to the width of the Composable, hence not filling the whole height. Any other suggestions 😅 ?
    m
    • 2
    • 4
  • m

    maciejciemiega

    12/06/2021, 4:00 PM
    Hey, I've just released AdvancedPreview - a library to customise system UI decoration of your Previews :compose:. Link to GitHub More info on Twitter or in 🧵 Here's an example comparison vs standard Preview annotation with enabled "showSystemUi" option.
    ❤️ 7
    c
    a
    • 3
    • 7
  • t

    Tgo1014

    12/06/2021, 4:01 PM
    How can I call a function just once even if there’s configuration changes?
    c
    s
    +4
    • 7
    • 10
  • m

    mcpiroman

    12/06/2021, 5:33 PM
    Is there a plan to work on performance of the `runtime`module? My app has huge performance problems and in profiler all the hot paths land in
    androidx.compose.runtime
    - mostly methods like
    ComposerImpl.end
    ,
    ComposerImpl.comsume
    ,
    SlotTable.access
    . All other modules like layout, measuring, rendering seem to be OK (except for `Composer.materialize`which is also a very hot path). What do I do - I have simply a Column of like 400 elements, which frankly is not that lot. No LazyColumn because it is even slower and secondly I have to have all the elements instantiated. It is about CfD so I don't have separate release build. (I did manage to get rid of all `sourceInformation-`calls though which did not help much.)
    c
    • 2
    • 6
  • f

    Florian

    12/06/2021, 8:38 PM
    Any idea why my card shadows are clipped off? I seem to not do anything special (code in the thread)
    s
    • 2
    • 13
  • c

    Chris Johnson

    12/06/2021, 10:15 PM
    When using the
    Text
    composable, it seems the text is wrapping to a new line when it does not need to because the the text is so long and has no spaces in between. I noticed if I add spaces to the text it will wrap correctly. First image is wrong (current behavior) second image is what I want. Is this a bug with how Text calculates its
    MultiParagraph
    object? Or is there a setting I'm missing... Code and images in 🧵
    c
    e
    • 3
    • 6
  • d

    Daniel Oliveira

    12/06/2021, 11:01 PM
    Can I observe state in a state hoisting class? If yes, how can I do it?
    z
    s
    • 3
    • 7
  • y

    YASAN

    12/07/2021, 12:16 AM
    I have a traditional 'View' on my route which is supposed to be reused since it takes a long time to load it. I hold it on a shared ViewModel. I only use it on one screen but the screen can be opened from itself (inclusive / keeping only one instance). My issue is that when I open a new instance of the screen from itself, the new screen starts before the old screen runs onDestroy which causes the view to be still attached to the previous screen. I am trying to remove/add the view to/from the parent to fix this but it causes other weird behaviors. Any ideas?
    i
    • 2
    • 2
  • o

    OG

    12/07/2021, 5:40 AM
    Good evening 👋 Got an interesting question (I think 🤔).. I'm trying to get the resolved width/height of a composable in px, which has a modifier using aspect ratio. Something like:
    Image(modifier = Modifier.fillMaxWidth.aspectRatio(1.50f)
    And I want to know the resolved height in px, and use that as an offset for another child composable. For simplicity, imagine this
    Image
    is inside a
    Box
    and there is another child composable in this box that I want to apply an offset too, by doing some calculation using the
    Image
    height. (This problem would be easy if the height was hardcoded like 200.dp, but I have to use aspect ratio) I'm guessing the only way to do this is using the
    Layout
    composable where I would need to measure and layout everything manually... But wondering if there's a more simpler approach that I'm just overlooking. Thanks!
    z
    a
    z
    • 4
    • 10
  • t

    Tgo1014

    12/07/2021, 9:25 AM
    How can I make the “…” works if the text doesn’t have enough space? I tried
    overflow = TextOverflow.Ellipsis
    with no luck
    p
    m
    c
    • 4
    • 4
  • a

    Ankit Shah

    12/07/2021, 10:14 AM
    Hello everyone, I am stuck in a problem in jetpack compose navigation. I do have a case where I have full page screen like login/signup and other settings page and in home page, I need a bottom navigation bar. But time to time I also need to move to full page screen like settings and all from home page. How can I achieve it? does anyone have rough idea, or links to a solution or sample code?
    i
    • 2
    • 1
  • j

    Jason Ankers

    12/07/2021, 12:27 PM
    When using navigation compose
    rememberSaveable
    saves against the nav destination registry. It would be good to be able to call
    rememberSaveable
    against a SaveableStateRegistry higher up (i.e. a parent graph). Is this possible?
    d
    z
    i
    • 4
    • 20
  • t

    Tomas Gordian

    12/07/2021, 12:41 PM
    What should I use to only observe state inside composable and trigger recomposition, but without caching the state so I can set the same value? 🧵
    • 1
    • 2
  • c

    Colton Idle

    12/07/2021, 2:31 PM
    Accompanist pager question: This card shows nothing on purpose and is a very small size. maybe like 24.dps in height.
    Card(
        modifier = Modifier.padding(horizontal = 16.dp).fillMaxWidth().align(BottomCenter),
        elevation = 8.dp) { //nothing }
    When I add a HorizontalPager (replace where it says //nothing with the HP), then the card height becomes the size of the screen. Why and how do you make it only take up the height of the Text?
    HorizontalPager(count = 10) { page ->
      // Our page content
      Text(text = "Page: $page", modifier = Modifier.fillMaxWidth())
    }
    j
    j
    s
    • 4
    • 4
  • a

    Alex

    12/07/2021, 2:46 PM
    Is it possible to define a z-Index for LazyColumns items? The usecase is a draggable list item that should be drawn on top of all other list items so it wont disappear behind list items below it while it is being dragged
    s
    a
    • 3
    • 5
  • j

    Joseph Hawkes-Cates

    12/07/2021, 2:58 PM
    I’m seeing a weird layout issue with the TopBar of one of my views and I’m stumped as to how to fix it at this point. Code and screenshots in 🧵
    z
    s
    • 3
    • 19
  • j

    joadar

    12/07/2021, 4:29 PM
    Hello, if I upgrade to Kotlin
    1.6.0
    and Compose to
    1.1.0-beta04
    my Webview (inside AndroidView) in LazyColumn doesn’t scroll anymore. I tried to change to Column with verticalScroll but same issue. I can’t find any change related to this. Any help?
    a
    g
    • 3
    • 3
  • m

    mattinger

    12/07/2021, 7:41 PM
    So i have a wrapper function that styles a card. The issue i’m having is that if i pass a testTag through the modifier, and that modifier is passed along to the Card function i’m calling, i end up with two nodes with the same test tag:
    @Composable
    fun MyCard(modifier: Modifier = Modifier, ...) {
        Card(modifier = modifier, ...) { ... }
    }
    z
    • 2
    • 11
  • c

    Colton Idle

    12/07/2021, 7:59 PM
    Regarding kotlin version 1.6.0. I've been out of the loop for a bit, but now I updated my project to latest compose 1.1.0-beta04 and it requires kotlin 1.6.0. Weren't there a bunch of things that were broken because of kotlin 1.6.0? Should I just hold off on compose beta04? it doesn't even look like AS has a 1.6.0 kotlin plugin?
    j
    h
    a
    • 4
    • 4
  • s

    Sergey B

    12/07/2021, 9:38 PM
    Hi everyone. I have a question regarding TextField. According Material Design specification the height of TextField should be 48.dp, in compose default height of TextField is 56.dp. Is this on purpose or there is some mistake?
    s
    a
    • 3
    • 9
  • a

    aoriani

    12/07/2021, 10:45 PM
    Is there an easy way to export the images for all the previews? I'm thinking of sharing them with my UX team so they can inspect them.
    s
    • 2
    • 3
  • z

    zsperske

    12/08/2021, 1:11 AM
    How do you apply a new theme to something like an Image? Most of our icons use SVGs, and in the View world we use attrs & themes to change the theme of our icons from greyscale to destructive or disabled. One SVG -> multiple themes to change the different stroke colors
    c
    • 2
    • 15
  • b

    bohregard

    12/08/2021, 2:53 AM
    is it expected to use Material3 with Material2? There are a few components that are in the Material2 library that aren’t in the Material3 library so I wasn’t sure what the status of that was
    c
    • 2
    • 4
  • r

    rsktash

    12/08/2021, 3:03 AM
    Hi I’m trying to integrate facebook ads network via Admob mediation to my app But I’ve encountered an error while restoring view state when using
    AndroidView(factory: ..)
    inside Compose LazyList As a workaround I checked duplicate ids and reset them to random id Error message: IllegalArgumentException: Wrong state class, expecting View State but received class… This usually happens when two views of different type have the same id in the same hierarchy.
    a
    i
    • 3
    • 3
  • c

    Colton Idle

    12/08/2021, 3:49 AM
    One thing I don't get with CompositionLocals is that I need to "get" my local outside of my composable. i.e. Why do I have to do this?
    val backHandler = LocalOnBackPressedDispatcherOwner.current
    MyButton(
        clickEvent = { backHandler?.onBackPressedDispatcher?.onBackPressed() },
    instead of this
    MyButton(
        clickEvent = { LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher?.onBackPressed() },
    r
    s
    • 3
    • 3
  • t

    Tim Malseed

    12/08/2021, 5:06 AM
    Hey, I’m using Lottie with Compose - and the animation repeats indefinitely. For instrumented tests, this means the test gets stuck waiting for composition to complete. I’ve tried setting the
    composeTestRule.mainClock
    autoAdvance
    to false, and then manually advancing the clock - but this doesn’t work very well when I actually want the UI test to take control of the clock. Lottie has the ability to pass in a property representing whether an animation should run a finite number of times, or infinitely. I could pass in a different value for this to the Composable - but this feels akin to making something mutable just for the purpose of testing..
    b
    • 2
    • 9
  • z

    Zoltan Demant

    12/08/2021, 6:53 AM
    Has anyone had any reports of missing/ignored keystrokes when typing fast in compose? I received a bug report with video-proof this morning and I swear I saw a post about it on here earlier - but I cant find it now!
    c
    f
    z
    • 4
    • 6
  • l

    louiscad

    12/08/2021, 9:57 AM
    Is Compose 1.1.0-beta04 compatible with Kotlin 1.6.10-RC ?
    h
    j
    • 3
    • 3
  • a

    Ankit Shah

    12/08/2021, 11:45 AM
    Hello everyone, I want to achieve a screen background similar to this one. does anyone have idea how can I achieve this. The middle separator must be an arc cutout.
    n
    • 2
    • 3
  • n

    natario1

    12/08/2021, 1:04 PM
    Does compose navigation support
    NavType.StringArrayType
    in routes? If so how should the route look like?
    🇳🇴 1
    i
    • 2
    • 5
Powered by Linen
Title
n

natario1

12/08/2021, 1:04 PM
Does compose navigation support
NavType.StringArrayType
in routes? If so how should the route look like?
🇳🇴 1
i

Ian Lake

12/08/2021, 5:53 PM
You can write your own parsers for any type you want: https://developer.android.com/guide/navigation/navigation-kotlin-dsl#custom-types
but generally, you're misusing routes if you're passing lists of data directly as arguments. It would be helpful if you could explain what you are trying to do to avoid an XY Problem: https://xyproblem.info/
n

natario1

12/08/2021, 8:21 PM
Thanks Ian! It's a "compose new message" screen, whose recipients box might be prefilled. We want to pass these optional recipients (e.g. contact ids) to this screen, ideally with the same format used by our server: example.com/newmessage?to=contact1&to=contact2 . A custom type should work though I guess we can't have multiple
to
s in the route.
i

Ian Lake

12/08/2021, 9:21 PM
We don't support duplicate query parameters at the moment, but I think that would actually be a pretty solid feature request to automatically support parsing array types if you'd like to file one: https://issuetracker.google.com/issues/new?component=409828&template=1093757
👍 1
n

natario1

12/09/2021, 7:40 PM
Done https://issuetracker.google.com/issues/209977108
View count: 1