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

    Mehdi Haghgoo

    03/22/2021, 7:29 PM
    There seems to be a bug with the animateContentSize animation when animating Icon size. The animation does not seem very consistent. This happens on emulator and the real device.
    d
    6 replies · 2 participants
  • c

    Colton Idle

    03/22/2021, 8:09 PM
    I wasn't able to find anything recent that still worked for answering this simple question, but excuse me if my slack search skills are failing me. How can you change the ripple color of a materialButton? My designer wants to slightly change the alpha of the ripple vs the one that comes out of the box.
    l
    11 replies · 2 participants
  • j

    Jakub Ledwon

    03/22/2021, 10:36 PM
    I have an app which allows users to pick color them they want. In settings screen I have three rows of
    RadioButtons
    (to change between themese) with
    Boxes
    (to present the main color of theme). Everything is managed by a viewModel . In compose beta01 everythings works fine, but in beta02 after changing selected theme, other theme's color changes as well. Is there some sort of bug or am I doing somethings wrong? I prepared a simplified code snippet with screens in comment
    l
    6 replies · 2 participants
  • a

    Abdalla Hassanin

    03/22/2021, 10:44 PM
    How to make RatingBar in compose android
    t
    2 replies · 2 participants
  • t

    Tash

    03/23/2021, 3:52 AM
    Trying to render a list of items, each with their own 
    State
    , and would like to keep track of the first & last item’s 
    State
    . For some reason having trouble wrapping my mind around this particular scenario 🧵 ⬇️
    z
    12 replies · 2 participants
  • k

    knthmn

    03/23/2021, 4:38 AM
    How do you encode a string as an destination argument for
    NavHostController.navigate()
    ? My database is backed by a
    String
    primary key that can contain chars like
    ?
    and
    /
    .
    i
    n
    11 replies · 3 participants
  • k

    knthmn

    03/23/2021, 8:34 AM
    I have implemented nested scroll app bar with
    Modifier.nestedScroll
    , I want the app bar to snap to a fully shown / hidden position after. Which method should I use to listen that the user has stopped scrolling?
    a
    m
    3 replies · 3 participants
  • s

    Slackbot

    03/23/2021, 10:06 AM
    This message was deleted.
    c
    1 reply · 2 participants
  • l

    leosan

    03/23/2021, 10:10 AM
    Hi folks is there any way to hook View’s methods such as
    isEnabled
    to an
    AbstractComposeView
    ? For instance I’m trying to make a Wrapper of a composable
    Button
    like that: My intention was to try to reuse some of the View’s API, otherwise I will have to deprecate every View’s methods so people unaware of how compose works don’t try to update the view using the View’s API Code in the 🧵
    c
    a
    10 replies · 3 participants
  • s

    Shakil Karim

    03/23/2021, 1:39 PM
    https://android-review.googlesource.com/c/platform/frameworks/support/+/1647103 Compose for Web? 🤔
    a
    a
    +1
    3 replies · 4 participants
  • f

    Farid Mrz

    03/23/2021, 1:39 PM
    I have a custom padding modifier from the codelab. However when using that modifier for a text inside a collumn with other texts the position is incorrect. My guess is the position based on the constraints are not respected. Anyone can point to what im missing?
    z
    5 replies · 2 participants
  • g

    Geert

    03/23/2021, 2:07 PM
    More people who just have a black screen when they are debugging and the app just launchen when you press run?
    o
    4 replies · 2 participants
  • g

    Gabriel

    03/23/2021, 4:02 PM
    I'm looking at a compose library for dialog, and it's got bits of code like
    content: @Composable MaterialDialog.() -> Unit
    and
    this@MaterialDialog.content()
    Is this stuff a Kotlinism or a Composism or something else completely? Can anyone link me to something describing what these things are doing here? I think it's saying content will be a lambda/function callable on MaterialDialog? But I'd like to read a bit more about it
    a
    3 replies · 2 participants
  • c

    Chachako

    03/23/2021, 4:18 PM
    I want to know if I have any way to transition the screen content on the left to the right in an elegant way? To this end, I wrote a lot of code to try, it made my code area very bad, I have already planned to give up the transition animation😔(which means it can not be as cool as I thought). Unfortunately, I tried for a whole day but didn’t get a solution. I really hope that the
    navigation-transition
    will appear soon.
    i
    z
    +1
    8 replies · 4 participants
  • s

    Shawn Tucker

    03/23/2021, 5:04 PM
    LocalElevationOverlay.provides(null)
    is not working. I still get elevation overlay on my surface. What am I missing?
    l
    l
    10 replies · 3 participants
  • s

    Spikey Sanju

    03/23/2021, 6:53 PM
    How to add gradient for drawArc composable?... Currently code works fine without brush argument.
    t
    4 replies · 2 participants
  • f

    Francois Morvillier

    03/23/2021, 7:18 PM
    How do I add fling to a Modifier.draggable, with snapping to a set of values if possibe?
    t
    a
    +1
    7 replies · 4 participants
  • b

    Big Chungus

    03/23/2021, 7:33 PM
    Any reason why @Composable annotation is not annotated with @DslMarker? Visibility in IDEA alone would be a big improvement basically for free.
    a
    2 replies · 2 participants
  • m

    Mateusz Apacki

    03/23/2021, 8:28 PM
    compose beta02 Hi, I have a problem with LazyColumn, AndroidViewBinding, and CoilImage. When I scroll view which is delivered by AndroidView is not attach to CoilImage video:
    list.mov
    :thread-please: 5
    s
    c
    7 replies · 3 participants
  • s

    Shalaga44

    03/24/2021, 5:01 AM
    message has been deleted
    a
    2 replies · 2 participants
  • s

    Slackbot

    03/24/2021, 5:44 AM
    This message was deleted.
    s
    1 reply · 2 participants
  • a

    Abhishek Dewan

    03/24/2021, 5:44 AM
    Working on an application where I am using Coil Image inside of NavGraph and when I try to use the CoilImage like shown in the thread, I get and error even though the image is accesible via url.
    i
    3 replies · 2 participants
  • d

    Deepak Gahlot

    03/24/2021, 5:45 AM
    Hi All, Do we need to handle the onbackpress() while using Navigation for JetPack Compose. It looks like by default it is maintaining the stack. But when i click on the back button the previous composable comes up blank.
    2 replies · 1 participant
  • s

    Slackbot

    03/24/2021, 6:34 AM
    This message was deleted.
    f
    u
    2 replies · 3 participants
  • o

    Orhan Tozan

    03/24/2021, 9:08 AM
    Compose beta03 release today if my calculations are not wrong 🙂
    :kotlin-intensifies: 8
    :jetpack-compose: 4
    l
    j
    +2
    11 replies · 5 participants
  • t

    Tlaster

    03/24/2021, 9:59 AM
    Just wonder will Jetpack Compose and Jetbrains Compose be merged onto one "Compose library" eventually? Because it's a little bit confusing when writing a Compose library, I'll have to write 2 separate modules cause there're Jetbrain Compose and Jetpack Compose but the source code is basically the same. Or maybe there's a better way I haven't found out yet?
    f
    c
    4 replies · 3 participants
  • c

    carbaj0

    03/24/2021, 11:29 AM
    are more challenges expected? (AndroidDevChanllenge, those who contribute to the project I guess they have a lot of challenges)
    n
    1 reply · 2 participants
  • d

    Daniele B

    03/24/2021, 12:05 PM
    What is the best way to debug the startup time of a Compose app? To understand what happens before the first screen shows up?
    a
    j
    10 replies · 3 participants
  • g

    Gabriel

    03/24/2021, 12:36 PM
    How are people dealing with having lots of preview functions in their compose files? Do people keep their composeables files quite small?
    ➕ 1
    a
    j
    +1
    5 replies · 4 participants
  • j

    julioromano

    03/24/2021, 2:18 PM
    Is there a generic way to know when the scroll state of a scrollable composable is at its topmost position? Thing is Lazy lists hold scroll state in the 
    LazyListState
     type whilst composables that scroll using modifiers hold scroll state in the 
    ScrollState
      type. Even though both types implement  
    ScrollableState
      the way they expose the current scroll position differs:
    LazyListState
     exposes 
    firstVisibleItemIndex
     and 
    firstVisibleItemScrollOffset
     for this purpose, while 
    ScrollState
     exposes 
    value
     instead. This is making it more difficult to implement a generic solution that works with both e.g. a 
    LazyColumn
     and a 
    Column
     which uses the 
    verticalScroll
     modifier. In case you’re wondering what I’d like to accomplish you’ll find more info in the thread.
    ✅ 1
    a
    t
    6 replies · 3 participants
