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

    Marko Novakovic

    07/05/2021, 10:36 PM
    I have a problem with Accompanist image loading crashing my app, error in thread
    b
    5 replies · 2 participants
  • k

    kevindmoore

    07/06/2021, 2:44 AM
    Does Compose have a concept like Flutter’s Provider classes? It would be nice to provide and instance of a class at a high level and easily retrieve it at a lower level
    s
    w
    4 replies · 3 participants
  • a

    Adib Faramarzi

    07/06/2021, 3:47 AM
    How would you go for finger "hover" detection? I have a grid of boxes and I want the user to hold their finger and drag onto the boxes, all the boxes that have been touched by the finger should be notified.
    a
    6 replies · 2 participants
  • p

    Philip S

    07/06/2021, 6:57 AM
    How do you mock
    rememberLauncherForActivityResult
    in Compose? With
    registerForActivityResult
    you could send in a
    registry
    parameter to prevent the real implementation from being called in UI-tests. However this is missing for the Compose equivalent.
    n
    i
    9 replies · 3 participants
  • p

    Peter Mandeljc

    07/06/2021, 7:26 AM
    is it possible to expand composable as much as possible, without using constraint layout. For example:
    Column(
            modifier = Modifier.fillMaxHeight(),
            verticalArrangement = Arrangement.SpaceBetween
        ) {
            // How to expand this composable height as much as possible...
            Text(text = "long text over multiple lines", modifier = Modifier.fillMaxHeight())
            // ...without loosing sight of this one?
            Text(text = "long text over multiple lines")
        }
    f
    3 replies · 2 participants
  • k

    Kaustubh Patange

    07/06/2021, 8:26 AM
    Does studio has support for Gradle's new version catalog feature introduced in 7.0 or I should stick with
    ext {}
    to define my dependencies so that studio can show a lint warning if there are any new version of library available?
    g
    b
    2 replies · 3 participants
  • d

    dimsuz

    07/06/2021, 10:08 AM
    If I have
    val state = remember { ... }
    and then below this line I have
    Column { Box { Column { Component(state) } } }
    , does it make any difference (performance or memory-wise) to have this state closer to its usage, i.e. should I put it in the innermost lambda rather than have it outside? I mean in this case none of intermediate composable lambdas need this state and this is known to stay like this. But having it "outside" is sometimes better for organizational purposes.
    y
    f
    +1
    5 replies · 4 participants
  • a

    Artem Kopan

    07/06/2021, 11:12 AM
    Does anyone know how to draw gradient line in compose? I see only end color
    c
    2 replies · 2 participants
  • a

    Alexandru Hadăr

    07/06/2021, 1:22 PM
    Has anyone else encountered this bug? If I use a Button with a Text(text = stringResources(...)), the text will be aligned to the bottom of the button (second image). However, if I use a string directly, everything works just fine (first image / 🧵 with the code and more info) (happening on both
    beta-09
    and
    rc01
    )
    d
    9 replies · 2 participants
  • e

    escodro

    07/06/2021, 2:51 PM
    Hello, everyone! 👋 I’m having some issues with Instrumented Tests. Could you help me please? Basically my MainActivity contains a
    LocalBackPressedDispatcher
    to handle back presses. The code is similar to:
    setContent {
        AlkaaTheme {
            CompositionLocalProvider(LocalBackPressedDispatcher provides onBackPressedDispatcher) {
                NavGraph()
            }
        }
    }
    But now my tests are failing with
    No Back Dispatcher provided
    but I’m not finding a way to provide it.
    composeTestRule.setContent {
        AlkaaTheme {
            CompositionLocalProvider(
                LocalBackPressedDispatcher provides onBackPressedDispatcher //unresolved reference
            ) {
                NavGraph()
            }
        }
    }
    I tried with both
    createComposeRule()
    and
    createEmptyComposeRule()
    . Thanks a lot!
    i
    2 replies · 2 participants
  • n

    Ngenge Senior

    07/06/2021, 3:32 PM
    I just published Integrating Exoplayer in Jetpack Compose https://link.medium.com/RkCJIHkQFhb . Once more let us see the beauty of Compose
    👍 1
    👍🏼 2
    g
    1 reply · 2 participants
  • s

    Stefan Oltmann

    07/06/2021, 5:16 PM
    Can I request if a Composable like my ImageView is visible or has disappeared? I have a image gallery grid with 1000+ photos and if my ImageView is visible I launch a coroutine so set and fetch a thumbnail to display. But if the user scrolls quickly trough the gallery I want to cancel the request for loading the thumbnail as it's not needed. I use
    rememberCoroutineScope()
    but it looks like that "isActive" in the loading job still returns "true" even if it's not more on screen. To test that I have put into a delay of 1000ms. Is there something like "onDisappeared" that I can use to cancel my job? Or can I have that coroutineScope cancel the job automatic if it's no longer visible?
    ✅ 1
    f
    d
    3 replies · 3 participants
  • b

    Bryan Herbst

    07/06/2021, 5:58 PM
    Why is
    Modifier.swipeable()
    in Material? This doesn’t feel like a behavior that is Material-specific, and some of the internal bits make it difficult to recreate swipeable components such as
    ModalBottomSheet
    in non-Material design systems
    ➕ 3
    t
    j
    3 replies · 3 participants
  • a

    Anton Popov

    07/06/2021, 7:31 PM
    I wonder, how efficient this code is (🧵). Is this less efficient than just using composable lambda instead of AlertAction? Will AlertAction constructor (basically a function) allocate new ComposableLambda each time icon changes? If so, is it worse than slot api based impl? Intention is to solve this
    2 replies · 1 participant
  • t

    Tash

    07/06/2021, 9:52 PM
    What is "good practice" for defining dimensions in Compose? i.e. as plain "magic numbers" like `40.dp`/`12.sp` etc inside Composables, or extracting as constants in separate Kt file, or keeping them in XML?
    d
    m
    5 replies · 3 participants
  • c

    Colton Idle

    07/07/2021, 12:02 AM
    I have an onClick listener right now and it's drawing a ripple with straight edges. How can I turn it into a circular ripple?
    b
    l
    +1
    3 replies · 4 participants
  • n

    Nurseyit Tursunkulov

    07/07/2021, 10:46 AM
    https://stackoverflow.com/questions/68284586/compose-java-lang-illegalstateexception-pending-composition-has-not-been-applie
    a
    2 replies · 2 participants
  • l

    Lucien Guimaraes

    07/07/2021, 11:01 AM
    Is it possible to add contentPadding to HorizontalPager from Accompagnist ? Like it's done for LazyRow
    f
    t
    11 replies · 3 participants
  • b

    Boris Kachscovsky

    07/07/2021, 11:20 AM
    Is there any way to define the width of an element after it had been measured in a custom layout?
    Layout(content = {
       Composable1()
       Composable2()
       ComposableWhoseSizeDependsOnOtherComposables()
    } { measurables, constraints ->
     // I measure all the elements and get the width i'd like the last element to be
     layout(width, height) {
       // I place placables for composable 1 and 2
       //
       // How can i make composable 3's width depend on the measurements I had made on 1 and 2?
     }
    }
    a
    a
    3 replies · 3 participants
  • m

    Michał Diner

    07/07/2021, 1:21 PM
    Does anyone know how can I scroll to the top when clicking BottomNavBar item again?
    a
    j
    5 replies · 3 participants
  • b

    Bryan Herbst

    07/07/2021, 2:50 PM
    Should apps that define their own non-Material design system be using the new profile rules to create ART profiles for key theming Composables (e.g equivalents of
    MaterialTheme
    )? If so, do profile rules work in a library module (i.e. modules that are not packaged as AARs)? The release notes specifically say “Libraries can define these rules which will be packaged in AAR artifacts”, which seems to indicate perhaps not.
    k
    t
    8 replies · 3 participants
  • d

    dimsuz

    07/07/2021, 3:15 PM
    On Android 9 I have a strange artefact where
    Column(modifier = Modifier.alpha(0.9f)) { Surface(elevation = 16.dp) }
    is drawing drastically different shadow + gets clipped — compared to
    alpha(1f)
    . None of this happens on other SDK versions. Is this some known/reported bug?
    ➕ 1
    k
    a
    9 replies · 3 participants
  • c

    Chris Johnson

    07/07/2021, 4:11 PM
    Has anyone tried to use
    animateColorAsState
    to targetColor then back to initialColor with colors that have alpha? I'm running into seemingly a bug? with using alpha colors. It will animate to the desired color, then go back to almost initialColor but with some of the targetColor applied as alpha then back to targetColor and finally it will go to the initialColor again with no alpha.
    d
    24 replies · 2 participants
  • z

    Zun

    07/07/2021, 5:50 PM
    What would be the correct way to center your LazyVerticalGrid? As you can see on the right there's more spacing due to how adaptive cells work.
    a
    4 replies · 2 participants
  • j

    Jan

    07/07/2021, 7:13 PM
    Hello! I have been trying to make a color picker for Jetpack Compose (Desktop) because I couldn't find any.
    c
    t
    4 replies · 3 participants
  • k

    Kunal Raghav

    07/07/2021, 7:26 PM
    Good Day everyone , I was finally able to release an app built purely on jetpack compose, please take a look. https://play.google.com/store/apps/details?id=com.rocketlabs.rockmal It's based around the myanimelist.net api and hence helps its users to track their anime list
    👍 4
    s
    1 reply · 2 participants
  • y

    YASAN

    07/07/2021, 7:44 PM
    Is it possible to limit a
    LazyVerticalGrid
    to specific number of rows or do I have to manually calculate how many items I need to pass to it in order to make it stay on the number of rows I want to show?
    z
    6 replies · 2 participants
  • r

    rsktash

    07/07/2021, 8:21 PM
    I’ve an idea. What if every composable function returns virtual custom Unit void in order to restrict composable function content types. We could convert these custom units to void at compile time. For example: We have a composable function which accepts only Text composable
    @Cooposable
    fun RenderSomeUI(modifier: Modifier, content: @Composable () -> TextUnit){
    }
    j
    a
    +2
    11 replies · 5 participants
  • l

    Luis Mierez

    07/07/2021, 9:21 PM
    Is there an analog to TextLayout in compose? I’m trying to figure out the width of some text for animation purposes
    k
    3 replies · 2 participants
  • d

    dimsuz

    07/07/2021, 10:22 PM
    I've heard that compose in release mode enables a lot of optimizations and feels more snappy. I wonder what does "release mode" mean here? I have a "custom" build type which has "debuggable = true; minifyEnabled = true", so I guess R8 does run. But app still feels not very snappy on older devices (especially around
    LazyColumn
    ). Will setting
    debuggable = false
    improve things? Or maybe something else?
    :yes: 3
    c
    r
    2 replies · 3 participants
Powered by Linen
Title
d

dimsuz

07/07/2021, 10:22 PM
I've heard that compose in release mode enables a lot of optimizations and feels more snappy. I wonder what does "release mode" mean here? I have a "custom" build type which has "debuggable = true; minifyEnabled = true", so I guess R8 does run. But app still feels not very snappy on older devices (especially around
LazyColumn
). Will setting
debuggable = false
improve things? Or maybe something else?
:yes: 3
c

Colton Idle

07/08/2021, 4:18 AM
I'm also interested if Romain can chime in here or something. I almost want to be able to test my code in "release" mode, but still be in debug mode. I guess just writing that out, it sounds laughable and conflicting, but yeah. I'm hoping compose 1.0 brings some kind of blog post about how to test this sort of stuff.
r

romainguy

07/08/2021, 3:27 PM
debuggable has an impact (which is why the benchmarking libraries warn you when it’s on). There are other things to take into account too (interpreted vs JIT vs AOT).
View count: 17