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

    Oussama Haff.

    02/04/2021, 6:00 PM
    Hello everyone, I was checking the source code of Material Theme declaration in Compose (alpha11) I realized that the classes :
    Colors
    and
    Typography
    are annotated with different annotations
    @Stable
    for the first and
    @Immutable
    for the second. Does this mean at a higher level that The Material Theme Composable expect colors to change at a moment of time (dark/light) but not expecting a change of typography ?
    🤔 1
    f
    l
    • 3
    • 5
  • s

    Shakil Karim

    02/04/2021, 6:53 PM
    Is there any example of Animation between Screens which is Composable? Also i’m not using Compose Navigation. @Doris Liu
    n
    d
    • 3
    • 2
  • v

    Vitor Prado

    02/04/2021, 8:08 PM
    hey guys.. is there a way to send an parcelable to compose navigation via
    navigate("")
    ?
    i
    k
    s
    • 4
    • 7
  • j

    Jordi Saumell

    02/04/2021, 10:12 PM
    hey! About navigation component… I can’t use popUpTo with a String (route) in nav-alpha06/compose-alpha11. If I write popUpTo AS shows both options (the one that accepts id:Int and the one that accepts route:String… but then it only accepts the Int version. And in the NavOptionsBuilder there is only the id:Int version, which makes sense with AS not compiling with a String… How do I use popUpTo with the route?
    k
    i
    d
    • 4
    • 49
  • u

    Utkarsh Tiwari

    02/05/2021, 4:59 AM
    Is there any way to auto-place the cursor at the end of the already inputted text when the user brings the focus onto the OutLinedTextField?
    s
    • 2
    • 3
  • m

    morfly

    02/05/2021, 8:44 AM
    Hello everyone, Is it possible to perform a transition tween animation for width property which starts from a specific
    dp
    value and ends with
    fillMaxWidth
    ? For example:
    val width = DpPropKey("width")
    
    val transitionDefinition = transitionDefinition<ButtonState> {
        state(ButtonState.COLLAPSED) {
            this[width] = 60.dp
        }
        state(ButtonState.EXPANDED) {
            this[width] = ??? // how can I represent a `fillMaxWidth` value here?
        }
    }
    Thanks!
    a
    • 2
    • 2
  • k

    Kensuke Sano

    02/05/2021, 10:47 AM
    Is there a Grid component that is not Lazy(not scrollable)? I found this one but it can’t set Gird Gap. https://github.com/android/compose-samples/blob/2cff65334ea023956a58f215a13b6a55c7[…]ck/app/src/main/java/com/example/jetsnack/ui/components/Grid.kt
    a
    • 2
    • 1
  • l

    loloof64

    02/05/2021, 12:39 PM
    Hi all ! Sorry for this long example just in order to explain my main trouble : • I've drawn a checker board with some coins • We can drag a coin to an empty cell • If trying to drag a coin on another coin, then there should be a back animation. Unfortunately, the back animation is not thrown and the coin goes back immediately
    Checker coin animation
    d
    • 2
    • 10
  • l

    loloof64

    02/05/2021, 1:29 PM
    Is a
    androidx.compose.animation.core.Transition
    cheap or expensive to create ? I mean, is it safe to create an array of
    Transition
    ? I mean a 64 cells array
    d
    • 2
    • 2
  • z

    Zach Klippenstein (he/him) [MOD]

    02/05/2021, 4:07 PM
    Is it possible to write a Compose UI test that creates some composable UI, then removes it, and assert that the Composable UI isn’t there using the
    AndroidComposeTestRule
    assertions? Example in thread.
    • 1
    • 4
  • j

    julioromano

    02/05/2021, 4:37 PM
    On the debouncing of text fields I have a
    BasicTextField
    whose
    onValueChange
    does two things: 1. Feeds `onValueChange`’s value back to the
    BasicTextField
    to display what the user has typed. 2. Triggers an HTTP search call to fetch updated data to be displayed. I’d like to debounce 2. but not 1. but: since the
    onValueChange
    is a single callback I see no “easy” way to do it. Were I to debounce the whole
    onValueChange
    callback, the user will notice a lag with the on screen feedback too. I believe this is a pretty common use case so I’m wondering if there’s a compose friendly pattern to handle this or if something ad-hoc must be concocted.
    👍 1
    z
    s
    • 3
    • 7
  • d

    Devesh Sanghvi

    02/05/2021, 7:12 PM
    Hi all, I have a
    ScrollableRow
    with list of composable. Is there any state within compose that I can use to know if that view has been brought to Foreground (basically I want to know onResume() has been called)? Based on that I can scroll the list to the start.
    z
    • 2
    • 1
  • s

    Shakil Karim

    02/05/2021, 7:13 PM
    @Siyamed Is there any way i can know when keyboard is Visible when using BasicTextField ?
    j
    s
    +2
    • 5
    • 7
  • t

    Tash

    02/05/2021, 9:38 PM
    I apologize if this has already been asked; has anyone used Compose without an Arch Component
    ViewModel
    to cache state across configuration changes?
    a
    j
    m
    • 4
    • 9
  • m

    Mehdi Haghgoo

    02/06/2021, 8:22 AM
    Does being modular mean less decoupling in Jetpack Compose?
    j
    k
    • 3
    • 3
  • d

    Denis

    02/06/2021, 10:03 AM
    Could you help me to understand recomposition? This code adds a different number to
    counts
    list on each tap. I expect it to render a new
    Count
    and somehow move previous rows down without calling
    Count
    again. Is it possible?
    @Composable
    fun CounterApp() {
        var counts by remember { mutableStateOf(listOf<Int>()) }
        var taps by remember { mutableStateOf(0) }
        Column(
            modifier = Modifier.fillMaxSize().clickable(onClick = {
                counts = listOf(taps) + counts; taps++
            })
        ) { Text("$taps"); Divider(); counts.forEach { Count(it) } }
    }
    
    @Composable
    fun Count(n: Int) {
        Log.d("Count", "$n")
        Text("$n")
    }
    r
    • 2
    • 2
  • l

    lewis

    02/06/2021, 11:14 AM
    Is there any way to use
    androidx.paging.compose.LazyPagingItems#getItemCount
    for recomposition on change?
    a
    • 2
    • 3
  • j

    Jordi Saumell

    02/06/2021, 4:53 PM
    I have an unexpected (to me at least) behaviour with
    OnDestinationChangedListener
    of the Navigation component. I have a bottom nav bar with 3 items, and the third is a subgraph. When I navigate to that one my OnDestinationChangedListener gets called twice, first with the start destination and then with the actual destination. Is this the intended behaviour?
    ✔️ 1
    i
    • 2
    • 5
  • r

    Rick Regan

    02/06/2021, 5:14 PM
    Does
    Checkbox
    have
    onCheckedChange: (Boolean) -> Unit
    instead of
    onClick: () -> Unit
    only to support
    TriStateCheckbox
    ? I can see why it's there for that but if you are not using TriStateCheckbox (the normal usage case?) it seems strange that it's just not onClick (like Button, RadioButton, TextButton, and even TriStateCheckbox itself). Why not have a second signature for CheckBox with onClick instead of onCheckedChange?
    j
    • 2
    • 4
  • d

    Dominaezzz

    02/06/2021, 5:16 PM
    Out of curiosity, has anyone ever written a recursive @Composable function?
    👀 3
    j
    z
    +3
    • 6
    • 12
  • s

    Shakil Karim

    02/06/2021, 5:17 PM
    Is Navigator a good use-case for provided as an Ambient?
    i
    • 2
    • 3
  • j

    Jordi Saumell

    02/06/2021, 7:41 PM
    If I handle config changes manually (no activity recreation) and I want to override the system language the only way I’ve found is by using
    updateConfiguration(config, displayMetrics)
    , which works fine but happens to be deprecated 😅. All other ways that I know of rely on activity recreation (wrapping the context and using
    createConfigurationContext
    , using
    attachBaseContext
    , using
    applyOverrideConfiguration
    ). Is there a non-deprecated way of doing this (without recreating the activity)? (I think overwriting the language is considered not being the best practice, but it is quite common and many clients want it 🤷‍♂️)
    a
    • 2
    • 18
  • m

    Michael Elgavi

    02/06/2021, 7:54 PM
    How do I make a composable fill remaining space in a
    Column
    ? Tried
    fillMaxHeight
    but that takes up the entire column
    a
    h
    t
    • 4
    • 10
  • c

    Colton Idle

    02/07/2021, 12:40 AM
    If I set my
    kotlinCompilerExtensionVersion
    to
    1.4.21-2
    should I also set all of the other kotlin versions to the same thing? i.e. kotlin-stdlib, etc? I feel like I never heard about this -2 release of kotlin
    e
    • 2
    • 5
  • c

    Colton Idle

    02/07/2021, 1:39 AM
    This compose doc page has this line, but this setup doc does not. Which doc is right?
    freeCompilerArgs += ["-Xallow-jvm-ir-dependencies"]
    a
    v
    • 3
    • 2
  • d

    Denis

    02/07/2021, 6:56 AM
    I copy a `mutableStateListOf` example from docs without any changes, but it doesn't seem to work. AFAIU it should add new names, but the list on the screen stays empty. If I change it to
    var names = remember { mutableStateListOf<String>() }
    it starts to work. Is it a mistake in docs or am I doing/expecting something wrong?
    j
    n
    • 3
    • 6
  • n

    Nat Strangerweather

    02/07/2021, 9:54 AM
    Someone on StackOverflow is asking a question about button click sounds. I'd like to know the answer too, as I noticed my compose buttons do not make any touch sounds when clicked. Any ideas? https://stackoverflow.com/q/66080018/5513788
    c
    n
    • 3
    • 4
  • i

    Ilias Zosimadis

    02/07/2021, 10:37 AM
    The problem with intrinsic size is that currently is not supported for SubcomposeLayout. So is there any other way to match the height of the Divider with the ComposableX?
    a
    j
    • 3
    • 5
  • z

    Zhelyazko Atanasov

    02/07/2021, 2:52 PM
    Hi all! We do have things like
    TextField
    and
    BasicTextField
    ,
    Text
    and
    BasicText
    . But I can't seem to find the "Basic" version of a
    Button
    . That is - if I don't want to use the material buttons or library, is there a barebone composable for a button or I'd have to implement one myself?
    👍 2
    d
    i
    +2
    • 5
    • 5
  • n

    Noé Casas

    02/07/2021, 7:09 PM
    In
    LazyColumn
    if I scroll down slowly, rows are adjusted to adjust to the first row. If I scroll up slowly, I can’t get past the current first visible element; scrolling up faster I can get past it. I am not passing anything special to
    LazyColumn
    . The same happens with
    LazyVerticalGrid
    . Can I disable this behaviour? I am using alpha-10, but it also happens at least in alpha-09 and alpha-08
    a
    • 2
    • 2
Powered by Linen
Title
n

Noé Casas

02/07/2021, 7:09 PM
In
LazyColumn
if I scroll down slowly, rows are adjusted to adjust to the first row. If I scroll up slowly, I can’t get past the current first visible element; scrolling up faster I can get past it. I am not passing anything special to
LazyColumn
. The same happens with
LazyVerticalGrid
. Can I disable this behaviour? I am using alpha-10, but it also happens at least in alpha-09 and alpha-08
a

Adam Powell

02/07/2021, 7:11 PM
check alpha11; if it's still happening please file a bug
n

Noé Casas

02/07/2021, 7:43 PM
Yes, it still happens in alpha11. The bug I filed is https://issuetracker.google.com/issues/179593134
👍 1
View count: 4