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

    Eko Prasetyo

    05/15/2022, 2:10 PM
    Hi everyone. I want to build authentication system for my app, and still a bit confuse on how to handle the flow. I always implement the A flow before, but the problem is I always see my Login Screen first, even it is only a glimpse. Which do you prefer between these flows? Is doing the B approach even possible?
    t
    c
    z
    • 4
    • 14
  • m

    Mjahangiry75

    05/15/2022, 5:32 PM
    Quick question: What is
    @ReadOnlyComposable
    ?
    h
    z
    +2
    • 5
    • 5
  • e

    eygraber

    05/15/2022, 11:36 PM
    https://developer.android.com/reference/kotlin/androidx/compose/runtime/snapshots/SnapshotApplyResult says that
    The result of a applying a mutable snapshot. Success indicates that the snapshot was successfully applied and is not visible as the global state of the state object
    Should it say
    and is now visible as the global state of the state object
    z
    • 2
    • 3
  • x

    xxfast

    05/16/2022, 1:44 AM
    is
    animateColorBetween()
    only available in compose >1.2?
    b
    c
    • 3
    • 6
  • c

    Colton Idle

    05/16/2022, 6:10 AM
    I'm getting this lint error, but when I fix the error... it still remains. Am I misunderstanding the issue or does the lint check/lint itself have a bug?
    b
    c
    • 3
    • 8
  • i

    Iuhas Cezar

    05/16/2022, 7:49 AM
    Hi everyone, I have a weird issue with OutlinedTextField. I'm passing the initial value as a
    val textState = remember { mutableStateOf(costTextValue)}
    but the value appears to be empty. If i print the value in log it shows correctly, but in my variable it's empty.
    j
    c
    +4
    • 7
    • 13
  • в

    Виталий Перятин

    05/16/2022, 9:08 AM
    I am writing an application entirely on JetpackCompose with MultipleActivity approach. I noticed that all Activities are leaking (except for the first one). I removed all the code in the Activity (except for setContent) - they still leak when changing the configuration. I don't keep links to Activity anywhere. If you comment out
    setContent {}
    , the leaks disappear, but I can't work with Compose without this function. Can you tell me what is causing the leaks? How can they be fixed? All useful info attached to the post.
    l
    c
    p
    • 4
    • 6
  • n

    nuhkoca

    05/16/2022, 10:40 AM
    Hello, I need to check whether bottom sheet is dismissed or shown and have a code below for two cases. However, dismiss case is also triggered when user selects something and then bottom sheet closes. I don’t want my
    onSortingSheetStateChanged(SortSheetState.Dismissed)
    to be triggered for that case but only if user presses back button or touches outside. BTW is there any better way to handle these cases?
    if (sortingBottomSheetState.currentValue != ModalBottomSheetValue.Hidden) {
        DisposableEffect(Unit) {
            onSortingSheetStateChanged(SortSheetState.Shown)
            onDispose {
                onSortingSheetStateChanged(SortSheetState.Dismissed)
            }
        }
    }
    c
    • 2
    • 2
  • d

    Dragos Rachieru

    05/16/2022, 11:35 AM
    Hello, is there a way to resize a `Bitmap`/`Image` using compose? I'm creating a multiplatform image loading library that reads a
    ByteArray
    using ktor and then creates an image using
    Image.makeFromEncoded
    . I have to resize the result, but I don't know if I can do this using `compose`/`skiko`
    a
    • 2
    • 3
  • n

    ninadmg

    05/16/2022, 11:41 AM
    ```* [graphicsLayer] can be used to apply effects to content, such as scaling, rotation, opacity,
    * shadow, and clipping.
    * Prefer this version when you have layer properties backed by a
    * [androidx.compose.runtime.State] or an animated value as reading a state inside [block] will
    * only cause the layer properties update without triggering recomposition and relayout.```
    This is the documentation of graphics layer. From this it looks like i can make changes to the graphics layer without recomposing the parent composable. But how to I collect a state in the graphics layer as it is not a composable? If i collect a state in the parents then it will recompose the parent.
    f
    • 2
    • 6
  • t

    Tolriq

    05/16/2022, 2:08 PM
    Is there a way to fix Material3 surface ShadowElevation direction ? Depending on the orientation of the phone the shadow is either casted <- or ->. This does not really feels right.
    a
    c
    n
    • 4
    • 17
  • d

    Dan Peluso

    05/16/2022, 2:56 PM
    Is there something wrong with how I'm applying this button color? I want the color (white with a 10% alpha value) to be applied to the entire button, but it looks like it's layering another white 10% alpha on the text inside my button which makes it show up like this (picture in thread)
    Button(
      colors = ButtonDefaults.buttonColors(
        backgroundColor = Colors.White10 
      ),
    modifier = Modifier
       .clip(RoundedCornerShape(.5.radiusDp))
    ) { // a single text in the button with only text color declared
    k
    o
    t
    • 4
    • 10
  • r

    Roberto Leinardi

    05/16/2022, 3:52 PM
    Does anyone know if there is some open source implementation of the feature discovery/tap target for Compose?
    a
    m
    • 3
    • 3
  • a

    Abhinav Suthar

    05/16/2022, 4:31 PM
    I have created a custom HorizontalOrVertical Arrangement. Its working fine (for the most part). Assume that I put three compassables(width=30.dp each) inside a Row. So row width will be 30.dp*3 = 90.dp. But in my custom arrangement composables can overlap(eg. like, comment and share button in facebook). Assume that overlapSize is 6.dp, so that effective width of all three composables is (30-10).dp*3 = 60.dp. But the issue is row's width is still 90.dp. How can I fix it? More in thread.
    o
    • 2
    • 7
  • n

    Nat Strangerweather

    05/16/2022, 5:42 PM
    Is there an obvious way to have a LazyGrid inside a LazyColumn? I have seen some workarounds but I was wondering what the preferred way is here on Slack.
    c
    • 2
    • 8
  • t

    trevjones

    05/16/2022, 6:02 PM
    So I have a calendar built via LazyColumn and have been trying to optimize it. Made some good gains by using the metrics compiler outputs as guidance. I am down to what appears to be modifier aggregation. Is there a built in way to have the column throttle how many items it attempts to do per thread frame?
    z
    j
    • 3
    • 6
  • c

    Chris Fillmore

    05/16/2022, 6:50 PM
    I assume I’m not the only one here using Chrome Custom Tabs (whether directly or via e.g. AppAuth). So how are you handling UI state in between the time when a button is clicked, and the time when the browser opens? On observation I see that state changes aren’t propagated before the the browser opens, so if I try to, for example, respond to the click event by showing a loading spinner, the spinner doesn’t actually show up after the click. It takes a second (or fraction of) before it shows up, and then is immediately hidden by the browser.
    • 1
    • 3
  • j

    Joel Morales

    05/16/2022, 8:57 PM
    Hello, I am working on automated testing for compose layouts, after adding the necessary libraries and getting my first test working I am seeing a NoSuchMethodError that I think is related to proguard in my release build, but I am not sure so I am wondering if anyone has seen a similar issue before, posting full error description in thread
    • 1
    • 1
  • m

    Mehdi Haghgoo

    05/17/2022, 4:27 AM
    Why cannot we change the x,y coordinates of composables with modifiers?
    c
    k
    • 3
    • 10
  • r

    Rekha

    05/17/2022, 5:40 AM
    How to scroll down the screen in compose test?
    t
    • 2
    • 2
  • a

    Arjan van Wieringen

    05/17/2022, 7:01 AM
    I have a question about the ImageViewer example. In
    Main.kt
    it starts with:
    val content = remember {
            ContentState.applyContent(
                state,
                "<https://raw.githubusercontent.com/JetBrains/compose-jb/master/artwork/imageviewerrepo/fetching.list>"
            )
        }
    Content then contains a function
    isAppReady
    which is this:
    private val isAppReady = mutableStateOf(false)
        fun isAppReady(): Boolean {
            return isAppReady.value
        }
    Does Compose keep track of the nested (isAppReady) observable via the function call? I was a bit confused, because I thought I had to read the values of states directly inside a composable, but apparently I can place it behind a function as well?
    f
    • 2
    • 2
  • j

    julioromano

    05/17/2022, 8:45 AM
    Is there a way to further constrain a
    PaddingValues
    instance? E.g. say I want to apply some additional padding on top of the one passed in as the receiver in the
    Scaffold
    content lambda: how to?
    n
    n
    a
    • 4
    • 8
  • a

    Aaron Waller

    05/17/2022, 10:34 AM
    Compose docs say “`You should not pass ViewModel instances down to other composables."` Is it really that bad to do it? In my case I have a DropdownMenu in my ListItem Composable with 5 onClicks that all have to call a different method in my ViewModel. The problem now is that this ListItem ist 5 nested composables away from the viewModel reference in my “ProfileScreen” composable. So I would have to pass those 5 onClick Lambdas 5 times until it gets to the parent Composable. Do I have to get friends with this approach or is it not even that bad to pass down the viewmodel?
    f
    l
    c
    • 4
    • 5
  • l

    Lucas Mo

    05/17/2022, 12:06 PM
    Hey guys. Is there a standard (not using third party libs) way to load a Drawable instance into a Image or Icon in Compose? I need to tint the icon, btw. Thanks in advance!
    c
    • 2
    • 2
  • c

    Carl Benson

    05/17/2022, 1:27 PM
    I've skimmed through https://issuetracker.google.com/issues/192043120 to try to understand why I cannot seem to resize a compose dialog with multiple text fields. The dialog seem to force
    adjustPan
    behaviour no matter what setting I have in my manifest. Also window insets will have no effect on the content. They do seem to affect things if it is a non-dialog. Is there anyone who has seen something similar or can maybe explain what is needed to resize a compose dialog with IME paddings
    s
    • 2
    • 2
  • c

    Chris Fillmore

    05/17/2022, 2:31 PM
    What’s the right way to include the value of a StateFlow in
    derivedStateOf
    ? (In a VM)
    m
    n
    +2
    • 5
    • 19
  • a

    allan.conda

    05/17/2022, 3:27 PM
    Stuck at performance optimization, I’ve tried everything from the new docs to optimize my grid list and somehow managed to significantly improve my p50 scroll performance at full Compile. However, I’m still getting a lot of huge Janks from the profiler. Any idea what could be causing these huge recompositions and animations in a scrolling list context? I’m out of ideas 🤷
    m
    t
    +2
    • 5
    • 7
  • c

    Chris Fillmore

    05/17/2022, 5:21 PM
    I don’t think the “Multitouch: Panning, zooming, rotating” example does quite what the gif implies https://developer.android.com/jetpack/compose/gestures#multitouch
    a
    • 2
    • 7
  • l

    Lawrence

    05/17/2022, 7:57 PM
    Hello, I was told this channel would be a better fit for this question
    ✅ 1
    m
    l
    • 3
    • 3
  • m

    Mehdi Haghgoo

    05/18/2022, 7:15 AM
    Hi, what does
    with(LocalDensity.current){sizeDp.toPx()}
    really do?
    f
    • 2
    • 4
Powered by Linen
Title
m

Mehdi Haghgoo

05/18/2022, 7:15 AM
Hi, what does
with(LocalDensity.current){sizeDp.toPx()}
really do?
f

Filip Wiesner

05/18/2022, 7:18 AM
You can look at the implementation
m

Mehdi Haghgoo

05/18/2022, 7:36 AM
I know, but what is the effect of calling Dp.toPx() inside
with(){}
?
f

Filip Wiesner

05/18/2022, 7:42 AM
You can't call it otherwise. You have to be in
Density
context (
this is Density
) to access this conversion extension function. You could also do
LocalDensity.current.run { sizeDp.toPx() }
❤️ 1
It's because this extension function is defined in
Density
interface so it has two receivers (contexts). One is
Density
and one is
Dp
defined on the function
❤️ 1
View count: 11