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

    Billy Newman

    11/14/2022, 9:57 PM
    Hello all. I am looking for help on how to determine if a permission dialog has been shown to the user. I would like to remain in my current composable until the user either rejects the permission, allows the permission, or dismisses the permission dialog. Code in reply.
    c
    • 2
    • 4
  • c

    Carlos Muñoz

    11/15/2022, 12:18 AM
    Hi all! Using
    ClickableText + AnnotatedString
    (Following this approach from the docs) to render a text with several clickable sections. Is there a simple way to have some pressed state when one of the clickable sections is clicked?
    t
    • 2
    • 1
  • c

    Colton Idle

    11/15/2022, 3:20 AM
    Android Dev Summit (part 3) was today. Had a few little tidbits on compose. Most interestingly a video on accessibility in compose. Playlist here: https://www.youtube.com/playlist?list=PLWz5rJ2EKKc8PO99T1QQLrPAJILqxJXW6
    t
    • 2
    • 2
  • z

    Zoltan Demant

    11/15/2022, 6:04 AM
    Using
    LocalSaveableStateRegistry.current.registerProvider(..)
    eventually leads to
    TransactionTooLargeException
    . Given that
    rememberSaveable
    uses it under the hood, is there another way to store state in compose that is immune to this crash? Im looking to store a `Map<String, Parcelable>`that represents the entire apps navigation state.
    i
    s
    +2
    • 5
    • 16
  • p

    Pedro Alberto

    11/15/2022, 11:01 AM
    Is there a way to know if a
    MediumTopAppBar
    is collapsed ? I'm currently using this val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(topAppBarState)
  • o

    oday

    11/15/2022, 12:18 PM
    is this not how I would observe the changes in these MutableStateFlows?
    private val categoryFilter = BrowseEventsFilter.CategoryFilter(category = MutableStateFlow(Category.All))
    private val locationFilter = BrowseEventsFilter.LocationFilter(location = MutableStateFlow(null))
    private val periodFilter = BrowseEventsFilter.PeriodFilter(
        period = MutableStateFlow(Period.Any),
        dateRange = MutableStateFlow(null)
    )
    and then you change them
    var filtersState = MutableStateFlow(listOf(locationFilter, periodFilter, categoryFilter)) // collectAsState in the activity
    
    // how they change
    filterState?.enabled?.value = ChipStatus.ENABLED
    filterState?.period?.value = period
    filterState?.dateRange?.value = null
    and then observe them
    flowOf(periodFilter.period?.value,
        periodFilter.dateRange?.value,
        categoryFilter.category.value,
        locationFilter.location.value
    ).collect {
    
    // do something everytime their values change
    }
    f
    c
    • 3
    • 4
  • k

    K Merle

    11/15/2022, 1:00 PM
    How to change Typography MaterialTheme color of a text in the root?
    p
    l
    a
    • 4
    • 17
  • b

    brandonmcansh

    11/15/2022, 3:49 PM
    I'm unsure if this is a compose question still but is there a way to underline misspelled words in a TextField through some keyboardOptions config, or is it solely a build spanned string and use spell checker service to check each word? Our app is the default SMS app on the device as well if that helps/makes a difference
    z
    • 2
    • 2
  • s

    Stephen Vinouze

    11/15/2022, 4:49 PM
    Is there a way to navigate back inside a bottom sheet? I have 2 composables inside a bottom sheet. When I navigate to the second screen, the back button dismisses the bottom sheet instead of navigating back to the first screen. Navigation works well as long as the back button is not involved. Yet
    BackHandler
    inside the composables don’t get called 🤔
    i
    • 2
    • 6
  • c

    Colton Idle

    11/15/2022, 6:11 PM
    Is this the idiomatic way to do debounce for a text field? I suck with flows and just want to make sure I'm not shooting myself in the foot.
    class VM : ViewModel() {
        val text = MutableStateFlow("")
        val dbText = text.debounce(2000).distinctUntilChanged().flatMapLatest { (it) }
    
        private fun queryFromDb(query: String): Flow<String> {
            ...
        }
    }
    c
    f
    +2
    • 5
    • 38
  • t

    Tash

    11/15/2022, 7:20 PM
    Hi all 👋🏼 Running into a hard to repro crash that spouts
    java.lang.IllegalStateException: Unsupported concurrent change during composition. A state object was modified by composition as well as being modified outside composition.
    We don’t seem to be creating `mutableStateOf`s explicitly at all, much less modifying them on both sides of Composition boundaries…Any tips on where to start looking? Any help is much appreciated! 🙏🏼 More in 🧵
    r
    b
    +3
    • 6
    • 11
  • p

    PHondogo

    11/15/2022, 8:07 PM
    Hello! What element is better to use for displaying key:value property? From MD3 point of view.
    a
    • 2
    • 2
  • z

    Zsolt.bertalan

    11/15/2022, 10:04 PM
    https://issuetracker.google.com/issues/258639164 According to the reply to this issue LargeTopAppBars shouldn’t have image backgrounds. Is it just me thinking this is bad? This is the new paradigm? What will we say our designers if they still insist? Yes, I will happily write a custom composable for every widget?
  • z

    zt

    11/15/2022, 10:38 PM
    I'm using transformable modifier on my composable and I was wondering how I could set some limits for the zoom. I also want to have it prevent the user from moving the offset further than the content. How any other application does image zooming/panning is what I'm going for here.
    val transformableState = rememberTransformableState { zoomChange, offsetChange, _ ->
        scale *= zoomChange
        offset += offsetChange
    }
    l
    • 2
    • 2
  • l

    Loney Chou

    11/16/2022, 12:17 AM
    Is there any possibility that we don't need to import
    State.getValue
    and
    MutableState.setValue
    ?
    j
    j
    • 3
    • 4
  • t

    Tower Guidev2

    11/16/2022, 7:09 AM
    Hi i am investigating the use of
    com.google.accompanist.web.WebView
    in my current android compose project. I am trying capture when the user clicks on the webview to trigger a new page loaded, then i wish to show the next web page on the devices chrome browser and not in the accompanist webview
    e
    • 2
    • 3
  • a

    alvr

    11/16/2022, 8:50 AM
    Hello! Will there be version 1.3.3 of the compiler with support for Kotlin 1.7.21 or do you have to use the 1.4.0-alpha02?
    e
    c
    • 3
    • 2
  • c

    Carl Benson

    11/16/2022, 9:19 AM
    I have some troubles resizing a dialog using imeInsets, getting a weird effect
    • 1
    • 5
  • t

    Tower Guidev2

    11/16/2022, 9:25 AM
    Hi i have a LazyColumn list in my application that allows supports swipe to dismiss actions i would like to animate the items as the initial list is populated so that the users can see that swipe to dismiss is an available feature. i cannot see how to achieve this. i tried AnimateVisibility as the items are being added however nothing happens is it possible to show an affordance to my users that each list item is swipeable? just to make each item "bounce" left to right would be sufficient
  • a

    Alex

    11/16/2022, 10:13 AM
    I am using
    .onKeyPressed(…)
    Modifier
    which works fine for the software keyboard, but the key events do not work when using
    scrcpy
    and entering things with the hardware keyboard.. is there something I need to check or enable first?
  • h

    Hasan Nagizade

    11/16/2022, 10:19 AM
    is there any library out there that can be used for video playback and viewing/zooming images?
    a
    c
    c
    • 4
    • 10
  • p

    Pedro Alberto

    11/16/2022, 3:01 PM
    I found a bug on the mediumAppBar where we can't set the color of the expanded part of the bar 😞
    device-2022-11-16-160041.mp4
    t
    • 2
    • 4
  • m

    miqbaldc

    11/16/2022, 3:20 PM
    Hello folks, does it possible to preserve the content of
    Lazy*
    when scrolling?
    so in the red rectangle, the content border still shown, not truncated (due to padding in the
    Lazy*
    )
    I”m not sure what to search the right keyword for this in SO questions 🙏
    e
    • 2
    • 2
  • p

    PHondogo

    11/16/2022, 3:57 PM
    Hello! Is it possible to keep tree of composables but not show elements?
    a
    s
    +3
    • 6
    • 13
  • j

    John O'Reilly

    11/16/2022, 4:32 PM
    Has anyone by any chance got a Compose project to work with Kotlin 1.8.0-Beta (or is this something that's not going to work right now? I do have
    suppressKotlinVersionCompatibilityCheck=1.8.0-Beta
    fwiw
    e
    s
    • 3
    • 4
  • c

    Carl Benson

    11/16/2022, 4:44 PM
    I have a compose navigation controller issue, as in I want to be able to mix
    composable
    ,
    dialog
    and
    dialog<F: Fragment>
    destinations so I construct my navController like
    val context = LocalContext.current
    val fragmentManager = LocalFragmentManager.current
    val dialogFragmentNavigator = remember(
        context,
        fragmentManager
    ) { DialogFragmentNavigator(context, fragmentManager) }
    
    val navController = rememberNavController(dialogFragmentNavigator)
    but if I add a regular composable
    dialog
    destination to the graph, it will crash with
    java.lang.ClassCastException: androidx.navigation.compose.DialogNavigator cannot be cast to androidx.navigation.fragment.DialogFragmentNavigator
    m
    • 2
    • 7
  • n

    nlindberg

    11/16/2022, 4:59 PM
    Is there a way to share a “header” composable in a nested graph without creating separate navControllers? The only way I can see is to have a composable() with a header and then a new NavHost(). But afaik having multiple NavHosts is not recommended.
    d
    i
    • 3
    • 10
  • j

    Jan

    11/16/2022, 6:52 PM
    Hi, I’m trying to add swipe to dismiss to a
    LazyList
    . The default implementation of
    SwipeToDismiss
    will lead to accidental horizontal scrolling while trying to scroll vertically leading to accidental swipe to dismiss events. In vanilla android view world I’d set a touch listener and check against x > y touch event distance before starting swipe to dismiss. However in Jetpack Compose I don’t know how. I tried
    pointerInput
    modifier, however it disabled vertical scrolling completely. I’m aware of
    dismissThresholds
    but that does only handle invoking the
    dissmissState
    change.
    j
    s
    c
    • 4
    • 5
  • s

    Sky

    11/16/2022, 6:57 PM
    Is there a way to use
    MaterialTheme.colors.primarySurface
    in an Activity …when i try to use it example:
    systemUiController.setNavigationBarColor(color = MaterialTheme.colors.primarySurface)
    i get the error @Composable invocations can only happen from the context of a @Composable function
    k
    a
    m
    • 4
    • 3
  • j

    Jeff Jackson

    11/16/2022, 8:07 PM
    In Google Maps the bottom sheet has 4 distinct states, and these line up with the states for
    BottomSheetBehavior
    (collapsed, expanded, half-expanded, and hidden). Is there any chance that the standard Jetpack Compose bottom sheet will eventually support the other states?
    c
    • 2
    • 2
Powered by Linen
Title
j

Jeff Jackson

11/16/2022, 8:07 PM
In Google Maps the bottom sheet has 4 distinct states, and these line up with the states for
BottomSheetBehavior
(collapsed, expanded, half-expanded, and hidden). Is there any chance that the standard Jetpack Compose bottom sheet will eventually support the other states?
c

Colton Idle

11/16/2022, 9:52 PM
google maps have 4 states? i thought a bottom sheet always had 3 states. either way. @jossiwolf (sorry for the ping, but you sounded relevant?)
j

Jeff Jackson

11/17/2022, 6:43 PM
Yes, in Google Maps if you tap on a place, you get a
half-expanded
bottom sheet. You can drag it up to be
expanded
or down to be
collapsed
. And if you tap back on the map it becomes
hidden
. And this support is in the bottom sheet when not using Jetpack Compose.
View count: 10