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

    Jasmin Fajkic

    09/07/2022, 7:55 AM
    Hello. Is is possible to set box height that we scale correctly on all devices ? Something like 50% of screen height?
    s
    j
    • 3
    • 4
  • h

    Hasan Nagizade

    09/07/2022, 8:17 AM
    is there an article where I can read about effects and events with lots of examples?
    j
    • 2
    • 2
  • j

    John O'Reilly

    09/07/2022, 8:39 AM
    just fyi that I've "NowInAndroid'ised" the Android Compose client in the PeopleInSpace KMM sample! In case it's useful for anyone to see most of approaches in that applied to a smaller project https://twitter.com/joreilly/status/1567227516028428293?s=20&t=3KOUpDsUv7k1H3A7FK07UQ
  • s

    Simon Wanbua

    09/07/2022, 9:30 AM
    I am experiencing an issue similar to this one on stackoverflow::https://stackoverflow.com/questions/72586273/how-to-set-dynamic-position-of-snackbar-in-jetpack-compose Any insights will be appreciated
    s
    • 2
    • 4
  • o

    oday

    09/07/2022, 10:21 AM
    what’s the equivalent of “a view that i need to treat as a bounding box for a single icon” ? could be Column or Row or even Box really, right?
    s
    a
    • 3
    • 7
  • y

    Yves Kalume

    09/07/2022, 10:54 AM
    I'm using compose in a library module in which I've some drawables, but if I try to use those drawables it throws "`Unresolved reference : "`
  • s

    Slackbot

    09/07/2022, 12:13 PM
    This message was deleted.
  • c

    Colton Idle

    09/07/2022, 1:33 PM
    Very interesting. TIL

    https://youtu.be/SWBN0y0lFNY▾

    z
    f
    +4
    • 7
    • 56
  • d

    deviant

    09/07/2022, 1:45 PM
    hey guys. i made this game using compose (mainly canvas). and it is multiplatform so can run on desktop and browser. potentially may work on ios, but i don't have a mac to test 🙂 https://github.com/mykola-dev/Tetris
  • j

    Jason Atwood

    09/07/2022, 2:41 PM
    @Zach Klippenstein (he/him) [MOD] in your post you say
    The only time a read can't happen is when reading a
    StateObject
    that was initialized after the current snapshot was created. If you've ever gotten an
    IllegalStateException
    with the message "Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied", that might be why (although in practice it usually means a bug in Compose itself, not your code)
    https://dev.to/zachklipp/implementing-snapshot-aware-data-structures-3pi8 A year later, do you still agree w/ the statement "although in practice it usually means a bug in Compose itself, not your code" ?
    i
    • 2
    • 3
  • a

    Aaron Waller

    09/07/2022, 3:14 PM
    How can I see the effect of the standard compose baseline profile besides downloading from Google Play store? Do I have to manually sideload it?
    j
    • 2
    • 2
  • n

    nitrog42

    09/07/2022, 3:41 PM
    Hello, in the doc of the BottomSheetScaffold
    ```* @param sheetPeekHeight The height of the bottom sheet when it is collapsed. If the peek height
    * equals the sheet's full height, the sheet will only have a collapsed state.```
    What is the best way to set it to the “sheet full height” ? use Modifier.OnSizeChanged {} on the sheet content ?
    j
    • 2
    • 1
  • a

    Afzal Najam

    09/07/2022, 8:04 PM
    By reading some material and looking at the code 😄 https://medium.com/androiddevelopers/jetpack-compose-debugging-recomposition-bfcf4a6f8d37
    o
    m
    +2
    • 5
    • 4
  • o

    oday

    09/07/2022, 9:14 PM
    can I have something like CutCornerShape but ..in reverse?
    • 1
    • 2
  • a

    Akram Bensalem

    09/07/2022, 10:15 PM
    I have an issue with Layout Inspector with Jetpack compose app!!!
    a
    j
    • 3
    • 7
  • z

    zt

    09/07/2022, 11:08 PM
    How can I make a bottom sheet using the material 3 beta02 library?
  • c

    Colton Idle

    09/07/2022, 11:23 PM
    Compose Version 1.3.0-beta02 released today! Stuff that I think is Interesting • Initial version of experimental
    StaggeredGrid
    (Ia48be) • Renamed
    <http://FocusDirection.In|FocusDirection.In>
    and
    FocusDirection.Out
    to
    FocusDirection.Enter
    and
    FocusDirection.Exit
    (Ia4262, b/183746982) • Introduced a
    rememberSnapFlingBehavior
    overload that provides a quick way of enabling snapping in
    LazyLists
    . (Ifb48a) if this is what I think it is... OH HECK YEAHHH. EDIT: Actually I want snapping in non-lazy lists. Snapping in lazy lists can already be done with chris banes snapper. But maybe this opens the door for non lazy snapping? • Swipeable V2 (Phase 1) (👀 jossi) • Gradle edition: kotlin.RequiresOptIn is now enabled by default (not exactly sure what this means, but hopefully no more kotlin warnings about experimental apis?) Material3 • Default components insets introduced in m3 components in beta01 version no longer account for IME insets. • Material3 Scaffold component now has a
    contentWindowInsets
    parameter, allowing to specify the amount of insets to handle for the content slot. (Icf11a, b/243713323) • Deprecates the experimental Material 3
    SmallTopAppBar
    function and introduces an equivalent
    TopAppBar
    function. Please migrate your usage to the new one. (I74404, b/226918634) • Adds control over the top app bar fling and snap behaviors. (I15c81) • Removes startIndent from Divider, moves color to last parameter. (If7be2) • Have Dialogs identify themselves to talkback users by announcing the word Dialog when they are displayed. Oh and compiler version update today too • Fix
    IllegalStateException
    where Compose Compiler was erroneously marking unit types as composable in some circumstances. (b/237863365) • Users must now specify their preferred Kotlin version when suppressing compiler version check (I9e5e2)
    e
    s
    +4
    • 7
    • 14
  • s

    Slackbot

    09/08/2022, 2:10 AM
    This message was deleted.
  • m

    Mjahangiry75

    09/08/2022, 9:41 AM
    Why lazy column is so laggy? It just shows a simple text for each row
    f
    c
    • 3
    • 2
  • o

    Othman El Jazouli

    09/08/2022, 10:34 AM
    anybody know if there is a way to get the over scroll offset of a lazycolumn? I found this OffsetOverscrollEffect but looks like it can only be applied to
    scrollable
    modifier, is there a way to have the same for lazycolumn?
  • a

    Aaron Waller

    09/08/2022, 11:29 AM
    Accompanist-Pager had a offScreenPageLimit parameter which was removed in v. 0.19.0. I want the same behaviour as Google Play store and only load the page when the user opens it. How can I set the offScreenLimit to 0 on my HorizontalPager?
    c
    c
    • 3
    • 5
  • z

    Zun

    09/08/2022, 11:33 AM
    I have a LazyColumn with remote images. I know the resolution of the image, I am displaying them using FillWidth, this means the image that might be 300x400 might actually be 600x800 as it's scaled to fill the width. How can I have an empty placeholder that fills the space in the LazyColumn with the same dimension as the resolution that is scaled with FillWidth as well? Right now when the user scrolls the image is 0dp height, but increased in size once the image is loaded. This causes jumps while scrolling. The docs actually mention this as well but I am unsure how to set the correct height https://developer.android.com/jetpack/compose/lists#lazy-layouts-tips
    j
    • 2
    • 4
  • a

    Aaron Waller

    09/08/2022, 12:19 PM
    After upgrading from compose 1.0.1 to 1.3.0-beta01 my Zoomable Image is ignoring the parent Box dimensions (250x250) I can even zoom it so large that It reaches over the TopBar…
    o
    • 2
    • 4
  • t

    Tim Malseed

    09/08/2022, 12:24 PM
    I’m trying to ‘return a result’ via Compose - setting a value on the
    SavedStateHandle
    of the
    previousBackStackEntry
    and then popping the backstack. But, the
    SavedStateHandle
    that I want to interact with belongs to the initial screen’s
    ViewModel
    , and I sense that this is not the same instance as the
    SavedStateHandle
    found on the
    previousBackStackEntry
    I suspect this has something to do with scoping
    ViewModels
    , but I’ve tried a few things and I’m out of ideas. Code in thread
    i
    • 2
    • 3
  • c

    Colton Idle

    09/08/2022, 1:45 PM
    People have posted about these kinds of issues a lot. (even me) If you file a bug i'll star. 😅
    t
    • 2
    • 1
  • o

    oday

    09/08/2022, 2:52 PM
    say I would like to make the contents of a composable all have an alpha of 0.5 if the
    active
    flag is false, and 1 if it’s true, is there a nicer way to do it than adding
    alpha = if (active) 1f else 0.5f
    to each composable inside?
    l
    j
    • 3
    • 6
  • j

    Jasmin Fajkic

    09/08/2022, 3:06 PM
    I want to make complete row clickable but when I apply clickable modifier it just have ripple effect on content of row. Any advice how to propagate ripple effect on complete row?
    j
    n
    • 3
    • 2
  • a

    allan.conda

    09/08/2022, 3:19 PM
    👋 After a 100+ NavHost destinations app starts to struggle and slows down the startup sequence to render the first frame. (+300ms) Deeplinks and Regex seem to be the heavy part and accumulates. Is there anything I can do on my side? Below screenshot have 6 deeplink patterns defined.
    i
    • 2
    • 2
  • j

    jim

    09/08/2022, 11:01 PM
    Compose Compiler pre-release works with Kotlin 1.7.20-RC: https://androidx.dev/storage/compose-compiler/repository
  • z

    Zoltan Demant

    09/09/2022, 4:21 AM
    AnimatedContent
    is not animating my content in a given scenario, despite
    targetState
    having changed. It works in all other cases. Any ideas? More details in 🧵
    i
    • 2
    • 7
