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

    Tash

    03/15/2021, 2:29 AM
    Trying to apply
    detectDragGestures
    to a Composable that wraps an
    AndroidView
    . It ends up glitching as shown in the GIF below. Should I file an issue, or am I doing something wrong? Code is here. Thanks in advance!
    h
    m
    • 3
    • 4
  • g

    gbaldeck

    03/15/2021, 3:24 AM
    is there any reason that a mutable state flow wouldnt cause a composable function to reload its state when the value of the state flow has changed? I'm running into an issue where I'm changing the value of a mutable state flow but the composable function that collects it as state is not receiving the update or doing a rerender
    a
    a
    +2
    • 5
    • 4
  • d

    Deepak Gahlot

    03/15/2021, 3:49 AM
    Hello, I'm using ActivityResults
    val registerTakeFile = registerForActivityResult(
        ActivityResultContracts.OpenDocument()
    and after updating to implementation "androidx.activity:activity-compose:1.3.0-alpha04" i'm getting an error
    Can only use lower 16 bits for requestCode
    j
    • 2
    • 8
  • s

    Samir Basnet

    03/15/2021, 6:34 AM
    Any idea how to add that vertical dash before text without extra composable?
    r
    j
    • 3
    • 2
  • s

    Samir Basnet

    03/15/2021, 7:26 AM
    Currently to shift focus to next textfield we have to write the logic manually, i was trying to create my own styled CustomStyledTextField composable to reuse it as form screen ,contains a lot of them but due to this focus logic being manual i find it hard to make resusable textfield . Is there an easy way or am i missing something?
    • 1
    • 1
  • u

    Utkarsh Tiwari

    03/15/2021, 11:19 AM
    I created a custom Popup to appear around the button that triggers it’s visibility. However, for the buttons at the buttom of the activity, the popup overlays the Android Navigation Bar. Also the elevation keeps increasing (apparent from the increasing shadow range) on moving down the screen. Does anyone know how to avoid it from covering the Navigation bar at the bottom and fix the elevation issue?
    • 1
    • 2
  • d

    Daniele B

    03/15/2021, 1:37 PM
    I having doubts about the Compose Navigation and Deep Linking. This is a simple master/detail app navigation. As you can see, I am loading the detail data, when clicking on a master list item. It works. But this wouldn’t work when deep linking to the detail screen, as it would show the DetailView without having loaded the data. Ideally, I would like to associate somehow the
    model.loadDetailData(it)
    call to the
    composable("detail/{item}")
    , but I can’t find a Compose API to do that. If I include the call inside the
    composable
    block, above
    DetailView
    , such call gets executed at each recomposition, creating a never-ending loop.
    @Composable
    fun Navigation(model: KMPViewModel) {
      val appState by model.stateFlow.collectAsState()
      val navController = rememberNavController()
    
      NavHost(navController, startDestination = "master") {
        composable("master") {
          MasterView(masterState = appState.masterState,
            onListItemClick = {
              navController.navigate("detail/$it")
              model.loadDetailData(it)
            }
          )
        }
        composable("detail/{item}") {
          DetailView(detailState = appState.detailState)
        }
      }
    
    }
    what is the right way to make it work with deep linking?
    i
    b
    • 3
    • 17
  • j

    julioromano

    03/15/2021, 1:54 PM
    Weird scrolling issue when using
    AndroidView
    in
    sheetContent
    of a
    BottomSheetScaffold
    Please see the example code and video showing the bug in the thread.
    ✅ 1
    h
    m
    c
    • 4
    • 7
  • r

    Rick Regan

    03/15/2021, 2:07 PM
    I have a
    Text
    that gets recomposed even though its value is not based on mutable state. In particular, this happens when I include it in another composable that has a
    Slider
    with its own mutable state, and it doesn't happen when I put it in a separate composable (see thread for code). I know we're not supposed to depend on when recomposition happens or doesn't happen; I'm just trying to understand how Compose works (and avoid bugs that are hidden until code is refactored :) )
    z
    • 2
    • 14
  • e

    escodro

    03/15/2021, 2:39 PM
    Hello, everyone! 😊 Im having some questions about my implementation. Could you help me please? Basically I’m trying to create a new
    State
    wrapping the default
    ModalBottomSheetState
    and one
    State
    I created to handle which content should be shown for the user. The implementation is on the comments and I need help to understand if I’m correctly saving the
    State
    in order to use
    rememberSaveable
    with it. (It is working as expected, but I’m a little afraid of my “inner remember” inside the
    Saver
    😬) Thanks a lot in advance! ❤️
    • 1
    • 1
  • d

    Denis

    03/15/2021, 2:52 PM
    Is it a known problem with theming in
    beta02
    ? My app can switch from light to dark, but not back. And I can't understand what happened with it. It worked before beta02. https://kotlinlang.slack.com/archives/CJLTWPH7S/p1615651080120600
    l
    • 2
    • 4
  • z

    Zach Klippenstein (he/him) [MOD]

    03/15/2021, 2:56 PM
    New compose-backstack release is out: https://twitter.com/zachklipp/status/1371475164836196352?s=20
    🎉 8
    🔥 5
    s
    • 2
    • 6
  • d

    Daniel Candeias

    03/15/2021, 4:30 PM
    How can I have custom bullet point (color and size customisable), followed by multiline text, with bullet point aligned to first line? Something like this 👇 • This is a very long text which does not fit in one line
    ✅ 1
    z
    h
    • 3
    • 8
  • s

    Shawn Tucker

    03/15/2021, 5:24 PM
    Is there a way to lock DrawerState open in compose?
    m
    a
    • 3
    • 8
  • o

    oday

    03/15/2021, 7:37 PM
    I’m not sure how to refactor this code into the new SideEffect API’s which replace onCommit/onDispose as of alpha11
    @Composable
    internal fun Handler(
        enabled: Boolean = true,
        onBackPressed: () -> Unit
    ) {
        val dispatcher =
            (AmbientBackPressedDispatcher.current ?: return).onBackPressedDispatcher
    
        val handler = remember { ComposableBackHandler(enabled) }
    
        onCommit(dispatcher) {
            dispatcher.addCallback(handler)
    
            onDispose { handler.remove() }
        }
        onCommit(enabled) {
            handler.isEnabled = enabled
            handler.onBackPressed = onBackPressed
        }
    }
    the
    onCommit
    and
    onDispose
    methods are now unresolved, not sure what to replace them with or how
    i
    n
    • 3
    • 6
  • d

    Dylan

    03/15/2021, 8:09 PM
    What's the best way to know the scroll direction of a LazyColumn? I'm currently using a LazyListState, and by keeping a reference of the last value of
    firstVisibleItemScrollOffset
    from LazyListState, I can compare it to the current value so if
    lastOffset
    is lower than
    firstVisibleItemScrollOffset
    , that means the user is scrolling down, however if
    lastOffset
    is higher than
    firstVisibleItemScrollOffset
    , that means the user is scrolling up. At least that's the result I was hoping for but unfortunately
    firstVisibleItemScrollOffset
    is often equal to
    lastOffset
    . So what is the best way to know the scroll direction of a LazyColumn? 🤔 (What I would like to achieve is similar to what we used to do with the XML Toolbar View using app:layout_scrollFlags)
    j
    a
    c
    • 4
    • 4
  • t

    Tim Malseed

    03/16/2021, 2:02 AM
    Hey all, I've got a bit of a code design problem, to do with holding observable state in a ViewModel, to be consumed by Composable functions..
    d
    a
    z
    • 4
    • 30
  • k

    Klaas Kabini

    03/16/2021, 3:55 AM
    Can someone explain to me how does nested navigation work in compose
    n
    • 2
    • 2
  • n

    Nathan Castlehow

    03/16/2021, 4:30 AM
    Hi, I have some values that are provided to my view model as a
    MutableStateFlow
    . I then want to “proxy” these through my view model to the view and expose them as something that the view can bind to. I want to avoid exposing them to the view as flows and then calling
    collectAsState
    inside the view as i want to keep most things inside the view model.
    a
    z
    • 3
    • 53
  • j

    Jason Ankers

    03/16/2021, 5:06 AM
    Followup question to a discussion a while back: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1614609620302500?thread_ts=1614345603.389700&cid=CJLTWPH7S What would be the best way to collect a cold data source like this (scoped to the composable), but also keep a reference to it in the viewmodel? The viewmodel needs to keep a reference because we keep a bunch of
    derivedStateOf
    business logic inside it
    a
    • 2
    • 2
  • r

    Rafs

    03/16/2021, 8:06 AM
    How do I draw behind the status bar like this?
    j
    j
    +2
    • 5
    • 6
  • d

    Deepak Gahlot

    03/16/2021, 8:45 AM
    Is there a way we can remove this default padding before the Text Cursor in Jetpack Compose
    c
    l
    • 3
    • 4
  • j

    julioromano

    03/16/2021, 8:50 AM
    Has anyone affected by https://issuetracker.google.com/issues/182387688 found a workaround? It seems to me this pretty much makes
    AndroidView
    useless in 99% of its use cases.
    ✅ 1
    😞 2
    🇳🇴 1
    m
    c
    • 3
    • 7
  • f

    fabio.carballo

    03/16/2021, 9:05 AM
    how could one anchor one view to be displayed on other? for example, anchoring a snackbar above a FAB?
    :thank-you: 1
    u
    c
    • 3
    • 2
  • g

    Geert

    03/16/2021, 9:33 AM
    2021-03-16 10:31:43.170 21227-21227/? E/AndroidRuntime: FATAL EXCEPTION: main
        Process: app.medxpert.medxpert, PID: 21227
        java.lang.ArrayIndexOutOfBoundsException: length=0; index=-5
            at androidx.compose.runtime.SlotTableKt.key(SlotTable.kt:2531)
            at androidx.compose.runtime.SlotTableKt.access$key(SlotTable.kt:1)
            at androidx.compose.runtime.SlotReader.groupKey(SlotTable.kt:619)
            at androidx.compose.runtime.ComposerImpl.end(Composer.kt:2065)
            at androidx.compose.runtime.ComposerImpl.endGroup$runtime_release(Composer.kt:1462)
            at androidx.compose.runtime.ComposerImpl.endRoot(Composer.kt:1147)
            at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:2602)
            at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:348)
    :thread-please: 9
    o
    • 2
    • 2
  • g

    Geert

    03/16/2021, 9:33 AM
    I have this error when I download the App from the Google Play Store, but not when I start it from Android Studio. Can someone explain me what is wrong? I don’t understand it. I think it has something to do with LazyColumns. Since they are used where it crashes. It occurs on beta01 and beta02… I am not using any Dialogs like the other examples with this error.
    f
    • 2
    • 1
  • h

    Hatice Sarp

    03/16/2021, 11:05 AM
    I upload the file with workmanager. I want to observe the workmanager progress and show file upload progress in ui. I also update the progress variable with the high order function. The problem is my screen is constantly recomposed. I see that the progress suddenly reaches 100. In the following example in WorkManager codelab, it is done with viewbinding(https://developer.android.com/codelabs/android-adv-workmanager#4) How can I update progress bar on ui according to the progress of worker in workmanager ?
    h
    t
    i
    • 4
    • 7
  • a

    Arun

    03/16/2021, 11:54 AM
    Do we have to implement the error text ourselves or does
    OutlinedTextField
    include it somewhere?
    t
    c
    • 3
    • 6
  • m

    Mjahangiry75

    03/16/2021, 1:24 PM
    I am using a
    WebView
    inside an
    AndroidView
    and it's so heavy, while it works smoothly in traditional way see the code in thread
    a
    • 2
    • 7
  • o

    oday

    03/16/2021, 2:30 PM
    also why does this happen? it seems ultra straightforward and should work ..
    • 1
    • 1
Powered by Linen
Title
o

oday

03/16/2021, 2:30 PM
also why does this happen? it seems ultra straightforward and should work ..
ok wrong import
View count: 1