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

    Maciej S

    11/30/2022, 11:49 AM
    Hey people, have a question about sealed interfaces and stability/skippability 🧵
    z
    l
    • 3
    • 9
  • a

    Abdul Moeed

    11/30/2022, 12:59 PM
    Hi everyone, I currently have a list of objects stored in my ViewModel state which has paths of videos for e.g. [{"filename1.mp4", [00:05:00, 01:15:00]}, {"filename2.mp4", [00🔟00, 00:25:00]}]. How can I play one video after another using Compose?
    t
    z
    z
    • 4
    • 5
  • t

    Tower Guidev2

    11/30/2022, 3:02 PM
    Hi i am struggling to understand the lifecycle of my viewmodels within my current android jetpack compose application
    z
    i
    • 3
    • 19
  • t

    thelumiereguy

    11/30/2022, 6:37 PM
    Snapshot.withMutableSnapshot {
     itemList.forEach { item -> _messagesStateMap[someIndex] = item }
    }
    Would this be a proper usecase for Snapshot? I dont want to trigger UI Update on every iteration of the loop So, with this, I guess it’ll only trigger update after the
    apply
    is called. What do you guys think?
    a
    z
    • 3
    • 3
  • w

    Wishnuprathikantam

    12/01/2022, 5:37 AM
    How do I make a composable opaque? The composable doesn;t consume click events but the underlying composable can consume the events when they are in a box. For example in a flutter app, we can use IgnorePointer on a widget to make it opaque. Looking for something similar in jetpack compose.
    r
    • 2
    • 6
  • e

    eygraber

    12/01/2022, 8:54 AM
    I'm seeing an issue where
    AnimatedVisibility
    runs an
    EnterTransition
    of
    slideInHorizontally
    twice in some scenarios. Anyone else seeing anything like this - https://issuetracker.google.com/issues/260870116
  • e

    Eko Prasetyo

    12/01/2022, 9:46 AM
    Hi everyone, how can I refresh/call method on my previous screen after I pop/navigate up on my second screen? I did something similar before, but in Flutter:
    Navigator.of(context).push(...).then(*do something after pop()*)
    How can I do this in Compose navigation?
    i
    • 2
    • 2
  • v

    Vaios Tsitsonis

    12/01/2022, 11:40 AM
    Hello! Is it possible to use the old navigation component and as a destination declare a fragment that uses the compose navigation component? I was thinking about implementing the new features like that in order to start implementing compose nav graphs before being fully migrated but it seems that it does not work...
    • 1
    • 2
  • o

    oday

    12/01/2022, 12:56 PM
    private val locationFilter =
        BrowseEventsFilter.LocationFilter(location = MutableStateFlow(null))
    
    private val categoryFilter =
        BrowseEventsFilter.CategoryFilter(category = MutableStateFlow(null))
    
    private val periodFilter = BrowseEventsFilter.PeriodFilter(
        period = MutableStateFlow(Period.Any),
        dateRange = MutableStateFlow(null)
    )
    
    val filtersState = MutableStateFlow(
        listOf(
            periodFilter,
            locationFilter,
            categoryFilter
        )
    )
    
    viewModelScope.launch(<http://dispatchers.io|dispatchers.io>) {
    
                filtersState.collect {
    and in the activity
    val filtersState by browseEventsViewModel.filtersState.collectAsState()
    is this not enough to guarantee a recomposition if something inside filterState changes?
    s
    • 2
    • 1
  • k

    K Merle

    12/01/2022, 2:15 PM
    I have a Scaffold TopBar element, and containerColor is primary color. When I set my action to be TextButton, that button has same primary color as TopBar container. How do I approach this so my TextButton has actually different traits (text and ripple effect to be onPrimary color)?
    p
    • 2
    • 2
  • f

    Fidriyanto Rizkillah

    12/01/2022, 8:14 PM
    Hello, is it possible to use compose paging on a stacked card (like tinder)? So when the user swipe the card, it should behave like when user scroll on LazyPaging items. Its already working fine on LazyColumn with paging items, but when I use Box and forEach to stack the card, the paging did not trigger the load next page function
  • j

    james

    12/01/2022, 9:46 PM
    I remember in the earlier days of Compose seeing a bunch of sample apps with a
    Scaffold
    at (or near) the top of their hierarchy, meaning each individual “screen” was wrapped by one “grandparent” Scaffold, which meant you would have a single source of controlling a drawer layout and a snackbar host. These days I don’t see that pattern as much, and the pattern is more like one Scaffold for each screen. Which of these is the recommended way of doing things? My guess is the second one (many Scaffolds) is the way but I wanted to hear thoughts from others 🙏
    s
    f
    +2
    • 5
    • 5
  • a

    Andre Theilacker

    12/01/2022, 10:10 PM
    Is there a viable way to make an item in LazyColumn fill the available space when the list does not fill all of the screen? With the following Arrangement implementation I was able to make a LazyColumn place the last item either at the middle of the available space or at the end (if the list is larger than the screen):
    @Stable
    object TopLastAtMiddleArrangement : Arrangement.Vertical {
    
        override fun Density.arrange(
            totalSize: Int,
            sizes: IntArray,
            outPositions: IntArray
        ) {
            var currentOffset = 0
            sizes.forEachIndexed { index, size ->
                if (index == sizes.lastIndex) {
                    val remaining = totalSize - currentOffset - size
                    outPositions[index] = if (remaining > 0) (remaining / 2) + currentOffset else currentOffset
                } else {
                    outPositions[index] = currentOffset
                    currentOffset += size
                }
            }
        }
    }
    I was hoping to make an implementation able to, when there is space, expand the given item to fill the gap. I was hoping to be able to do that by changing the sizes array, but that didn't seem to work. Any ideas/suggestions?
  • m

    Milo

    12/01/2022, 10:37 PM
    how to show the keyboard immediately when a screen is opened with Jetpack Compose and kotlin?
    a
    • 2
    • 1
  • i

    Issa

    12/01/2022, 11:48 PM
    Hi everyone! Is there a way or a resource I could refer to in order to achieve a side effect on a lazyrow when an item is scrolled? • The side effect should be only executed only if the current
    firstVisibleItemIndex
    after scroll is different than before • The side effect should not be executed the item is not fully scrolled I am implementing a fullscreen lazyrow items with a snap behavior Thanks!
    • 1
    • 1
  • a

    Android75

    12/02/2022, 5:25 AM
    Hi i can delete TextField padding, i am using a OutlinedTextField
    i
    m
    • 3
    • 9
  • s

    Shridhar Goel

    12/02/2022, 7:37 AM
    What is the best way to measure the performance of a composable and get the data from the user base using Firebase traces (and not just tracing on our own device(s)) ? The main question here is about where to start the trace and where to stop it.
  • c

    chanjungskim

    12/02/2022, 8:05 AM
    I have this composable function, and how can I preview this??
    @Composable
    fun NutritionalBalanceRoute(
        viewModel: NutritionalBalanceViewModel = hiltViewModel()
    ) {
        Column(
            modifier = Modifier.fillMaxSize(),
            verticalArrangement = Arrangement.Center,
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Text(
                text = "Nutrition",
                style = MaterialTheme.typography.headlineMedium
            )
        }
    }
    h
    • 2
    • 6
  • c

    chanjungskim

    12/02/2022, 8:07 AM
    I tried with
    @Preview
    @Composable
    fun PreviewNutritionalBalanceRoute(){
        val viewModel = hiltViewModel<NutritionalBalanceViewModel>()
        Surface {
            NutritionalBalanceRoute(viewModel)
        }
    }
    but it didn't work.
    t
    • 2
    • 1
  • t

    Tin Tran

    12/02/2022, 9:42 AM
    Is there an easy way to add custom
    TextDecoration
    to compose text? I’d like to have a dashed underline. It seems like I have to go down deep into the text painter and customize it….
    o
    • 2
    • 3
  • t

    timrijckaert

    12/02/2022, 11:22 AM
    Consider following
    Composable
    .
    Box(
        modifier = Modifier
            .size(100.dp)
            .background(Color.Blue)
            .clickable {
                // parent click listener
                Timber.d("parent click")
            }
    ) {
        Box(
            modifier = Modifier
                .size(50.dp)
                .background(Color.Red)
        ) {
            // children
        }
    
        // ...
    }
    When clicking on the red
    Box
    the parent
    Composable
    consumes the click event even though the red box is in front of it. This looks like a weird default behavior to be. Different from the
    View
    system.... However when the red
    Box
    has a click listener of its own the behavior is correct and the red
    Box
    click listener is triggered. Is there a better way to let the red
    Box
    consume the event without putting an explicit
    clickable
    modifier on it?
    s
    l
    • 3
    • 2
  • e

    Elio Maroun

    12/02/2022, 12:36 PM
    Can 2 views share the same viewmodel without loosing the state, so both can mutate it?
    i
    m
    t
    • 4
    • 5
  • c

    Csaba Szugyiczki

    12/02/2022, 12:43 PM
    Accessibility related question I am working on a mobility app in which we have a
    Column
    listing nearby Stops. These Stop items show which Lines stop there. When Talkback reaches the Lines, I want it to add a prefix before starting to read out the line numbers which says “Departs from here: ” and then the line numbers, so in the screenshot it would read the name of the stop, then the distance from the stop and then: “Departs form here: bus 231, night bus 973, night bus 996, night bus 996A” Currently I am adding a 1x1 Spacer before the Green box (which is a Column in my code) with the
    contentDescription
    set to “Departs from here: ” but it feels like a nasty hack. Is there a better way to add a prefix to a group of elements?
    j
    d
    a
    • 4
    • 18
  • z

    zsperske

    12/02/2022, 9:43 PM
    Hello all, I just filed this bug (https://issuetracker.google.com/issues/261078350) regarding a crash that occurs when placing an
    AbstractComposeView
    inside of a
    BottomSheetDialog
    (from the material design library). Wondering if anyone else has run into this before & found a solution. Error starts with:
    java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from android.widget.FrameLayout
    i
    • 2
    • 16
  • a

    Arjan van Wieringen

    12/03/2022, 11:24 AM
    I am looking at the Tivi repository (chrisbanes/tivi) and notice that they use a Mutex to update a MutableStateFlow. Isn't it the case that MutableStateflow.update is already threa-safe?
    y
    • 2
    • 1
  • m

    Mehdi Haghgoo

    12/03/2022, 4:47 PM
    What is the difference between LaunchedEffect(Unit) and LaunchedEffect(true)?
    h
    r
    t
    • 4
    • 3
  • a

    AloneWalker

    12/04/2022, 8:20 AM
    Should I use multiple states per screen like this:
    private var screenState by mutableStateOf(ScreenState())
    private var dialogOneState by mutableStateOf(DialogOneState())
    private var lazyColumnState by mutableStateOf(LazyColumnState())
    or only one?
    c
    c
    • 3
    • 4
  • k

    KotlinLeaner

    12/04/2022, 10:26 AM
    Is kover provides coverage in jetpack compose ?
    c
    • 2
    • 2
  • m

    Mehdi Haghgoo

    12/04/2022, 11:48 AM
    Is it an expected behavior that Live Edit is invoked when some KDoc block is edited? It has no effect on the behavior and still imposes high resource consumption.
    a
    • 2
    • 1
  • k

    Karthick

    12/04/2022, 1:08 PM
    Somebody can suggest me, how to achieve this layout transition. Card need to move from
    Box
    to
    Row
    . I was able to shrink and slide it diagonally with AnimatedVisibility. But how to move it into the Row?. Video sample in thread. 🧵
    p
    • 2
    • 2
Powered by Linen
Title
k

Karthick

12/04/2022, 1:08 PM
Somebody can suggest me, how to achieve this layout transition. Card need to move from
Box
to
Row
. I was able to shrink and slide it diagonally with AnimatedVisibility. But how to move it into the Row?. Video sample in thread. 🧵
Screen Recording 2022-12-04 at 6.23.05 PM.mov
p

PHondogo

12/04/2022, 6:24 PM
https://betterprogramming.pub/exploring-movablecontentof-in-jetpack-compose-6807a43047cd
View count: 2