Powered by Linen
Title
z

Zoltan Demant

09/09/2022, 4:21 AM
AnimatedContent
is not animating my content in a given scenario, despite
targetState
having changed. It works in all other cases. Any ideas? More details in 🧵
Ive added logs to verify that the targetState does in fact change, that transitionSpec is invoked and results in the animations I want, and that the content block is invoked with the new content. (Ill add those logs at the end in case theyre helpful). For this particular case, Im viewing a details screen, choosing to delete the data that it represents - which in turn causes the screen to be hidden (which is where the animation should play). The animation runs perfectly fine if I just navigate back without deleting the data, and the delete does cause the parent screen to reload its data - but all of that happens in the background, so I dont really see how that could play a role in this? Once the animation is "done", i.e. jumps to its final state, everything works like normal again, so its literary just the animation itself not running for some unknown reason. Here are the logs; 1 represents the parent, 2 is the details screen. targetState(1) exit() exit() content(2) exit() exit() content(1) content(2) content(1) content(1) content(1) content(1) content(1) My animations are really simple, using
slideInVertically + fadeOut
and
slideOutVertically + fadeIn
.
i

Ian Lake

09/09/2022, 4:29 AM
Note that composition keeps happening even while your animation is happening, so your details screen will continue to be recomposed as your animation runs. That means that it'll continue to be recomposed even after you've deleted the data it is displaying. What does your details screen emit if there is no underlying data in whatever source of truth you are loading your data from? If, for example, it something like a
collectAsState()
then an
if (data != null) { DetailScreen(data) }
, then you'll just be animating out an empty screen, which doesn't seem like what you'd want
z

