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

    Ruben Quadros

    06/25/2022, 2:56 PM
    Hi everyone, I have an exo player view in portrait mode and on click of expand button I want to transition my screen to landscape mode and show the exo player in the full screen. I am getting the following error when transitioning from portrait to landscape. Code and stacktrace in thread.
    java.lang.IllegalStateException: pending composition has not been applied
    • 1
    • 2
  • m

    Mehdi Haghgoo

    06/25/2022, 8:56 PM
    Hi. Is it possible to compile compose code in my app and generate UI? (Using compose compiler in app level)
  • j

    Ji Sungbin

    06/26/2022, 11:14 AM
    I saw that changes were tracked and requested invalidation through
    Recompoer#runRecomposeAndApplyChanges
    . This function tracks changes and requests invalidation in the while statement and remains suspended until new changes are made through
    waitWorkAvailable()
    in the while statement.
    awaitWorkAvailable()
    works with
    suspendCancellableCoroutine
    and assigns
    Continuation
    to
    workContinuation
    if there is no scheduled task. The
    workContinuation
    is resumed in the invokeOnCompletion of a Job called
    effectJob
    . Therefore, in order for
    workContinuation
    to resume,
    effectJob
    must be completed.
    Recomposer#close
    , which completes it, is used only in the
    withRunningRecomposer
    function, but
    withRunningRecomposer
    is not used. So where does
    workContinuation
    resume? I had the same concern a month ago, but I still haven’t solved it. (Job.cancel is also possible to call invokeOnComplete, but cancel is used only for lifecycle handling through Owner)
  • r

    RE

    06/26/2022, 2:41 PM
    Is there any way to allow
    ClickableText
    to pass touches to underlying components? In the case that the user does not click on a specific text, I hope that
    ClickableText
    can pass the click event without consuming the click event, such as a clickable
    Card
    s
    j
    • 3
    • 4
  • a

    Ahmed

    06/26/2022, 4:03 PM
    I learned Java and most of kotlin and I want to start my journey with compose, I also built basic apps using swing I want to build an app that works on browsers, desktop and mobile devices
    ⁉️ 4
    👍 4
    👍🏾 1
  • i

    itnoles

    06/27/2022, 1:28 AM
    What is a proper way to use CustomTabsIntent with side-effects? it may to be called during recomposition.
  • z

    zt

    06/27/2022, 2:16 AM
    I'm trying to make UI for a media3 player but I'm not sure how to make the player variables like duration into states that cause recomposition
    c
    f
    s
    • 4
    • 10
  • j

    james

    06/27/2022, 4:24 AM
    is there a straightforward way to track the decay of velocity when scrolling LazyColumn? what I’d like is a way to track the decay as follows when I fling on my LazyColumn and it starts scrolling. let’s say the total scroll time for this example will take 2500ms: • at 0ms elapsed, the velocity would be 100 • at 500ms elapsed, the velocity would be 75 • at 1000ms elapsed, the velocity would be 25 • at 2000ms elapsed, the velocity would be 10 • at 2500ms elapsed, the velocity would be 0 (all example data of course, I’m just trying to illustrate the value I’d like to be able to track)
    c
    b
    • 3
    • 17
  • r

    raghunandan

    06/27/2022, 10:48 AM
    Looking for suggestions!. I have a bottom bar and navigation drawer in my top level destinations. I have other screens which also needs toolbar. Should i have scaffold in those screens as well or just a column and a topbar and hide the scaffold if its not a top level destination. I remember i saw thread related to this somewhere but cannot re-collect now.
    c
    • 2
    • 2
  • a

    allan.conda

    06/27/2022, 12:54 PM
    Will the baseline profile be more effective if I don’t turn off animations when collecting the profile?
    • 1
    • 1
  • n

    nuhkoca

    06/27/2022, 1:31 PM
    Hello, how can I animate the content whenever the keyboard opens/hides? Compose version:
    1.2.0-rc02
    s
    s
    • 3
    • 4
  • s

    sindrenm

    06/27/2022, 2:13 PM
    Using accompanist-navigation-material's
    ModalBottomSheetLayout
    and
    NavGraphBuilder.bottomSheet
    builder, is there a way I can monitor the visible height of the bottom sheet in question? I want to pin a button to the bottom of the sheet, but it seems the actual height of the
    sheetContent
    is larger than what's visible and is hidden «below the screen», so to speak.
    j
    • 2
    • 3
  • a

    Alex

    06/27/2022, 4:20 PM
    I can add system bars padding via
    systemBarsPadding()
    , is there a way to get the height of the system bars in
    dp
    instead of applying the padding directly?
    m
    j
    +2
    • 5
    • 7
  • s

    ste

    06/27/2022, 7:15 PM
    I'm getting
    Exception during IR lowering
    after updating from
    1.2.0-beta03
    to
    1.2.0-rc0x
    (Couldn't inline method call), is anyone facing the same problem?
    • 1
    • 1
  • a

    Adam Brown

    06/27/2022, 9:51 PM
    I was looking through some Compose widgets, and couldn't find where they are literally drawing their contents, is there a good example some where? Does it boil down to a canvas object at some point?
    f
    k
    +2
    • 5
    • 10
  • l

    Lilly

    06/27/2022, 11:46 PM
    Does the 1.2.0-rc02 release support Kotlin v1.7.0? I guess not
    k
    i
    j
    • 4
    • 4
  • d

    Davide Giuseppe Farella

    06/28/2022, 5:52 AM
    Good morning everybody, is there any news about Glance Widget? The last update is from Feb 23rd https://developer.android.com/jetpack/androidx/releases/glance
    i
    • 2
    • 2
  • s

    Slackbot

    06/28/2022, 7:08 AM
    This message was deleted.
  • t

    Tim Malseed

    06/28/2022, 7:11 AM
    I came across an article a little while back which had some recommendations about which imports to exclude to help improve efficiency when developing in Compose. But.. I can’t find it. Anyone know what I’m talking about?
    • 1
    • 1
  • m

    mcpiroman

    06/28/2022, 10:05 AM
    Internals: Why does compose not use java.lang.ThreadLocal on JVM, but a custom ThreadLocal implementation?
    a
    • 2
    • 2
  • t

    theapache64

    06/28/2022, 11:11 AM
    Question: Custom Modifier What’s the difference between these two approaches?
    this
    vs
    then(this)
    🤔
    j
    n
    • 3
    • 2
  • s

    Slackbot

    06/28/2022, 1:30 PM
    This message was deleted.
  • b

    Billy Newman

    06/28/2022, 1:45 PM
    Hello all, wondering if someone can help with some issues I am having with google map animation using the Google Compose Maps SDK. Code in comments.
    c
    c
    c
    • 4
    • 14
  • n

    nuhkoca

    06/28/2022, 3:18 PM
    Hello, how do I treat every new parameter as not equal with the previous one even if the instance is the same? I have a pulse component and for testing I just send consecutive
    Up
    objects but it just reflects the first one not others(see the first row). I set
    neverEqualPolicy
    but it doesn’t work, tho. What is your take for such cases? Thanks!
    val state = remember { mutableStateOf(initial, neverEqualPolicy()) }
    sealed class PerformancePulseUpdate : Serializable {
        object Up : PerformancePulseUpdate()
        object Down : PerformancePulseUpdate()
        object None : PerformancePulseUpdate()
    }
    z
    • 2
    • 2
  • m

    Mehdi Haghgoo

    06/28/2022, 4:10 PM
    @jw As per https://jakewharton.com/multiplatform-compose-and-gradle-module-metadata-abuse, have you written all your UI from scratch without any Compose UI compoent?
    j
    a
    • 3
    • 9
  • z

    zt

    06/29/2022, 4:56 AM
    How would I go about creating a player screen that has a mini player variant? similar to youtube
    :nice: 1
    s
    • 2
    • 1
  • m

    Michael Bichlmeier

    06/29/2022, 7:13 AM
    I’m failing to implement a ContentViewed event inside my composable as I have the following requirements: • Should get triggered when the composable gets displayed • Should get triggered when you are navigating back to that composable (like opening a new compose screen and do a back press) • Should NOT get triggered on configuration changes (e.g. orientation)
    @Composable
    fun MyScreen(viewModel: MyViewModel = get()){
       val items by viewModel.itemsToDisplay.collectAsState(initial = emptyList())
    
       ItemList(items)
    
       // when the UI is displayed, the VM should track ContentViewed (only once)
       LaunchedEffectContentViewed { viewModel.trackContentViewed() }
    }
    
    
    @Composable
    private fun LaunchedEffectContentViewed(track: () -> Unit) {
        val config = LocalConfiguration.current
        var initialOrientation by rememberSaveable { mutableStateOf(config.orientation) }
        val orientationChanged = initialOrientation != config.orientation 
    
        var wasExecuted by rememberSaveable { mutableStateOf(false) }
        LaunchedEffect(Unit) {
           if (!wasExecuted) {
             if (!orientationChanged) track() // only track when orientation change was not the reason for recomposition
             wasExecuted = true
           }
    
           if (orientationChanged) {
                initialOrientation = config.orientation // update initialOrientation with new one 
            }
        }
    }
    I’m quite sure I’m doing something wrong with my
    remember*
    calls and I hope some can explain me what I have to adapt to achieve my requirements? I also created a stackoverflow question for that.
  • f

    Feri Nagy

    06/29/2022, 8:37 AM
    Is there some general consensus on appending “size modifiers” - eg.
    fillMaxWidth()
    to the modifier passed to a composable?
    @Composable
    fun MyComponent(modifier: Modifier = Modifier) {
        Box(modifier = modifier.fillMaxWidth()) {
            // ...
        }
    }
    On one hand, it feels like it hurts reusability, on the other it can remove some duplication. WDYT? Valid usage, frowned upon, should be avoided?
    n
    • 2
    • 1
  • p

    Priyank

    06/29/2022, 9:32 AM
    I am using compose maps library to display clusters of markers. Now to display a custom info window adapter I want to use the compose. I have followed the documentation of interoperability of compose via ComposeView. but when I add the ComposeView inside the info window method I am getting this error of cannot locate window recomposer.
    Cannot locate windowRecomposer; View androidx.compose.ui.platform.ComposeView{e560fcf V.E...... ......I. 0,0-0,0} is not attached to a window
    clusterManager?.markerCollection?.setInfoWindowAdapter(object : InfoWindowAdapter {
        override fun getInfoContents(p0: Marker): View? {
            return null
        }
    
        override fun getInfoWindow(p0: Marker): View {
            val composeView = ComposeView(context).apply {
                setContent {
                    Text("Hello World")
                }
            }
            return composeView
        }
    })
    So is there any way to use the compose function inside getInfoWindow()?
  • a

    Akram Bensalem

    06/29/2022, 9:51 AM
    Is it possible to make the same with Jetpack compose ?
    :yes: 3
    😱 2
    s
    c
    +4
    • 7
    • 13
Powered by Linen
Title
a

Akram Bensalem

06/29/2022, 9:51 AM
Is it possible to make the same with Jetpack compose ?
:yes: 3
😱 2
s

ste

06/29/2022, 10:04 AM
yes, but... good luck 😂
😂 7
c

Csaba Szugyiczki

06/29/2022, 10:12 AM
I guess yes, but you really really should not! This is not what a Floating Action Button was ever meant to be. It is really confusing…
😯 1
➕ 2
☝️ 1
It might be a great way to learn animations but please do not ever release it as a library 😄
❤️ 2
f

Filip Wiesner

06/29/2022, 10:36 AM
I guess so but not every app needs to use the “Material” design language. This can be used in design where there is no concept of “floating action button”. I would welcome this as a cool library for those that can make use of it in their design language or at least as a cool example of Compose animations
c

Csaba Szugyiczki

06/29/2022, 10:39 AM
Okay, but then it should not look anything like a FAB. Otherwise it is not a new design language, but a misused existing design language
☝️ 1
f

Filip Wiesner

06/29/2022, 10:41 AM
“FAB” is just a round button with shadow. It’s not that hard to accidentally look like FAB. I understand your argument (edit: and agree with it) but I still think that “_please do not ever release it as a library_” is a bit harsh
c

Csaba Szugyiczki

06/29/2022, 10:45 AM
Sorry, I did not mean to be rude. What my intention was, to prevent this from getting traction and end up as a misused pattern. These concepts are quite opinionated and when they are used in ways they should not be, they create confusion, instead of making UIs more predictable and uniform
f

Filip Wiesner

06/29/2022, 10:47 AM
👍 Agreed
o

Oleksandr Balan

06/29/2022, 10:57 AM
Actually I have implemented something similar for Week 1 of AndroidDevChallenge, you can find the
WaveComposable
useful: https://github.com/oleksandrbalan/android-dev-challenge-compose/blob/main/app/src/[…]java/com/example/androiddevchallenge/overview/WaveComposable.kt It was inspired by this Dribble: https://dribbble.com/shots/5967252-Tab-Bar-Animation
video.mp4
a

andrew

06/29/2022, 3:07 PM
Very possible
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1633534958135000
❤️ 1
😍 2
d

dewildte

06/29/2022, 4:38 PM
Yes it is.
c

Csaba Szugyiczki

06/30/2022, 7:01 AM
Guess I was late with the “prevent this from getting traction” part 🙂
View count: 2