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

    rnett

    08/19/2021, 2:29 AM
    I have two conflicting state changes being done from an event handler. I would like the first to be done, trigger recompose, and then the second (no-longer conflicting, since it would be based on the newly updated state) to be done. This isn't what happens, is there a way to force it? Note that these event handlers are passed in. I could potentially force recomposition between them, but that would be expensive when the event handlers don't need it. Minimal example in :thread-please:
    d
    • 2
    • 6
  • r

    Ravin Jain

    08/19/2021, 3:05 AM
    Question about recomposition with
    List
    and
    SnapshotStateList
    Using
    List
    instead of
    SnapshotStateList
    with
    items.forEachIndexed
    causes recomposition of all the composables. For example in the below code when I click
    Button A
    it calls a function in viewmodel which increments the
    progressState
    by 10. This state change should recompose only the
    A
    composable but it causes recomposition of
    B
    as well. Any idea why ? Example in the thread :thread-please:
    c
    • 2
    • 3
  • a

    Anton Dmytryshyn

    08/19/2021, 4:41 AM
    https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0-alpha07 Got to wait before upgrading to this dependency to use alongside accompanist, despite all the great bug fixes. It doesn't play nice with accompanist AnimatedNavhost(), when trying to use it an error occurs
    java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Set
            at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost$lambda-3(AnimatedNavHost.kt:323)
            at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:158)
            at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:85)
    :party-parrot: 2
    👍 3
    i
    • 2
    • 3
  • a

    allan.conda

    08/19/2021, 5:15 AM
    has this been fixed in the latest navigation update? https://issuetracker.google.com/issues/194313238
    navigation-compose 2.4.0-alpha05 does not keep a subgraph’s BackStackEntry until the transition animation completes
    i
    • 2
    • 3
  • a

    aiidziis

    08/19/2021, 6:41 AM
    Hey! Maybe someone has encountered Skia crashes in production when running Compose. Stacktrace in thread 👇🏻
    a
    n
    • 3
    • 8
  • z

    zhagnfei

    08/19/2021, 6:51 AM
    TextField(
            value = feedContent.observeAsState().value ?: "",
            onValueChange = {
                if (it.length <= 200) {
                    feedContent.value = it
                }
            },
            maxLines = 4,
            colors = textFieldColors(
                    textColor = colorResource(id = R.color.color_22BE8C),
                    cursorColor = colorResource(id = R.color.colorPrimary),
                    backgroundColor = colorResource(id = R.color.color_f1f3f7),
                    focusedIndicatorColor = Color.Transparent,
                    unfocusedIndicatorColor = Color.Transparent,
                    disabledIndicatorColor = Color.Transparent
            ),
            shape = RoundedCornerShape(6.dp),
            placeholder = {
                Text(text = stringResource(id = R.string.feedback_input_desc),
                        modifier = Modifier.wrapContentSize(),
                        color = colorResource(id = R.color.color_BBBBC3), fontSize = 14.sp)
            },
            modifier = Modifier
                    .fillMaxWidth()
                    .wrapContentHeight(align = <http://Alignment.Top|Alignment.Top>)
                    .padding(top = 20.dp)
                    .background(Color(0xF1F3F7), RoundedCornerShape(6.dp)),
    )
    why show the textcolor is colorPrimary????
    a
    c
    • 3
    • 7
  • a

    Alex

    08/19/2021, 8:11 AM
    What could be a reason that a LazyColumn produces this crash?
    java.lang.ArrayIndexOutOfBoundsException: length=32; index=32
            at androidx.compose.runtime.collection.IdentityArrayMap.remove(IdentityArrayMap.kt:100)
            ...
    a
    • 2
    • 3
  • k

    K Merle

    08/19/2021, 9:44 AM
    Do you guys keep/take dp values from R.dimen still?
    l
    • 2
    • 1
  • a

    Adib Faramarzi

    08/19/2021, 11:14 AM
    https://www.reddit.com/r/androiddev/comments/p7co8z/i_liked_the_clock_of_clocks_idea_so_much_that_i/
    🤩 2
    ❤️ 2
    👍 4
    • 1
    • 2
  • s

    Slackbot

    08/19/2021, 12:23 PM
    This message was deleted.
    r
    a
    • 3
    • 3
  • h

    hussan

    08/19/2021, 12:24 PM
    Hi, it is possible to use Flow with Jetpack Compose?
    v
    l
    h
    • 4
    • 4
  • a

    Anastasia Rozovskaya

    08/19/2021, 12:33 PM
    Good day everyone! This doesn’t work. Details are in the thread below
    viewModel::onExampleButtonClicked
    n
    n
    a
    • 4
    • 11
  • f

    Florian

    08/19/2021, 1:51 PM
    Does
    fillMaxSize
    not work if the container is scrollable?
    d
    c
    +2
    • 5
    • 20
  • f

    Florian

    08/19/2021, 2:45 PM
    This
    Text
    with
    maxLines = 1
    and
    overflow = TextOverflow.Ellipsis
    breaks before a new word, causing the menu item to not take up the full available width. I there was no space behind the last "a", the item would have a larger width. My question is, how can I let this
    Text
    wrap in the middle of words instead? I tried
    softWrap = false
    but it has no effect
    c
    • 2
    • 2
  • t

    theapache64

    08/19/2021, 3:25 PM
    ❓ Question: [Navigation Compose]: How can i get number of items in the backstack using
    NavHostController
    ?
    i
    a
    • 3
    • 10
  • m

    Mărcuţ Andrei

    08/19/2021, 3:32 PM
    I’m trying to disable autofill on compose for android. I’m using a
    OutlinedTextField
    , and i’ve set it up with
    PasswordVisualTransformation
    . Autofill appears shortly after typing a few characters. Any hints on how to disable the built-in autofill? 😅 Thanks in advance!
    c
    • 2
    • 9
  • a

    Ashu

    08/19/2021, 4:21 PM
    I am getting the following error on build:
    e: This version (1.0.0-beta07) of the Compose Compiler requires Kotlin version 1.4.32 but you appear to be using Kotlin version 1.5.21 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
    But I am using compose 1.0.1 and the only place that uses beta is
    androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02
    which itself is beta02 not beta07, I am not sure if internally it uses compose compiler beta07. How do I resolve this issue.??
    c
    • 2
    • 2
  • c

    Chuck Stein

    08/19/2021, 5:19 PM
    Is there any mechanism like
    remember
    but instead of recalculating if dependencies change, it recalculates if a given predicate is true? My use case is I have some UI content within an
    AnimatedVisibility
    block, where
    visible = uiState is InitialUiState
    . (My UI state is a sealed class with subtypes we can call
    InitialUiState
    and
    SecondaryUiState
    .) Some of the UI content I'm animating depends on a property contained within
    InitialUiState
    , but not
    SecondaryUiState
    . So when it's animating out of visibility, my
    uiState
    no longer contains the data needed in order to render the UI. I can wrap the content in
    if (uiState is InitialUiState)
    , but then the content just disappears instead of animating out. My thought is I need to memoize the most recent
    InitialUiState
    value, using something like
    val initialUiState = rememberUnless(uiState is InitialUiState) { uiState as? InitialUiState }
    , so that we can access the data contained within the last
    InitialUiState
    , even when the current value of
    uiState
    is a
    SecondaryUiState
    . In this example it would recalculate on every composition where
    uiState is InitialUiState
    , but "remember" and return the previous calculation otherwise.
    c
    d
    • 3
    • 18
  • c

    Chris Johnson

    08/19/2021, 5:53 PM
    What's everyone's thoughts on passing in your viewModel to your top level composable VS passing in just your uiState? I'm leaning towards passing in the uiState since it seems that's all you need to preview/test but I was wondering if there's a best practice we should follow and why?
    ➕ 5
    c
    c
    • 3
    • 2
  • n

    Nick

    08/19/2021, 6:16 PM
    If I have a column with several components in it, how do I make one of those components always be at the bottom (specifically a FAB button)
    l
    • 2
    • 4
  • a

    Ashu

    08/19/2021, 8:01 PM
    So this question has been asked like a zillion times, but let me ask it again, what's up with
    androidx.compose.ui.tooling.PreviewActivity is not an Activity subclass or alias
    .?? I am on the latest stable version of everything, • Compose 1.0.1 • AGP 7.0.2 • Kotlin 1.5.21 • Android Studio Arctic Fox Patch 1 ...and still this issue is coming. What's up with that. And how do I fix it.?? Its so annoying. And why does making a duplication Run Configuration of the same just works perfectly fine.??
    🤯 1
    👀 2
    a
    • 2
    • 6
  • s

    Sam

    08/19/2021, 8:42 PM
    Compose noob here, i'm trying to use
    keys
    to avoid recomposition of previously composed ones but can't seem to get it to work. Displaying a list with items and a button to shuffle the list item but all items are composed again (logging via
    SideEffect
    )
    i
    z
    • 3
    • 22
  • c

    Colton Idle

    08/19/2021, 9:17 PM
    I have a lazy column with a gradient background, and I want the gradient to be the entire height. BUT after I start scrolling I want to gradient to scroll up/off of the screen. Any Ideas on how to implement? I currently have a Box { GradientBackground() LazyColumn() } but the Gradient (of course) doesn't move up. Is there anything Col or LazyCol provide for this sort of thing? Kind of like a "first page background", and then a background for everything below the device height?
    z
    a
    • 3
    • 16
  • i

    Ink

    08/19/2021, 9:46 PM
    Is it possible to do something like that in the latest version of Compose?
    :yes: 4
    r
    • 2
    • 1
  • c

    CRamsan

    08/19/2021, 11:07 PM
    Hello everyone. Does someone know what will be the plan moving for supporting new versions of the Kotlin compiler? Will Compose always require explicit support for any new compiler version?
    z
    • 2
    • 1
  • t

    tad

    08/20/2021, 12:08 AM
    Just to clarify: If I log something during recomposition of the top-level function of my Compose app, and that log occurs every 16 milliseconds, then one of the arguments to the top-level function has "changed" according to Compose?
    z
    c
    • 3
    • 9
  • z

    zhagnfei

    08/20/2021, 2:51 AM
    i want render diff view with data but when use state it not change like this:
    val state: MutableList<String>? by imageList.observeAsState(mutableListOf())
    if (state.isNullOrEmpty()) {
        feedbackPlaceView(addImgClick)
    } else {
        state?.forEachIndexed { listIndex, s ->
    z
    • 2
    • 4
  • c

    Carton Waffle

    08/20/2021, 3:42 AM
    Hello is there a a configuration to lock compose at horizontal orientation?
    c
    • 2
    • 2
  • t

    Tlaster

    08/20/2021, 4:40 AM
    Is there any further plan to improve LazyColumn performance?
    ☝️ 1
    a
    r
    +2
    • 5
    • 6
  • a

    Anton Dmytryshyn

    08/20/2021, 5:02 AM
    Has anyone managed to implement using Navigation Animation a version of Material Motion Fade Through?
    ✅ 1
    c
    d
    • 3
    • 2
Powered by Linen
Title
a

Anton Dmytryshyn

08/20/2021, 5:02 AM
Has anyone managed to implement using Navigation Animation a version of Material Motion Fade Through?
✅ 1
c

Colton Idle

08/20/2021, 5:53 AM
I don't think the material animations are a thing for compose yet, but they should be coming soon IIRC
d

Doris Liu

08/20/2021, 6:11 AM
Both fade and scale that are needed by fade through are already supported as built in enter and exit transition. Here's a list of different material motions implemented by @Chris Sinco [G] https://gist.github.com/c5inco/796edc5d88e8561872380b61e6089c04
:party-parrot: 3
View count: 5