Zoltan Demant

09/09/2022, 4:31 AM
It holds the last known value in its state (in a viewmodel of sorts), so nothing really changes there.
The loading itself is delivered as a Result<T>, so I just do result.onSuccess { updateState }.onFailure { navigateBack }
Just for sanity, I ran through the loop and I can verify that the correct state is being rendered even on the way out! If I specify
dataFlow.take(1)
on the parent, then the animations runs fine 🤷‍♂️🏽 So definitely seems to be related to that, but I cant tell how. Ive gone through the entire loop multiple times and everything works exactly as expected.. basically: delete happens, cache is updated, triggers related flows to refresh, screen is updated.
i

Ian Lake

09/09/2022, 5:00 AM
in that
result.onSuccess { updateState }.onFailure { navigateBack }
call, did you log how many times the
onSuccess
and
onFailure
lambdas are being called? It would be interesting to know if you're somehow calling
navigateBack
multiple times in a row
z

Zoltan Demant

09/09/2022, 5:23 AM
I found the issue! ⭐ I dont fully understand how it could have an impact on this, but the gist of it is that my repository had a
withContext(IO)
block, and the result of that was then handled inside another
withContext(IO)
block (my intention was to have both of those in the same block). Theres literary no code outside the withContext blocks, and the entire call is invoked on
Dispatchers.Default
. Id love to understand how that could have such an impact on this scenario! I also understand if thats impossible to say without way more details, all in all Im just glad that it works as expected 🙂
View count: 6