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

    Jasmin Fajkic

    11/04/2022, 8:18 PM
    Hey peeps. I lost all day trying to make something with annotated clickable text. I get from server this data model:
    "title": {
    					"text": "{0} shared a feeling",
    					"actions": [
    						{
    							"text": "Sara+021122",
    							"action": "test1",
    							"id": "9f714870-1c79-4398-ab0e-0b699d39606f"
    						}
    					],
    					"badgeName": "mood-level-4"
    }
    and now i need to construct from this : “Sara+021122 shared a feeling” where Sara+021122 is clickable part of text. More in 🧵
    o
    c
    • 3
    • 10
  • a

    andrew

    11/05/2022, 12:04 AM
    There was a pattern I saw someone post on twitter using composable fns with invokable enums a while back, I think they extended it to use sealed interfaces and such which was pretty cool. Does anyone still know where I can find it to reference it?
    s
    • 2
    • 10
  • s

    ste

    11/05/2022, 7:16 AM
    When
    detectVerticalDragGestures
    and
    detectHorizontalDragGestures
    overlap (i.e. they belong to different composables, but share the same touch source), how I can dispatch events to
    detectHorizontalDragGestures
    only when the drag is very horizontal? When scrolling with our thumb, vertical swipes tend to be detected as horizontal ones (images in thread)
    a
    j
    • 3
    • 14
  • p

    PHondogo

    11/05/2022, 6:34 PM
    Hello! Who can point to any library for vizualizing graph data with 2 dimension scrolling?
  • n

    nlindberg

    11/05/2022, 10:54 PM
    Whats the best way to convert composables into bitmaps? Want to create custom bitmaps to add as map markers that include some text and layout depending on data. I know how to do it the “non-compose” way, but would like all my UI code to be compose.
    n
    k
    • 3
    • 3
  • y

    yogaboy

    11/06/2022, 3:12 PM
    M3 Alert - M3 says - we use tonal enhancement for elevation. I know how to achieve automatic elevation of the TopAppBar when scrolling. But the question is: How to achieve the connection of the TopAppBar elevation with the StatusBar? I use the accompanist library to change the color of the appBar. it has to be done somehow. 🤔 Because that’s how Gmail works. When scrolling, the tonal elevation of the appBar changes along with the TopAppBar. 1. TopAppBar Gmail with scroll position …. 2. My App with No scroll position 3. My App after scrolled
    s
    m
    • 3
    • 11
  • a

    andrew

    11/07/2022, 3:38 AM
    🧵 Is there any reason why the invoke operator in a sealed interface with inheritance doesn’t work?
    e
    k
    • 3
    • 46
  • h

    Hasan Nagizade

    11/07/2022, 4:28 AM
    if when composable recomposes everything gets recreated inside that composable where should I keep reference to my viewmodel?
    p
    • 2
    • 4
  • d

    Dilraj Singh

    11/07/2022, 8:42 AM
    I am facing a weird issue where composable block only gets the latest state from a state flow. Suppose I change state from
    A->B
    and
    B->C
    in succession, then the composable function will only get the update of state as
    C
    , it will never get the state
    B
    , whereas in every other place if I collect the state flow, then I will get 2 state updates,
    B
    and
    C
    . Is this an intended behaviour or some bug? Code attached in thread.
    s
    p
    • 3
    • 10
  • c

    Christoph Wiesner

    11/07/2022, 9:51 AM
    i have an UI for assigning a UserRole. the list of user roles is queried from the DB (flow) and exposed as a uiState in the ViewModel. the selected role is a mutable state
    private var currentRoleSelection = mutableStateOf<UserRole>(null)
    i want to have a initial selection for
    currentRoleSelection
    (let's say the first role in the list) but i have to wait for the userRoles to be queried from the DB
    val uiState: StateFlow<UiState> = combine(   
       userRoles, // Flow<UserRole>
    //other flows,
       snapshotFlow { currentRole }
    ) { ... -> }
    how would i set the mutableState once the DB roles are queried? do i need to "convert" that userRoles to a state as well in order to use sth like
    derivedStateOf{}
    ?
  • a

    Abhijeet Kumar

    11/07/2022, 10:14 AM
    Hey guys, I'm facing a repetitive memory leak in compose. I figured this might be related to AutoFill Framework where I'm using onGloballyPositioned modifier in the following way, here's the full heap dump : https://pastebin.com/raw/pA5wawTs . Could this be internal leak or am I missing something here?
  • t

    Tower Guidev2

    11/07/2022, 1:41 PM
    Hi i am having difficulty with jetpack compose navigation when dealing with hierachical navigation i believe i require multiple NavHosts one for all my top level screens and another nav host to allow me to navigate to the lower level screens in the process of navigating down the hierachy i wish to replace the main toolbar with a simple toolbar that only displays the Up arrow can anyone point me at some example code to assist my please with this endeavor 😄
  • i

    iroyo

    11/07/2022, 3:19 PM
    I want to achieve a “dynamic” height LazyVerticalGrid meaning the height of one item in the row determines the height of the rest to avoid the effect of the image. The only “clean” way is to ditch the Grid and make a LazyColumn with a Row as each item?!! I know the other option would be to hard code the same height for every item in the grid, but that would produce (maybe) an unwanted space between rows. The code to produce the example is simple but it’s added in the thread
    r
    • 2
    • 10
  • m

    Marco Pierucci

    11/07/2022, 4:36 PM
    Will there be an accompanist version for 1.4.0-alpha01 or are this meant to be supported only from beta version and above?
    b
    • 2
    • 2
  • z

    Zun

    11/07/2022, 5:26 PM
    When using Paging3 and a LazyColumn, I lose my scroll position upon phone rotation when my LazyColumn starts with an`item` before displaying my actual paging content Is there a proper fix for this? See thread for more info
    t
    i
    • 3
    • 7
  • a

    Arjan van Wieringen

    11/07/2022, 6:38 PM
    I’ve an architectural question. I like working with the InteractionSource when I need to do complex event management between different composables. I prefer it over multiple callbacks everywhere. I generally add new classes implementing a custom sub interface of Interaction and handle those events in the respective composables or view models. I’m not sure however if there are any big reasons against this or if it is “against” some compose guidelines.
    l
    • 2
    • 6
  • e

    enighma

    11/07/2022, 7:09 PM
    I want a clickable modifier to only capture clicks at certain areas of the component, and pass others through. Is there a best practice here?
    d
    • 2
    • 3
  • b

    Billy Newman

    11/07/2022, 8:39 PM
    Hello all. Wondering if anyone has tried and had success using a BadgeBox on a Navbar button? My badge overflows off the side of the navbar. Code and screenshot in comments.
    y
    • 2
    • 5
  • k

    Kai Zhu

    11/08/2022, 3:45 AM
    Is this piece of doc of
    BlendMode
    copied from Flutter’s? They are almost identical but Compose’s version lacks the example images, which makes this paragraph (in the red frame) confusing. If adding image links isn’t an option, maybe this paragraph can be deleted as an easy fix? I was confused and searched Google, then found the Flutter doc. This was the beginning of the story.
    r
    n
    • 3
    • 5
  • y

    Yashwant Gowla

    11/08/2022, 8:41 AM
    Hey folks, we have released a new custom library in Jetpack Compose for showcasing features in the app. Please hit a star if you like it! https://github.com/SimformSolutionsPvtLtd/SSComposeShowCaseView SSComposeShowCaseView is a customizable show case view library which allows to showcase/highlight the particular features of the application with an engaging overlay. It also provides automatic showcase view feature with customised delay and opacity attributes. Features • Simple rounded showcase view • Simple rectangle showcase view • Animated rounded showcase view • Animated rectangle showcase view • Automatic showcase view • Customise delay between showcase, background opacity
  • p

    Pardip

    11/08/2022, 11:18 AM
    Is there way to disableclose by swiping down on ModelBottomSheetLayout. I tried to take a look at the parameters that modifies the internal behaviour of the ModalBottomSheetLayout but the internal scaffold seems not to have the sheetGesturesEnabled or isSwipable or isDraggable boolean we were looking for. I found a sheetGesturesEnabled inside the BottomSheetScaffold object, but, as I said, I didn’t find a proper way to implement it.
    c
    • 2
    • 1
  • d

    dave08

    11/08/2022, 1:03 PM
    I haven't seen anything in the docs about when/if to use
    remember {}
    or
    mutableStateOf()
    inside state holders... or whether the one surrounding the object itself is enough....?
    p
    g
    s
    • 4
    • 9
  • g

    Gonzalo Renedo

    11/08/2022, 1:43 PM
    could someone help me understand why this happens in recomposition count? It happens to me in all apps, I think it's an android bug
    BasicStateCodelab – WaterCounter.kt [BasicStateCodelab.app.main] 2022-11-04 18-58-27.mp4
    r
    a
    • 3
    • 23
  • g

    Gonzalo Renedo

    11/08/2022, 1:44 PM
    when i do click, recomposition is uncontrolled
    n
    • 2
    • 1
  • t

    theapache64

    11/08/2022, 2:08 PM
    Can I mark my
    ViewModel
    as
    @Stable
    ? What wud be the conditions to do that? (learning about Compose Stability)
    d
    a
    • 3
    • 20
  • s

    Stylianos Gakis

    11/08/2022, 4:33 PM
    Is there any sample which uses movableContent while also receiving parameters? The official samples here don’t do that. I got issues with it still showing the parameters passed in the previous invokation, showing stale data and as a result and I wonder if I am misusing them somehow. a weird error message
    java.lang.ArrayIndexOutOfBoundsException: src.length=16 srcPos=12 dst.length=16 dstPos=11 length=-7
    (edit) Seems like movableContentOf + SubCompose still don’t play well with each other even after the 1.3 fix which should fix some of the problems this combo had.
    j
    s
    l
    • 4
    • 21
  • c

    Chris Fillmore

    11/08/2022, 7:13 PM
    Is there a “tri state switch” composable available? (I think no, but…) What are you using for this? To be clear I mean a Switch for which toggling triggers an action, the result of which determines the switch’s final state.
    k
    k
    • 3
    • 43
  • p

    PHondogo

    11/08/2022, 10:39 PM
    Hello! How to create programmaticaly such graph and handle tap/drag events on it's vertexes? (Count of vertexes and their titles is planned to pass as argument to composable function).
    d
    c
    m
    • 4
    • 12
  • l

    luke_c

    11/09/2022, 12:00 AM
    On a View based screen when I use
    ModalBottomSheetLayout
    in a
    ComposeView
    within the XML (child of a
    LinearLayout
    ) it crashes immediately unless I add it to the root of the View hierarchy with this error:
    java.lang.IllegalArgumentException: The initial value must have an associated anchor.
    Is this expected behaviour?
    c
    j
    • 3
    • 5
  • a

    aoriani

    11/09/2022, 1:26 AM
    is it possible with Jetpack Compose and Roboletric to test a scenario in which the back key is pressed ?
Powered by Linen
Title
a

aoriani

11/09/2022, 1:26 AM
is it possible with Jetpack Compose and Roboletric to test a scenario in which the back key is pressed ?
View count: 12