Powered by Linen
Title
j

julioromano

03/24/2021, 2:18 PM
Is there a generic way to know when the scroll state of a scrollable composable is at its topmost position? Thing is Lazy lists hold scroll state in the 
LazyListState
 type whilst composables that scroll using modifiers hold scroll state in the 
ScrollState
  type. Even though both types implement  
ScrollableState
  the way they expose the current scroll position differs:
LazyListState
 exposes 
firstVisibleItemIndex
 and 
firstVisibleItemScrollOffset
 for this purpose, while 
ScrollState
 exposes 
value
 instead. This is making it more difficult to implement a generic solution that works with both e.g. a 
LazyColumn
 and a 
Column
 which uses the 
verticalScroll
 modifier. In case you’re wondering what I’d like to accomplish you’ll find more info in the thread.
✅ 1
I'd like to change the `topBar`'s elevation inside a 
Scaffold
 depending on whether its main 
content
 has been scrolled all the way to the top or not. I managed to do that by hoisting the `LazyColumn`'s 
LazyListState
 up into the 
Scaffold
 but I'd like a generic solution that works for any scrollable composable that could be hosted in the Scaffold's content. Do you think it's possible?
I’ve also tried with the nested scroll subsystem but it seems it only informs about scroll events, and not scroll position. So it’s not possible to extract a scroll position from it.
a

Albert Chang

03/24/2021, 2:31 PM
You can increase the elevation in
onPostScroll
when there's offset available in a downwards scroll, and decrease it in
onPreScroll
when it's a upwards scroll.
:thank-you: 1
j

julioromano

03/24/2021, 3:03 PM
This actually works! But I still don’t understand why 🙂. I think I’m missing something about the nested scrolling subsystem.
t

Timo Drick

03/24/2021, 4:58 PM
I think there is this nestedScroll modifier for such use cases. But i think it is not working reliable for now to identify the exact scrolling position: https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/package-summary#(androidx.compose.ui.[…]estedScrollDispatcher)
j

julioromano

03/24/2021, 5:01 PM
Yes it works @Timo Drick, that’s what @Albert Chang suggested and that’s what I’ve done in the end. I still don’t fully understand how the offsets in those callbacks work, but I was able to accomplish what I originally asked for.
👍 1
View count: 2