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

    Tgo1014

    04/29/2022, 2:13 PM
    Is there already a way to scope view models by composable?
    a
    j
    • 3
    • 15
  • d

    dimsuz

    04/29/2022, 2:52 PM
    I'm getting a very weird exception in a custom
    Layout
    check(measureables.size == 3) { "layout algorithm relies on 3 items in layout" }
    val placeables = measureables.map { it.measure(constrains) }
    layout(width, height) {
      val topPlaceable = placeables[0]
      val zoomPlaceable = placeables[1]
      // VVVV crashes on the line below with 
      //   IndexOutOfBounds(index=10, size=3)
      val locationPlaceable = placeables[2]
    }
    Index out of bound with index
    10
    (sometimes
    12
    ) which isn't anywhere in my code. Can this be due to some compose compiler plugin magic? 🤔
    👀 1
    a
    • 2
    • 2
  • n

    nitrog42

    04/29/2022, 3:39 PM
    Today, I tried to test some code, and of course I regret it now 🙃. I'm struggling to understand what's the best way to remove
    delay()
    in a LaunchedEffect code in reply
    z
    • 2
    • 8
  • m

    mattinger

    04/29/2022, 3:51 PM
    Does anyone know how i can get a piece of code to trigger if the user goes to the notification shade, and then comes back to the application? It doesn’t look like the composable on screen goes through any sort of recomposition, so I can’t necessarily figure out when to trigger the code. My screen is a roadblock to have the user turn on the bluetooth service when it’s off. I want to check when they come back to the shade whether it’s been turned on or not.
    c
    m
    z
    • 4
    • 3
  • r

    rook

    04/29/2022, 3:59 PM
    I’m creating a composable that has clickable subcomponents. I want the root composable’s indicator to respond to the subcomponents’ interactions. This is what I have so far.
    file.kt
    l
    • 2
    • 10
  • c

    Chris Fillmore

    04/29/2022, 4:43 PM
    If I have a
    BackHandler
    and an
    AlertDialog
    , the BackHandler is not invoked on Back press. Is that expected?
    i
    • 2
    • 2
  • j

    Jan

    04/29/2022, 4:45 PM
    I don't know how to describe my problem, but I try it: When my App opens, it checks for a new version and if there's no new version it continues with the main app which also gets some data from an api. Now this should be a pretty easy task and the things being downloaded are very small. But sometimes with my wifi (and worse with only mobile data). My app takes very long to load. I don't know whats causing this. I mean the rendering is independent of the network thing it should give me something but its just a white screen
    k
    • 2
    • 9
  • s

    Shakil Karim

    04/30/2022, 11:51 AM
    Is Navigation-Compose support screen transition?
    i
    • 2
    • 3
  • h

    humblehacker

    04/30/2022, 2:12 PM
    When using
    enableComposeCompilerMetrics
    , what does
    runtime
    mean? I didn't see it mentioned in the documentation I've read, only
    stable
    and
    unstable
    . For example:
    runtime class State {
      stable val text: String
      runtime var CREATOR: Creator<State>
      <runtime stability> = Uncertain(Creator)
    }
    That's for this class declaration:
    data class State(
        val text: String = "",
    ) : Parcelable {
        companion object
    }
    • 1
    • 2
  • s

    S.

    05/01/2022, 12:31 AM
    I'm aware that Materials textfields are somewhat large but this looks like I've enabled retiree mode somehow
    😂 2
    c
    c
    a
    • 4
    • 24
  • s

    star_zero

    05/01/2022, 2:23 AM
    How can I do if BottomNavigation has a common screen? • tab1: ScreenA -> ScreenB -> ScreenCommon • tab2: ScreenC -> ScreenD -> ScreenCommon
    i
    • 2
    • 5
  • r

    rkeazor

    05/01/2022, 4:52 PM
    Can compose work with kotlin 1.6.21 ?
    j
    c
    • 3
    • 5
  • a

    andrew

    05/02/2022, 1:55 AM
    Can a custom applier run a compose node factory asynchronously? I’m asking because I want to write a custom one for Filament, but some of it may depend on resource loading. Or, would it be best to load x resource first, then run the compose node once readied?
    j
    • 2
    • 6
  • w

    wintersoldier

    05/02/2022, 8:42 AM
    Hi , What is the alternative of ScrollBar in compose. I have already tried Modifier.verticalScroll . Wanted to understand is there a way to acheive scrollview
    d
    • 2
    • 9
  • c

    Chachako

    05/02/2022, 10:39 AM
    Is there any API to manually ask a component to recompose? It’s
    drawWithContent
    f
    • 2
    • 5
  • o

    Oleksandr Balan

    05/02/2022, 10:48 AM
    Can I “ignore” some events based on position in
    pointerInput
    so the events are passed to underlying components? See image in 🧵
    t
    • 2
    • 6
  • t

    Tgo1014

    05/02/2022, 1:55 PM
    What’s the best way to avoid clicking two items at the same time and navigating to both at once with compose navigation?
    🤔 1
    f
    • 2
    • 5
  • v

    Vinay Gaba

    05/02/2022, 3:24 PM
    Just published an article explaining a productivity hack that will save you tens of engineering hours when working with Jetpack Compose - https://www.jetpackcompose.app/articles/productivity-hack-to-save-tens-of-engineering-hours-when-working-with-Jetpack-Compose
    🤨 1
    🎉 11
    👌 3
    d
    • 2
    • 1
  • t

    Tolga ÇAĞLAYAN

    05/02/2022, 5:38 PM
    Hello to everyone. I am making a barcode reader with Jetpack compose and zxing library. I just want to have the rectangle area analyzed. Anyone have an idea about this?
    a
    s
    • 3
    • 10
  • d

    Daniel Okanin

    05/02/2022, 5:59 PM
    Hi everyone , I have a question about @Stable annotation. I have the following class model with a List as a field. List considers as unstable field (check it in the compose metrics), so if I change the list content the composable functions that use this model will be recomposed again? Should I wrap the list under MutableState object? Thanks
    @Stable
    class PhotoViewModelItem(
        val id: String?,
        val title: String?,
        val savedGalleries: List<String>?,
    )
    a
    • 2
    • 4
  • c

    Chachako

    05/02/2022, 8:18 PM
    I am implementing a low version of the real-time blur effect and it works well in most cases? But currently, I’m having problems with the coordinates on the
    Pager
    , as shown in the video, when a page is moved to the edge of the screen the image cuts out, after troubleshooting this seems to be caused by
    onGloballyPositioned
    returning the coordinates of a second pager...
    device-2022-05-03-040728.mp4
    😯 1
    👏 1
    a
    c
    • 3
    • 17
  • n

    nuhkoca

    05/02/2022, 9:39 PM
    Is it possible to animate LazyList items based on a condition? Let’s say I only want to animate items if selected sorting is
    Price
    but not
    Name
    ? Now I am getting crash because key cannot be identical if I pass empty string if selected sorting is Name~
    c
    • 2
    • 3
  • j

    Jitendra

    05/03/2022, 3:15 AM
    I am using mapbox Library in my jet pack project, I need use Fragment provided by this library, I tried but no luck , is there any way to use Fragment in jet pack compose
    c
    • 2
    • 1
  • i

    ildar.i [Android]

    05/03/2022, 7:05 AM
    Hello, we have a state object
    CommonInput
    in viewModel, which gets posted to StateFlow and then converted into a
    @Composable fun CommonInputDisplay
    in our Composable screen.
    CommonInput
    has a
    value
    param that gets converted to
    MutableState
    and used in
    TextField
    as
    value
    . The problem is that once it has initialized, we can’t change
    TextField
    value
    by modifying state object from ViewModel anymore. How can we initiate a recomposition with a new value from viewModel by modifying
    CommonInput
    ?
    Untitled.cpp
    f
    y
    • 3
    • 15
  • g

    gpaligot

    05/03/2022, 7:54 AM
    Hello here! I'm working on the dropdown for my design system with jetpack compose but I don't have an elevation when I test it with Android API 22 but it works perfectly with recent versions. Any ideas why? 🤔
    c
    c
    n
    • 4
    • 8
  • d

    dimsuz

    05/03/2022, 1:34 PM
    I'm trying to do custom layout inside a Button and it seems I lack some insight into a layout procedure.
    Button(
      modifier = Modifier.widthIn(min = 365.dp), 
      onClick = {}
    ) {
      Layout({ Text("hello") }) { measureables, constraints ->
        println("$constraints")
      }
    }
    I thought that incoming
    constraints
    would have minWidth set to
    365.dp
    , but they are actually
    minWidth=0, maxWidth=636.dp
    which comes from
    Button
    parent. What is the correct way to layout button's content with respect to imposed min size on the button?
    l
    z
    • 3
    • 10
  • f

    Filip Wiesner

    05/03/2022, 2:00 PM
    Quick question as a sanity check: Is it true that when using View(XML)-based navigation components, the multi-backstack navigation and state saving is enabled by default but when implementing navigation via compose, we need to specify it ourselves like in this example.
    i
    • 2
    • 9
  • r

    rook

    05/03/2022, 2:39 PM
    Is there a way for me to precisely identify what state change is triggering recomposition? I’m experiencing x3 recompositions for what I’m perceiving as a single state change, and I want to try to track down what states are instigating each composition.
    r
    • 2
    • 2
  • n

    natario1

    05/03/2022, 3:52 PM
    Trying to debug this crash where none of my files are in the stacktrace (see thread)… The only hint is the presence
    androidx.compose.ui.platform.AndroidUiDispatcher
    . Does this maybe mean that the crash happens in a compose effect? Or any other implication that could help debugging?
    r
    r
    • 3
    • 6
  • m

    mcpiroman

    05/03/2022, 4:58 PM
    `@Suppress("INVISIBLE_MEMBER")`is my new friend when working with compose (allows to use `internal`declarations in different module).
    ☝️ 2
    t
    z
    • 3
    • 5
Powered by Linen
Title
m

mcpiroman

05/03/2022, 4:58 PM
`@Suppress("INVISIBLE_MEMBER")`is my new friend when working with compose (allows to use `internal`declarations in different module).
☝️ 2
t

Thomas

05/04/2022, 10:43 PM
Wow this is amazing, thanks for sharing. Really helpful for material3.
z

Zach Klippenstein (he/him) [MOD]

05/10/2022, 3:01 PM
What internal declarations are you using? This seems dangerous
t

Thomas

05/10/2022, 3:55 PM
I am using it a lot now to copy material3 classes into my project to make fixes or modifications. With this annotation I don’t need to copy as much as without it (for example all of the token classes). It is really helpful. Hopefully in the future the token classes are made public as currently it does not allow for customisations.
z

Zach Klippenstein (he/him) [MOD]

05/13/2022, 2:51 PM
Have you filed a bug/feature request? Would be a good signal to the material3 team that the current APIs aren’t enough.
t

Thomas

05/13/2022, 2:53 PM
It was already reported by someone else, no response so far if this could be changed: https://issuetracker.google.com/issues/218092223
View count: 9