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

    TheMrCodes

    03/29/2021, 4:50 PM
    Hey guys, is it possible to 'draw' a composeable to a ImageBitmap or to make some kind of screenshot of a specific composable? (during runtime not testing) Asking aspecialy for Compose for Desktop but I would say this is a general Compose topic
    ➕ 3
    h
    d
    • 3
    • 11
  • m

    Michal Klimczak

    03/29/2021, 8:01 PM
    This way of observing a SharedFlow (repeat=0) seems to work but it looks suspicious, especially because of
    LaunchedEffect(true)
    . There's probably some other
    Effect
    that I should use, right?
    val pagerState = rememberPagerState(pageCount = pages.size)
    
    LaunchedEffect(true) {
        //SharedFlow 
        pageChangeFlow.collect { 
            pagerState.animateScrollToPage(it) 
        }
    }
    
    HorizontalPager(state = pagerState)
    d
    i
    c
    • 4
    • 20
  • s

    Shivam Sethi

    03/30/2021, 4:35 AM
    message has been deleted
    k
    z
    • 3
    • 7
  • t

    Tim Malseed

    03/30/2021, 11:15 AM
    I’ve got some data classes loaded from a database, which make their way to my compose function, via StateIn in a ViewModel. I wanted to adjust the equality predicate for these objects, to be based on ID, rather than comparing all fields. Since making this change, I’ve noticed that my layout isn’t recomposed when the database emits an updated model whose ID has not changed.
    ➕ 1
    • 1
    • 4
  • g

    Gabriel

    03/30/2021, 11:37 AM
    I'm having an issue with a preview not rendering, I have a data class that stores a refernce to a drawable, as part of the preview I'm creating some dummy data and referencing real drawables, but the preview complains that the drawables don't exist, see :thread-please:
    • 1
    • 5
  • l

    Lukasz Burcon

    03/30/2021, 11:41 AM
    Hey! Wanted to implement a scrollable list that isn’t clickable when some conditions are met (eg. a snackbar is displayed). I came up with that idea:
    Column(modifier = Modifier.pointerInteropFilter {
        when (it.action) {
            ACTION_DOWN -> {
                true
            }
            else -> {
                false
            }
        }
    }
    ... some other code
    )
    But sadly that code blocks all scroll interactions. How can I intercept clicks to my buttons on a scrollable column without disabling the scroll?
    a
    • 2
    • 3
  • d

    Denis Ismailaj

    03/30/2021, 12:32 PM
    Is there a known bug about LazyRow items overlapping when scrolled fast?
    c
    f
    • 3
    • 6
  • n

    Nthily

    03/30/2021, 3:09 PM
    val getContent = registerForActivityResult(ActivityResultContracts.GetContent()) {
        viewModel.imageUriState.value = it
        // Handle the returned Uri
    }
    
    if (viewModel.imageUriState.value != null) {
    
        Log.d(TAG, "${viewModel.imageUriState.value}")
    }
    getContent.launch("image/*")
    Hi, I got the Uri of the photo from the user's album using registerForActivityResult, how can I convert the Uri to ImageBitmap and store it in my room? i've searched a lot from StackOverflow, but there doesn't seem to be a very standard answer
    s
    a
    i
    • 4
    • 14
  • t

    TheMrCodes

    03/30/2021, 4:59 PM
    Can someone explain to me why
    BocWithConstraints
    skips a Frame before rendering its child nodes? [wrong call]
    z
    g
    • 3
    • 6
  • d

    dzaitsev

    03/30/2021, 5:11 PM
    Hi there. Today I managed to catch this crash in 1.0.0-beta03. Is it a known issue? Reproducible only on Pixel 2 XL, 11.0.
    🎟️ 1
    :thread-please: 2
    l
    • 2
    • 2
  • g

    Geert

    03/30/2021, 7:16 PM
    What is the icons package for jetpack compose? I have implementation “androidx.compose.material:material:1.0.0-beta03” but I cant find icons like import androidx.compose.material.icons.filled.NavigateBefore
    z
    c
    • 3
    • 4
  • a

    Alejo

    03/30/2021, 8:46 PM
    Hi there. Lint is showing me "Conflicting on color for a given background" when creating a DarkColorPallete. Here is a capture. Am I missing something?
    l
    • 2
    • 2
  • t

    Tim Malseed

    03/30/2021, 10:16 PM
    Is it possible to customise the equality predicate used by Compose to determine whether recomposition is required (i.e. observe particular fields of an object)?
    z
    • 2
    • 14
  • j

    Joe Jensen

    03/31/2021, 12:43 AM
    Any way to show a bottom sheet dialog without adding
    ModalBottomSheetLayout
    as a root component to the app? My use case: I have an existing app with bottom navigation implemented as a fragment, and I will slowly migrate each tab (each its own fragment) to jetpack compose. How would I render a bottom sheet on top of all that UI? There doesn't seem to be an equivalent to
    AlertDialog
    but for bottom sheets
    t
    k
    i
    • 4
    • 13
  • s

    Shivam Sethi

    03/31/2021, 1:58 AM
    how can I listen for route changes in compose navigation and check for a specific route ?
    k
    i
    t
    • 4
    • 7
  • m

    Marko Novakovic

    03/31/2021, 7:31 AM
    can you point me to idiomatic
    Compose
    MVI
    example?
    s
    n
    • 3
    • 6
  • a

    Alan Yin

    03/31/2021, 9:01 AM
    How to implment button like this with Compose?
    c
    • 2
    • 3
  • s

    Samir Basnet

    03/31/2021, 9:27 AM
    Finally achieved parallax effect with LazyList
    device-2021-03-31-151029.mp4
    👏 12
    s
    l
    +3
    • 6
    • 9
  • s

    subashz

    03/31/2021, 10:03 AM
    Hey, are there any plan to have transform(matrix:Matrix, path:Path) API on new compose path package ?
    c
    n
    • 3
    • 3
  • m

    Mikołaj Kąkol

    03/31/2021, 10:15 AM
    How we should use
    Modifier
    that is passed to compose function. What the idea there? Should it be passed to first composable function, or to most inner function? Should we treat it like
    layoutparams
    , so it’s for the most outer composable? Is it okay to pass multiple
    Modifiers
    to different composables?
    j
    m
    • 3
    • 10
  • e

    escodro

    03/31/2021, 11:53 AM
    Hello, everyone! 👋 Do Jetpack Navigation Compose have support for Dynamic Feature Modules? At the moment I have a Navigation Graph similar to:
    NavHost(navController = navController, startDestination = startDestination) {
    
        composable(Destinations.Home) {
            Home()
        }
    
        composable(Destination.TaskDetail) { 
            TaskDetailSection()
        }
    
        composable(Destination.About) {
            About()
        }
    }
    But I don’t see how I can make my graph call a compose from a DFM ou how could the DFM register on this graph. Thanks a lot in advance! ❤️
    i
    • 2
    • 4
  • g

    Geert

    03/31/2021, 12:35 PM
    I have text in a textfield, but when I use IMEAction next to go to this textfield, the cursor is in front of the text. Does someone know which property I can use to change it.
    s
    • 2
    • 2
  • j

    Jesse Hill

    03/31/2021, 12:37 PM
    Has anyone tried to show some compose UI for when the app was moved to the background? The use case is that we need to have a privacy screen that will be shown in the app switcher whenever the user has closed the app. I was able to achieve a UI change by updating a
    mutableStateOf
    when the activity hit
    onPause
    but then in the app switcher it still showed the old UI. I also was trying to use the Lifecycle architecture component to update the state but that didn’t work either. Is this something that can be achieved with Compose? The current code is in the thread.
    a
    z
    • 3
    • 5
  • s

    Samir Basnet

    03/31/2021, 1:26 PM
    I tried to achieve an online green dot before text using drawWithContent but the text/content is overlapping . Can anyone guide me to solve this issue?
    Text(
        text = "Online",
        style = MaterialTheme.typography.subtitle2,
        maxLines = 1,
        color = MaterialTheme.colors.onSurface,
        modifier = Modifier
            .drawWithContent {
                drawCircle(color = green, radius = 25f)
                drawContent()
            }
            .constrainAs(online) {
                start.linkTo(name.start)
                top.linkTo(verifiedLogo.bottom, 10.dp)
            }
    
    )
    a
    • 2
    • 5
  • a

    Alex

    03/31/2021, 3:20 PM
    Is there a new way to create Scrollbars?
    VerticalScrollbar
    seems no longer to exist..?
    s
    • 2
    • 3
  • n

    Nthily

    03/31/2021, 4:18 PM
    Does jetpack compose have an image cropper?
    g
    l
    • 3
    • 5
  • d

    Daniel Candeias

    03/31/2021, 4:46 PM
    I have seen some Animation examples online, but not able to use
    onActive{}
    . • Does it still exist, or does it have a different name/approach now? Currently using compose version
    1.0.0-beta3
    , i did import
    runtime
    ,
    livedata
    and
    rxjava2
    but still cant see these methods. • I would like the animation to start as soon as its rendered. For this I would use
    animateFloatAsState
    for this together with
    onActive{}
    . I guess the is how we handle animation.
    i
    • 2
    • 2
  • w

    wisdom

    03/31/2021, 6:20 PM
    Hi Devs, I need help 😩, please how can I achieve this design ?
    s
    c
    r
    • 4
    • 5
  • j

    julioromano

    03/31/2021, 6:44 PM
    Got this error during upgrade to kotlin 1.4.32
    e: This version (1.0.0-alpha13) of the Compose Compiler requires Kotlin version 1.4.31 but you appear to be using Kotlin version 1.4.32 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
    I knew about this (that this needs to be suppressed if one wants to upgrade kotlin), but the curious thing is the “1.0.0-alpha13” version of compose compiler part. Why alpha13 if I’m using beta03?
    r
    • 2
    • 3
  • s

    Shivam Sethi

    03/31/2021, 8:26 PM
    Can someone quickly guide me to how to set a max height limit to a composable, what I want is to have it wrap content height, but as soon as the content overflow certain height I want to set it's height to an upper bound not however it takes
    z
    a
    • 3
    • 4
Powered by Linen
Title
s

Shivam Sethi

03/31/2021, 8:26 PM
Can someone quickly guide me to how to set a max height limit to a composable, what I want is to have it wrap content height, but as soon as the content overflow certain height I want to set it's height to an upper bound not however it takes
z

Zach Klippenstein (he/him) [MOD]

03/31/2021, 8:28 PM
i think
Modifier.heightIn
is what you’re looking for? https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary.html#(androidx.compose.ui.[…]x.compose.ui.unit.Dp)
s

Shivam Sethi

03/31/2021, 8:36 PM
Oh thanks, bdw is there a way to get content height in dp to use in this as min height?
a

Adam Powell

03/31/2021, 8:52 PM
you shouldn't need to, the min and max only set bounds. Content will generally size itself as small as it can without going below the minimum. (Unless it's been additionally modified with a
.fillMaxHeight
or something similar)
s

Shivam Sethi

03/31/2021, 8:56 PM
Awesome, thanks
View count: 2