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

    Chachako

    04/24/2022, 9:52 AM
    Hi everyone, any news about the shared element? This plan seems to have been waiting for a long time 😢
    r
    • 2
    • 2
  • m

    Mehdi Haghgoo

    04/24/2022, 10:17 AM
    To all dear Android developers out there. Sorry not 100% Compose question, but I need it alot when debugging Compose code. Is there a way to add a shortcut to USB/Wireless Debugging to the top area t make it more accessible and keep me from going to About->Dev. Options -> etc. all the time?
    p
    c
    • 3
    • 4
  • c

    Cyril Kym

    04/24/2022, 12:24 PM
    Hi Everybody, I'm currently working on a custom input composable for an app. The goal is to display a map of Switzerland and it's cantons ("same thing as states in the US"). I then want to be able to recognize the user tapping on one of the cantons. My current approach is to convert an SVG of Switzerland with the Cantons as paths to a list of points with coordinates (using https://spotify.github.io/coordinator/). I then draw these coordinates to a canvas using drawPath(). I'm currently not sure if this is the most effective approach, therefore I'd like to ask for your feedback. Also I'm not sure how I will be able to recognize the touch of a canton with my approach. I was planning on drawing each canton as it's own path, but I don't think compose provides an event listener for the tap on a path (or am I wrong?). So I think I would need to get the coordinates of a tap and then match them to the correct canton.
    👀 1
    m
    • 2
    • 1
  • y

    Yacov Rosenberg

    04/24/2022, 7:10 PM
    Hey guys, how can I make the keyboard dont hide a text that I have under my textField?
    m
    • 2
    • 2
  • w

    wintersoldier

    04/24/2022, 7:57 PM
    I was trying to build DropDown in compose , I was able to build it , but the only problem is I want to show the content of DropDown below the TextField, The dropdown is behaving like a dialog , What I wanted to achieve is showing the content below the TextField, did anyone has some workaround.
    • 1
    • 2
  • a

    Ayfri

    04/24/2022, 8:41 PM
    Any update on Compose for Kotlin 1.6.21 ?
    e
    • 2
    • 1
  • p

    Paul Woitaschek

    04/24/2022, 9:44 PM
    Is there any way to make a card long-clickable while maintaining proper ripples? If I use pointerInput or combinedClickable as the modifier instead of the onClick lambda, I either lose the ripple effect or have it not being clipped to the card rounding.
    ➕ 1
    l
    • 2
    • 6
  • j

    james

    04/25/2022, 1:46 AM
    to any Googlers awake at the moment: when filing a bug, should my reproduce project just be a zip file or is a git repo fine?
    j
    s
    • 3
    • 4
  • l

    Lilly

    04/25/2022, 2:03 AM
    I'm playing around with accompanists
    FlowRow
    and try to place 2 equal items per row. Applying
    fillMaxWidth(0.5f)
    to every item ensures it occupies half of the max width but unfortunately it does not consider the
    mainAxisSpacing
    of 4.dp. When I apply the
    mainAxisSpacing
    only 1 item is placed per row because the 0.5f does not consider the 4.dp. Any ideas how to handle this properly? Btw. I'm aware that a
    LazyVerticalGrid
    would fit better here. I'm playing around with some layouts for the learning effect.
    FlowRow(
    	modifier = Modifier
    		.fillMaxWidth()
    		.border(1.dp, Color.Red),
    	mainAxisSize = SizeMode.Expand,
    	//mainAxisSpacing = 4.dp,
    	crossAxisSpacing = 4.dp,
    ) {
    	actions.forEachIndexed { i, action ->
    		FlowItem(
    			modifier = Modifier.fillMaxWidth(0.5f),
    			title = stringResource(id = action.titleRes),
    			description = stringResource(id = action.descriptionRes),
    			backgroundColor = if (i % 2 == 0) LightGreen600 else LightGreenLight600,
    			onItemClick = onAction
    		)
    	}
    }
    a
    • 2
    • 4
  • c

    Colton Idle

    04/25/2022, 4:27 AM
    More of a discussion/question for folks that have used Google Maps Compose Library. I'm starting on a new project, and we're going to be 100% compose, but a big feature of our project is a map view. I've never worked with maps before, and I'm curious to hear if anyone has used it before and found any issues or any missing apis. Or is it pretty much a 1:1 drop in replacement for the view-based google maps library?
    f
    n
    • 3
    • 15
  • t

    the great warrior

    04/25/2022, 10:33 AM
    when closing the keyboard I want TextField to lose focus, how can I do that?
    r
    • 2
    • 2
  • m

    Mike

    04/25/2022, 2:11 PM
    Is there a “more correct” approach out of these two when it comes to loading resources in ui state classes?
    d
    m
    • 3
    • 3
  • c

    Chachako

    04/25/2022, 3:10 PM
    I’m confused as to why Compose’s dialog popup uses declarative to complicate things. Creating a dialog just by imperative like Flutter is great, for scenarios with lots of dialogs I would need to maintain a bunch of states to handle it which sometimes usually makes things messy, another good way might be to handle it by MVI but that’s not the best either, I even created an imperative dialog to solve this problem. Is there any reason to create a dialog by declarative instead of imperative? 😢
    a
    a
    c
    • 4
    • 6
  • d

    dimsuz

    04/25/2022, 3:33 PM
    Is there a way to simulate Multiple Context receivers without this feature enabled? 🙂 I want to write a modifier working with align from ColumnScope...
    internal fun Modifier.bottomOverlayPadding(): Modifier {
      return Modifier
        .align(Alignment.End) // can't use, need ColumnScope
    }
    o
    • 2
    • 2
  • v

    Vikas Singh

    04/25/2022, 3:52 PM
    Do we have something like animator set in compose?
    t
    • 2
    • 1
  • c

    Chris Fillmore

    04/25/2022, 4:36 PM
    Hi folks. Re: keeping the screen on, with
    FLAG_KEEP_SCREEN_ON
    , is this answer the go-to way? https://stackoverflow.com/questions/69039723/is-there-a-jetpack-compose-equivalent-for-androidkeepscreenon-to-keep-screen-al It looks good to me, but I’m curious if Compose offers something out of the box. Thanks!
    • 1
    • 1
  • n

    nuhkoca

    04/25/2022, 9:59 PM
    Hello, how can I apply a shadow with a bottom elevation only? Seems
    shadow
    function applies elevation for all edges
    ✅ 1
    k
    o
    • 3
    • 11
  • j

    jefbit

    04/25/2022, 10:32 PM
    Does have any good information on how to handle passing data back to a composable from a bottomSheet that lives in Accompanist ModalBottomSheetLayout? ex: I have a composable that interacts with a bottomSheet and would like to send data back to the composable to filter a list. I know you can pass an argument through the navcontroller navigation, but I am wondering if there is a better way (possibly share a viewmodel?) Thank you.
    i
    • 2
    • 1
  • a

    Ahmed Shehata

    04/25/2022, 10:48 PM
    #compose #viewmodels Hi everyone Anyone have an idea about working with navigation compose with view models that have been created and cleared automatically within the composable scope and organise the code without any boilerplate? I 'm trying to migrate from normal navigation component to the new navigation compose and I'm facing these problems
    i
    • 2
    • 4
  • t

    Tash

    04/25/2022, 10:56 PM
    Hi all! Our team is on the verge of approving Compose usage for the whole team. Since ours is a large app with many layers of legacy View-based code, we will most likely stay a Compose/View hybrid for a long time. But some of the team is hesitant to do so. They are mostly concerned about the “two stack problem” described in this article:
    …running both Compose and View rendering within a single user session was very memory intensive, especially on lower-end devices. This cropped up both during rollouts of the code on the same page, but also when two different pages (for example, the Play Store home page and the search results page) were each on a different stack.
    Hoping the compose team & others can help answer these: • Have other folks experienced these performance issues? If so, what did you do to monitor/alleviate? • Does this mean that if the app is 50/50 View/Compose, this “two stack problem” will be exacerbated? • Will there come a point where we will have to “rush” to get our app to 100% Compose because of such issues? We currently have very rudimentary perf measurements in place, so open to recommendations there. 🙏🏼
    👍 1
    c
    a
    • 3
    • 11
  • a

    An Tran

    04/26/2022, 3:04 AM
    Hi team, anyone know why this url is broken at the moment?
    k
    m
    • 3
    • 3
  • j

    Jonas Frid

    04/26/2022, 7:57 AM
    Do anyone know how to provide login resource IDs to Play Console for Compose? https://stackoverflow.com/questions/71312673/provide-sign-in-credentials-to-play-console-pre-launch-report-for-jetpack-comp
    a
    • 2
    • 2
  • w

    wintersoldier

    04/26/2022, 9:09 AM
    Can someone help on this ,https://kotlinlang.slack.com/archives/CJLTWPH7S/p1650830253558289
    n
    • 2
    • 5
  • d

    dambakk

    04/26/2022, 9:31 AM
    I'm upgrading my project from stable to latest alpha of compose and getting a deprecation error on clickable card that was refactored in 1.2.0-alpha06. What should I do about the
    onClickLabel
    param? Is the semantics modifier and content description the way to go?
    l
    • 2
    • 1
  • p

    Peng Wang

    04/26/2022, 11:11 AM
    Are there any examples to understand “recomposition is optimistic” ? https://developer.android.google.cn/jetpack/compose/mental-model?authuser=0#optimistic
    s
    z
    • 3
    • 6
  • l

    Lilly

    04/26/2022, 2:39 PM
    Is this (screenshot) something I could implement with compose or should I create it as drawable? I have no idea how to make the border. Actually it's just a white border but with a pattern of red rectangles with an offset. EDIT: What I have so far. The problem: I would need a verticalGradient for bottom and top and a horizontalGradient for start and end.
    Box(
                Modifier
                    .size(256.dp)
                    .border(
                        width = 16.dp,
                        brush = Brush.horizontalGradient(
                            0.0f to Color.White, 0.8f to Color.Red,
                            startX = 0f,
                            endX = 24f,
                            tileMode = TileMode.Repeated
                        ),
                        shape = RectangleShape
                    )
            ) {
            }
    o
    • 2
    • 7
  • c

    Chris Fillmore

    04/26/2022, 3:57 PM
    Is there some different behaviour for clickable applied to a Canvas? I am having a peculiar problem: My app uses the camera and so there is a SurfaceView showing the preview. Along the bottom of the screen is a row of buttons. Two of the buttons are `IconButton`s and one is a
    Canvas(Modifier.clickable {})
    . When the device screen is tall enough that the buttons are not floating above the video, all the buttons work as expected. However, some devices have shorter screens, and the buttons float over top the video. In those cases, the IconButtons work normally, but the Canvas clickable does not receive any click events.
    • 1
    • 1
  • t

    Tolriq

    04/26/2022, 5:39 PM
    Are there any plans to have more configurable material 3 components? Like the Slider? In M3 there's so much internal / private things that copy pasting to edit is no more an option.
    k
    • 2
    • 3
  • p

    pablisco

    04/26/2022, 8:14 PM
    What do you think folk? Is this a cool way to org a Design System with Compose? 🙂 https://twitter.com/pablisc0/status/1519046447391555584?s=20&t=YzrvR4kNS1X61lYEV-O1gQ
    t
    c
    +2
    • 5
    • 12
  • t

    Tash

    04/26/2022, 9:30 PM
    Trying to update to
    1.2.0-alpha08
    and one of the
    Card
    composables that was being used earlier with
    onClick
    and
    indication
    as params is deprecated with this error:
    This API is deprecated with the introduction a newer Card function overload that accepts an onClick()
    But, the newer
    Card
    function that accepts
    onClick
    doesn’t offer a way to customize
    indication
    🤔 is there any other way to customize this?
    l
    c
    • 3
    • 6
Powered by Linen
Title
t

Tash

04/26/2022, 9:30 PM
Trying to update to
1.2.0-alpha08
and one of the
Card
composables that was being used earlier with
onClick
and
indication
as params is deprecated with this error:
This API is deprecated with the introduction a newer Card function overload that accepts an onClick()
But, the newer
Card
function that accepts
onClick
doesn’t offer a way to customize
indication
🤔 is there any other way to customize this?
l

Louis Pullen-Freilich [G]

04/26/2022, 9:35 PM
No, not without building your own
Card
- Material components are opinionated and show ripples, it’s not something that should be able to be customized on a component like this. For example, there is no way to change the indication for a
Button
-
Card
is the same here now. If you want something custom, similar to if you wanted a custom
Button
with different indication, you can fork it and make the necessary changes
t

Tash

04/26/2022, 9:51 PM
I see, thank you! As a stopgap, would it also work to attach a
Modifier.clickable
to the
Card
overload that does not have
onClick
as parameter? (Reason being, we want to move forward with the upgrade but we are blocked from creating a custom component at the moment)
l

Louis Pullen-Freilich [G]

04/26/2022, 10:06 PM
Not really, I mean it will kinda work, but the ripple and the input events won’t be clipped to the card, so if the card is not perfectly rectangular then it will go outside the boundaries of the card
👍🏼 1
:thank-you: 1
t

Tash

04/27/2022, 12:53 AM
Makes sense, thank you!
c

Colton Idle

04/27/2022, 12:57 AM
FWIW creating a "card" in compose is dead simple at least. Just a box with a few modifiers. my team was doing this first before we realized there was a card component. lol
👍 1
👍🏼 1
t

Tash

04/29/2022, 5:14 PM
I ended up creating a custom card, and yeah exactly it was so simple 🙈
➕ 1
View count: 2