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

    Chris Johnson

    09/27/2021, 7:30 PM
    Hello 👋 Is there a way to intercept touch events such as
    ACTION_DOWN
    and
    ACTION_UP
    but still allow a LazyColumn to have
    ACTION_MOVE
    for scroll? My use case is: I want to allow a full screen list to scroll, but I want to do something when a finger is lifted up such as snap the list to a specific position
    z
    • 2
    • 5
  • r

    Ravin Jain

    09/27/2021, 9:43 PM
    Anyone faced an issue with
    accompanist
    library and
    hiltAggregateDepsDebug
    * What went wrong:
    Execution failed for task ':app:hiltAggregateDepsDebug'.
    > Could not resolve all files for configuration ':app:hiltCompileOnlyDebug'.
       > Could not resolve io.github.aakira:napier:1.4.1.
         Required by:
             project :app > com.google.accompanist:accompanist-permissions:0.18.0
             project :app > com.google.accompanist:accompanist-pager:0.18.0
          > The consumer was configured to find attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug'. However we cannot choose between the following variants of io.github.aakira:napier:1.4.1:
              - commonMainMetadataElements-published
              - debugApiElements-published
              - debugRuntimeElements-published
              - iosArm64ApiElements-published
              - iosArm64MetadataElements-published
              - iosX64ApiElements-published
              - iosX64MetadataElements-published
              - jsApiElements-published
              - jsRuntimeElements-published
              - jvmApiElements-published
              - jvmRuntimeElements-published
              - metadataApiElements-published
    🧵 1
    :yes: 1
    a
    • 2
    • 2
  • m

    myanmarking

    09/27/2021, 10:44 PM
    if i want to draw a fixed size colored rectangle, with a logo inside. Should i use an image inside a box? surface ? other? i never know
    o
    z
    • 3
    • 6
  • n

    Nathan Castlehow

    09/28/2021, 3:14 AM
    Hi, Sort of following up attached question if one of the compose team has a sec? What would be the correct way to scroll down a lazy list using the dPad? Is there an issue I should watch where this would end up as part of the focus system, similar to how non lazy lists do it. (haven’t been able to find exactly what I was looking for)? Or should I capture dpad events and use lazy list animate to item function? Thanks a tonne! https://kotlinlang.slack.com/archives/CJLTWPH7S/p1632370300307400
    l
    • 2
    • 1
  • j

    Jordan Silva

    09/28/2021, 10:49 AM
    Hey… I’m implementing Accessibility Tests with Compose and so far the only way that I’ve found to do is using ComposeRule and Semantics. I tried to cover more Accessibility tests like contrast, spacing, etc, with Espresso, by enabling
    AccessibilityChecks.enable()
    . However I noticed the View Hierarchy printed from Espresso only had a
    ComposeView
    and
    AndroidComposeView
    with no extra information like text, content description.
    +---->AndroidComposeView{id=-1, visibility=VISIBLE, width=1080, height=1808, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@6460a4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} 
    |
    +----->RippleContainer{id=-1, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@ef261c2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} 
    |
    +------>RippleHostView{id=-1, visibility=VISIBLE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@508ebd3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
    Another issue I had migrating to Compose is that our Espresso tests will fail after a simple screen migration. 😐 If we have a simple screen with just a Text. And we migrate to Compose, Espresso won’t find that Text anymore. So, just creating an Activity with a Text, and changing that to ComposeView and adding a Compose Text (with the same information). If we try to do the following code, it won’t find the View.
    Espresso.onView(withText(R.string.app_intro)).check(matches(isDisplayed()))
    I found this answer, so I guess I have to implement new tests while migrating to compose: https://github.com/android/compose-samples/commit/a6907c5dc236e9c18f062c44453b1c15359962cf#commitcomment-51521777 ---------- So, after this huge text, I have 2 questions 😬 1. Will Compose Semantics Test or Test libraries have something similar to Espresso
    AccessibilityChecks.enable()
    ? 2. How can I check colors, images and other components properties like Modifiers/borders? These are not visible with SemanticsNode using Jetpack Compose tests. a. Right now I’m having to check with Snapshots (then some workarounds on top of Snapshot to work across different APIs)
    🧵 4
    z
    p
    j
    • 4
    • 23
  • m

    myanmarking

    09/28/2021, 11:19 AM
    is it possible to set text to always occupy at least 2 lines ?
    j
    t
    +2
    • 5
    • 8
  • j

    julioromano

    09/28/2021, 11:44 AM
    Is there a ready to use Composable to draw line separators between list items? Or should we just use a Box with a very small height?
    ✅ 1
    p
    • 2
    • 6
  • n

    Napa Ram

    09/28/2021, 12:11 PM
    Is there any example on coordinator pattern in navigation compose
    l
    • 2
    • 5
  • m

    myanmarking

    09/28/2021, 1:47 PM
    is there any variation of LaunchedEffect(boolean) that will only run when it is true?. Using a boolean works, but then the scope is restarted in true -> false. I have nothing to do on false so it seems quite a waste
    a
    z
    • 3
    • 12
  • j

    Job Guldemeester

    09/28/2021, 1:54 PM
    We created a custom shape for a slideOver composable. When using the
    Modifier.clip
    the composable is shaped correctly but the inner content of the composable disappears in one of the screens where we use the composable. Could it be that composable interferes with the 
    Modifier.graphicsLayer
     used in other screens?
    👀 1
    f
    d
    • 3
    • 5
  • m

    mattinger

    09/28/2021, 1:55 PM
    Has anyone else used the accompanist animated navigation? I have the following (along with a rememberAnimatedNavController)
    AnimatedNavHost(
        navController = navController,
        startDestination = router.currentStep.id,
        exitTransition = { _, _ ->
            slideOutOfContainer(
                AnimatedContentScope.SlideDirection.Left,
                animationSpec = tween(700)
            )
        },
        enterTransition = { _, _ ->
            slideIntoContainer(
                AnimatedContentScope.SlideDirection.Left,
                animationSpec = tween(700)
            )
        })
    However, not a single one of my transitions is animated. It all still seems to just pop in and out like it would with the standard NavHost. (as a side note, i’ve tried putting animation specs in the composable function as well for the individual routes with no luck.
    i
    • 2
    • 9
  • m

    myanmarking

    09/28/2021, 2:08 PM
    is there any standard practice for conditional modifiers inside a composable? Something like this:
    modifier.run { 
        if(featureA){
            modifierX()
        } else{
            this
        }
    }
    m
    j
    +4
    • 7
    • 13
  • s

    ste

    09/28/2021, 4:51 PM
    My app needs to spawn a long-living process (that follows the app lifetime) and it has to communicate with it using stdin/stdout/stderr. I wanted to go full-compose, but it seems that it's still not possible to
    rememberSaveable
    a
    Parcelable
    (I need it to encapsulate the
    Process
    object); should I just declare an
    object
    at this point?
    c
    • 2
    • 3
  • m

    myanmarking

    09/28/2021, 5:29 PM
    navigating back and forth between two composable fragments sometimes cause a ‘lag’ navigating back and i narrowed it down to this composable:
    Image(
        modifier = Modifier
            .fillMaxSize(),
        painter = painterResource(id = state.itemList[page].imageRes),
        contentDescription = null,
        contentScale = ContentScale.Crop
    )
    This is loading a webp image. Maybe it is related to the image size. But most of the times it has no lag. What could it be ?
    z
    a
    • 3
    • 9
  • k

    Kirill Langer

    09/28/2021, 6:36 PM
    Hi, I'm trying to make a dashboard like in the attached image. Nothing really needs to be scrollable aside from the main display. However, I keep getting this error:
    Nesting scrollable in the same direction layouts like LazyColumn and Column(Modifier.verticalScroll()) is not allowed. If you want to add a header before the list of items please take a look on LazyColumn component which has a DSL api which allows to first add a header via item() function and then the list of items via items()
    Anyone have an idea for how I can add the grid pressure display inside a column of rows that arranges the displays?
    r
    l
    • 3
    • 4
  • j

    Jason Roberts

    09/29/2021, 5:39 AM
    Hi. Can we use Java or Kotlin libraries (libraries that use XML to design) in the Android JetpackCompose project? And how can we do it?
    c
    • 2
    • 1
  • j

    Job Guldemeester

    09/29/2021, 7:49 AM
    I have some issues using the
    Modifier.clip
    to apply a custom shape when there is an
    Image
    composable + bitmap somewhere in the view (separated from the shape). The clipped shape disappears when the bitmap reaches a certain size or multiple bitmaps in the view reach a certain combined size. Though the limits can differ on different devices.
    d
    a
    • 3
    • 6
  • d

    Daniel Oliveira

    09/29/2021, 10:17 AM
    Hi everyone, Is it possible to use SavedStateHandle in ViewModel with navigation compose?
    👍 1
    n
    • 2
    • 1
  • j

    julioromano

    09/29/2021, 10:55 AM
    Is there a way to “disable” (as in “grey out and don’t allow interaction with”) an entire UI subtree? I was thinking via a modifier at the root of the subtree or a CompositionLocal but I’m not aware of any.
    w
    • 2
    • 1
  • j

    jossiwolf

    09/29/2021, 11:28 AM
    Has anybody here seen an open-source example of using Compose to drive a non-UI tree?
    f
    z
    • 3
    • 5
  • m

    myanmarking

    09/29/2021, 11:32 AM
    is it possible to identify if a composable fun is running on preview or device ? some code need fake config for preview only
    j
    n
    • 3
    • 5
  • m

    myanmarking

    09/29/2021, 11:39 AM
    bold xml tags on strings are not supported yet for text, are they:
    <b>
    ?
    j
    z
    • 3
    • 4
  • a

    AmrJyniat

    09/29/2021, 12:11 PM
    How I can trigger a piece of code only in the initial composition inside a function?
    d
    f
    z
    • 4
    • 11
  • t

    Tolriq

    09/29/2021, 12:42 PM
    I have a strange click through issue when clicks are sent to the view under the visible one see code in thread. Are there known issue like that?
    z
    • 2
    • 6
  • f

    Felix Schütz

    09/29/2021, 12:55 PM
    Any opinions on https://github.com/google/accompanist/issues/729 (offering the possibility for animated navigation transitions with a single
    NavHost
    )? Should I report an issue on the Google Issue Tracker instead?
    i
    j
    • 3
    • 8
  • m

    myanmarking

    09/29/2021, 1:25 PM
    if i were to make my own textinputlayout component, what base textfield component would i use? I don’t need error, border, etc
    l
    • 2
    • 1
  • k

    kenkyee

    09/29/2021, 1:48 PM
    Can someone point me at an example of infinite scrolling a LazyColumn that doesn't use the paging library? (more of what I've tried in the thread)
    n
    • 2
    • 8
  • m

    myanmarking

    09/29/2021, 2:25 PM
    do modifiers apply full recomposition of the composable they belong to? For instance, imagine a modifier with a border, with a mutableState as color ?
    z
    c
    • 3
    • 11
  • s

    ste

    09/29/2021, 3:54 PM
    Is there an easy (and inexpensive, effortless) way to draw row elements from the last one? My
    ReverseRow
    code in thread
    c
    • 2
    • 5
  • w

    Waqas Tahir

    09/29/2021, 5:04 PM
    I want to create a compose multiplatform library I've created a multiplatform library by going into multiplatform->library in project creation dialog But I don't know how to add compose to it I also don't know how this library can be tested in the same project like this is a library project there's no separate app module in it like it is in the Android Studio , it only contains modules of libraries , where do it write "app" specific code
    h
    • 2
    • 5
Powered by Linen
Title
w

Waqas Tahir

09/29/2021, 5:04 PM
I want to create a compose multiplatform library I've created a multiplatform library by going into multiplatform->library in project creation dialog But I don't know how to add compose to it I also don't know how this library can be tested in the same project like this is a library project there's no separate app module in it like it is in the Android Studio , it only contains modules of libraries , where do it write "app" specific code
add compose plugin from org.jetbrains.compose
h

hfhbd

09/29/2021, 5:12 PM
1. There is no native support for Compose 2. Only
runtime
is shared with all targets.
w

Waqas Tahir

09/29/2021, 5:24 PM
so how can I build a library that's multiplatform compose
let's say I remove native from facets , I only want to target compose supported platforms
I am getting this error when I try to remove native facet
View count: 9