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

    Vivek Sharma

    01/13/2022, 5:27 PM
    How can I have this layout like the circular box is on the top of the rectangular box but the center of circle is at the end?
    k
    c
    c
    • 4
    • 7
  • t

    Tolriq

    01/13/2022, 6:03 PM
    What's the recommended way to deal with apha on text in material 3 that will be easier to migrate later if there's an official way ?
    c
    a
    • 3
    • 32
  • m

    Mikael Alfredsson

    01/13/2022, 6:07 PM
    I have some issues with apring animations. I want to target a new random value when and one animation is finished. I do that by setting a new target in the finishedListener. When a new target is assigned, it jumps a little like it doesn’t really continues from the last target value. See code and results in the thread
    d
    • 2
    • 15
  • m

    myanmarking

    01/13/2022, 6:17 PM
    For a full compose app with multiple themes, is there any solution yet to themed vector drawables, like ( android:fillColor=“?attr/colorPrimary” ). Or we still need to define xml themes ?
    c
    a
    a
    • 4
    • 9
  • n

    Nikolas Alvelo

    01/13/2022, 6:26 PM
    Hey folks, does anyone have any information on why I might be having a crash at runtime with a ModalBottomSheetLayout only on a tablet device? readout in 🧵
    i
    • 2
    • 5
  • a

    adjpd

    01/13/2022, 8:00 PM
    Thanks to all those who've developed Glance. I've made a little updating widget with it. I enjoyed making it--a stark reversal to what I dimly recall normal widget development to be like.
    ➕ 2
    ❤️ 3
    m
    • 2
    • 1
  • m

    mattinger

    01/13/2022, 10:04 PM
    Hi All, so i’ve wrapped a RadioButton in a Row with some text. I then put the selectable modifier around that. I can now click anywhere in the row to select that radio button. However, when using the screenreader it initially announces it as i would like. But then if i swipe right, it’s individually selecting the radio button which i don’t want. Is there any way to disable that? (code in thread)
    z
    c
    +2
    • 5
    • 32
  • c

    Colton Idle

    01/13/2022, 10:50 PM
    If I have a scrollable row of cards with elevation, and I overscroll I get clipping of the elevation/shadow. Is there a way to prevent that? Bug or intended?
    k
    a
    d
    • 4
    • 6
  • m

    Manojna Chintapalli

    01/14/2022, 12:05 AM
    Hi all! I'm showing an
    Alert Dialog
    when I enter an invalid email address, as I click on Continue button the keyboard is dismissed and
    Alert Dialog
    is also displayed, but the position of the
    Alert Dialog
    starts above the center of the screen and moves to the Center as the keyboard is sliding down to be dismissed. How can I always position it to center?
    m
    • 2
    • 3
  • s

    Stylianos Gakis

    01/14/2022, 10:13 AM
    Is there any plan to allow
    @Preview
    and
    PreviewParameterProvider
    classes to be private? Right now I have for example a class which has one public composable meant to be used by other files and a bunch of private ones, but then what I really expose to the other files is this [picture attached]. Now this is polluting the auto-completion menu in a way that is very bad, as I absolutely never want to call those from other files, or call them in general to be exact.
    c
    j
    f
    • 4
    • 5
  • a

    allan.conda

    01/14/2022, 12:41 PM
    Any idea how to debug Compose being busy in UI testing context? I’m getting busy timeout failure and have no idea why.
    • 1
    • 1
  • j

    joadar

    01/14/2022, 3:17 PM
    Hey, do I need to add a rule on proguard to enable WEBP with Compose? On debug I have zero crash but on release I do:
    Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
    Here is my code: (the drawable is a .webp)
    Image(
            painter = painterResource(R.drawable.bg_video),
            contentDescription = null,
            modifier = Modifier.fillMaxSize()
        )
    v
    • 2
    • 3
  • m

    mattinger

    01/14/2022, 3:18 PM
    Does anyone know how to get the screen reader (ie. talkback) to recognize state change and re-announce something? I have an InputText field which has a validation state. It’s up to the caller how and when to validate (on button click, as you type, whatever). But when this state changes i would like that to be somehow announced.
    r
    z
    a
    • 4
    • 6
  • n

    Nikos Kermanidis

    01/14/2022, 4:08 PM
    Hello folks, I am using
    SwipeToDismiss
    within a
    LazyColumn
    and facing an issue where the nestedScroll doesn’t work.
    SwipeToDismiss
    seems to consume the scrolling event without giving the parent (
    LazyColumn
    ) a chance to consume the event. Removing the
    SwipeToDismiss
    fixes the issue. Basically the problem is described by someone else here https://stackoverflow.com/questions/70570319/swipetodismiss-nestedscroll-does-not-work-well-together-jetpack-compose For what it’s worth, I am using this gist https://gist.github.com/chrisbanes/053189c31302269656c1979edf418310 for enabling interoperability with the view system. Works fine without the
    SwipeToDismiss
    . I am trying to understand if this is a bug or I am missing anything.
    c
    • 2
    • 2
  • c

    Colton Idle

    01/14/2022, 4:10 PM
    I keep getting "This class can only be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'" when building. I see that this can be fixed with
    tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
      kotlinOptions {
        freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
      }
    }
    which I added to my root build.gradle, but I still get the warning. Should I just not care or should I just remove it completely?
    t
    a
    • 3
    • 4
  • b

    Brian Guertin

    01/14/2022, 4:37 PM
    The
    completionHandler
    for
    suspend
    functions only excepts an
    Error
    , but on the Kotlin side I want to catch a specific exception type e.g.
    MyException
    . How do I pass
    MyException
    to the
    completionHandler
    ?
    z
    • 2
    • 7
  • s

    Shakil Karim

    01/14/2022, 6:59 PM
    Is there a known issue regarding AndroidView and UI Testing using createAndroidComposeRule?. When I try to launch the test with AndroidView on a screen test runs infinitely and it is never complete, however, after removing AndroidView test runs fine.
    z
    • 2
    • 1
  • j

    james

    01/15/2022, 12:54 AM
    I'm looking for opinions on an architectural decision for a brand new project I'm starting, with probably around 20 different screens for the user to go to I need to decide between the following: 1. Single activity, many Composables 2. Single activity, one fragment per "screen", many Composables 3. Many activities, no fragments, many Composables I'm leaning toward option 3, but I'm wondering if option 3 will make it hard to have shared element transitions between different Activities? all opinions welcome 🙏
    e
    s
    +4
    • 7
    • 7
  • r

    Roudy Korkis Kanaan

    01/15/2022, 2:14 AM
    Hey everyone! First time posting but wanted to share this little project I was working on for fun to create an alternative to the nav component for compose, first time I publish anything so feel free to bombard me with suggestions and criticism 😊 I just wanted a solution that doesn't use pre-declared destinations (nav component, plus missing features like animations) and didn't require code-gen and dependency on accompanist (compose-destinations). And if this isn't the right place to share lemme know ^^ https://github.com/roudikk/compose-navigator
    👏 3
    ❤️ 1
    i
    • 2
    • 3
  • h

    henrikhorbovyi

    01/15/2022, 3:47 AM
    Hey everyone 🙂 How would you implement it with Compose? I'm trying to go custom but I'm having problems with the bar under the text
    k
    • 2
    • 3
  • s

    ste

    01/15/2022, 10:03 AM
    Hi! I'd like to know if I'm incurring an anti-pattern. Let's say I need to display the same composable (a
    TextSnackBar
    which shows a pop-up message over the screen and then disappears) over different screens. There's a
    TextSnackBarState
    that exports the method
    display(message: String)
    . I don't know which approach I should embrace: (see thread)
    • 1
    • 2
  • e

    elye

    01/15/2022, 10:57 AM
    I’m confuse the use of
    SideEffect
    . I cannot create a case of to differentiate it’s use and without it’s use as per https://stackoverflow.com/questions/70720751/whats-the-different-using-sideeffect-and-not-using-it-in-jetpackcompose. Can someone enlighten? Thank you 🙏
    b
    f
    +2
    • 5
    • 21
  • r

    Ruben Quadros

    01/15/2022, 2:04 PM
    Hi guys, how can I add
    stickyHeader
    in
    LazyVerticalGrid
    ?
    f
    c
    • 3
    • 2
  • a

    Arkadii Ivanov

    01/15/2022, 10:01 PM
    Is it safe to publish a library which depends Compose (foundation, etc.) and Compose compiler of different versions? E.g. Compose
    1.0.5
    and compiler
    1.1.0-rc02
    . I want to finally update Kotlin to 1.6.10. Wondering if there any compatibility concerns I should be aware of.
    y
    a
    • 3
    • 3
  • r

    Roudy Korkis Kanaan

    01/16/2022, 6:54 AM
    What would be a good way to determine the final position of an element that is mid transition? I'm working on shared elements for my lib and currently this is the only thing that's missing. If you have 2 screens being animated, the shared transition element needs to animate between the initial pos from first screen (which is fine) but the final pos of the element of the 2nd screen which keeps changing (using
    onGloballyPositioned
    and I can denounce by a bit till it stops changing but that will delay the transition animation of the shared element itself which is not the expected behaviour. So basically is there a way to know if the position of a composable is not final and what would be its final position or would I have to know the transition and based on the animation properties calculate the final position of the element? Or am I going the wrong direction anyway haha
    z
    • 2
    • 2
  • m

    Michael Paus

    01/16/2022, 2:54 PM
    Latest Skia on Android? According to recent activities in the Skiko project (https://github.com/JetBrains/skiko/pull/451) I am wondering whether Jetbrains is planning to bundle the Skia library with all platforms which are supported by Compose. Am I just dreaming or would that mean that we could finally have the same native canvas based on Skia on all platforms including Android? One Graphics API, with all the latest features, to rule them all even on older devices? This would really solve a problem which I had recently. Keeping my fingers and toes crossed that this is not just a misinterpretation or a day dream 😆
    a
    d
    +2
    • 5
    • 9
  • d

    dimsuz

    01/16/2022, 5:51 PM
    I suspect this has been asked, not finding right away. If I have
    Column
      Row { Text(); Text() }
      Row { Text(); Text() }
    can I somehow make it so that it renders like this:
    text1:       hello
    text2longer: world
    especially if
    Row
    is some component defined in the different file. I tried to read about alignment lines, but can't see how they could help achieve this here.
    f
    c
    • 3
    • 13
  • h

    Hussein Muhammad

    01/16/2022, 8:33 PM
    I want to implement Map in compose. Can anyone help me? How to implement it with LocationService.
    a
    e
    +2
    • 5
    • 6
  • r

    Rick Regan

    01/16/2022, 10:26 PM
    If I swipe a
    Button
    (Material 2 or 3) I get a ripple but no
    onClick
    -- is that working as designed? (Unfortunately, button presses from my thumb when working one-handed tend to be swipes. )
    z
    a
    • 3
    • 4
  • f

    Florian Walther (live streaming)

    01/17/2022, 11:22 AM
    How can I let a composable execute a one-off event? This composable contains and
    AndroidView
    which needs to call a method.
    m
    z
    • 3
    • 20
Powered by Linen
Title
f

Florian Walther (live streaming)

01/17/2022, 11:22 AM
How can I let a composable execute a one-off event? This composable contains and
AndroidView
which needs to call a method.
m

myanmarking

01/17/2022, 11:57 AM
LaunchedEffect(Unit) ?
f

Florian Walther (live streaming)

01/17/2022, 12:08 PM
For this i would have to pass the event Flow all the way down to the composable
is that correct?
m

myanmarking

01/17/2022, 12:11 PM
Since you are interested in the first composition, i don’t think it matters, unless you have some control variables like if(condition) composable()
place it as close as possible. i’m not sure the best practice here
z

Zoltan Demant

01/17/2022, 12:13 PM
If youre looking to call a method on the
AndroidView
itself, the factory call for it might be viable for that?
m

myanmarking

01/17/2022, 12:14 PM
Or maybe add the effect inside the composable, call a lambda, and do the action outside. Maybe the best practice i dont know 😛
f

Florian Walther (live streaming)

01/17/2022, 12:26 PM
@Zoltan Demant the problem is that I need it to happen one time, but compose usually works with state variables
I was considering passing an
updateThisThing = true
boolean and a callback to reset it
z

Zoltan Demant

01/17/2022, 12:35 PM
The factory function is only invoked once, but if your composable leaves & re-enters the composition it will get called again; is that the problem?
f

Florian Walther (live streaming)

01/17/2022, 12:36 PM
the viewmodel sends a one-off event (via a Flow) that the AndroidView nees to react to by calling a method
z

Zoltan Demant

01/17/2022, 12:41 PM
In that case I like what @myanmarking mentioned above, just using
LaunchedEffect(Unit)
to collect the flow & call the method. I think that makes for the best/cleanest code too, as compared to sending in a boolean & a callback to reset it!
f

Florian Walther (live streaming)

01/17/2022, 12:46 PM
But for this i would have to pass the event Flow all the way down to that composable
z

Zoltan Demant

01/17/2022, 12:51 PM
If you have a lot of nesting, it could be worth looking into using a
CompositionLocal
that contains the flow or some wrapper. How deep is this composable for you?
f

Florian Walther (live streaming)

01/17/2022, 12:53 PM
3 levels or so
i just noticed that I can't even call from the LaunchedEffect into the
AndroidView
So I guess my first idea of passing a boolean and a callback could be the way to go. But I am not sure
The other problem is that
update
can be called multiple times. This probably makes it not suitable for side-effects like this.
so I ended up passing the boolean & callback
seems to work
🥲 1
View count: 4