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

    PHondogo

    08/15/2021, 4:11 PM
    How can i outline composable with label on top left on line like OutlineTextField do?
    c
    • 2
    • 2
  • c

    Colton Idle

    08/15/2021, 5:41 PM
    I'm using compose material navigation so that I can navigate to a bottom sheet destination. It works great, except on a single composable screen where I have
    BackHandler { myLambda() }
    Even though the bottom sheet is showing, my backHandler still get triggered. What's the "right" way to prevent this?
    b
    i
    • 3
    • 26
  • f

    Florian

    08/15/2021, 6:44 PM
    Should I use
    deriveStateOf
    to calculate
    statisticsFoTask
    or is that not the correct approach?
    @Composable
    private fun TaskWithStatisticsList(
        tasks: List<Task>,
        taskStatistics: List<TaskStatistic>,
        onTaskDetailsClicked: (Task) -> Unit,
        modifier: Modifier = Modifier
    ) {
        LazyColumn(
            contentPadding = PaddingValues(bottom = 50.dp),
            modifier = modifier
        ) {
            items(tasks) { task ->
                val statisticsForTask = taskStatistics.filter { it.taskId == task.id }
                TaskWithStatisticsItem(
                    task = task,
                    statistics = statisticsForTask,
                    onTaskDetailsClicked = onTaskDetailsClicked
                )
                Divider()
            }
        }
    }
    d
    z
    c
    • 4
    • 25
  • m

    Mehmet Peker

    08/15/2021, 9:21 PM
    Hello everyone.Is anybody has code example of using admob banner?
    s
    • 2
    • 1
  • c

    Can

    08/16/2021, 9:15 AM
    Is there any idea when https://issuetracker.google.com/issues/149691127 might be in progress?
    t
    z
    • 3
    • 3
  • m

    MaxUt

    08/16/2021, 9:21 AM
    Is it possible to modify the background color and bar color of the bottom control section? I'm using a Pixel 4a.
    c
    l
    +2
    • 5
    • 4
  • c

    carbaj0

    08/16/2021, 10:10 AM
    com.google.accompanist:accompanist-pager:0.16.1
    , question: how can i implement a listener triggered when change of page?
    c
    k
    • 3
    • 4
  • p

    Pedro Joya

    08/16/2021, 10:11 AM
    Is there a way in compose to give focus to the same textfield that had it after a configuration change?
    👍 1
    a
    • 2
    • 1
  • r

    RE

    08/16/2021, 10:42 AM
    Is there a fastscroll feature for LazyColumn?
    d
    • 2
    • 3
  • m

    MaxUt

    08/16/2021, 11:39 AM
    I'm trying to create Card shadows using drawWithContent but I cannot figure out how to draw rectangles around my content. Is there a way to do so ? I've tried using offsets but the rectangles get cropped. (I don't want to use the standard shadow modifier as we don't have control over the spread and blur)
    t
    • 2
    • 2
  • z

    ziv kesten

    08/16/2021, 12:08 PM
    I have a list with expandable items, when I click on the last item I would like the list to scroll up and show the expanded item, how can I achieve that?
    ➕ 1
    n
    d
    r
    • 4
    • 9
  • c

    Colton Idle

    08/16/2021, 3:21 PM
    Has anyone created (or found) a material dropdown replacement for compose?
    a
    l
    l
    • 4
    • 6
  • d

    dimsuz

    08/16/2021, 4:52 PM
    If I have a component which is inside a
    Row
    of `Button`s and then in some situations I pass it
    fillMaxWidth
    modifier and I want buttons to expand equally inside it, but if no
    fillMaxWidth
    modifier is used on that component I want them to behave like "wrap content" would, i.e. be of their inrinsic width. Is this possible to achive easily or should I pass some kind of custom parameter to my component for it to change layout accordingly?
    c
    c
    • 3
    • 8
  • j

    Justin Yue

    08/16/2021, 5:24 PM
    I have a camera screen whose preview used to work but unfortunately hasn't since the update to stable artic fox for some reason. Code in the thread
    c
    n
    • 3
    • 16
  • b

    brandonmcansh

    08/16/2021, 8:28 PM
    Hey I was curious if any one had drag-n-drop working for a
    VerticalGrid
    or a
    LazyVerticalGrid
    ? I see some examples of it working using LazyListState for a Column, but none for a grid
    👀 1
    d
    • 2
    • 1
  • c

    Colton Idle

    08/16/2021, 8:44 PM
    I'm trying to define a ViewModel that accepts a navigation lambda as such
    @HiltViewModel
    class MyScreenViewModel
    @Inject
    constructor(var navEvent: (String) -> Unit)
    which makes sure that this navEvent is passed in.
    fun MyScreen(viewModel: MyScreenViewModel = hiltViewModel(//how do I pass something in))
    Is there an easy way to pass in a lambda? I've passed arguments into viewModels with compose before but hiltViewModel did all the heavy lifting and exposed the argument via savedStateHandle. Can I somehow pass this lambda into my savedStateHandle? I'd be okay with that.
    i
    k
    • 3
    • 4
  • z

    zhagnfei

    08/17/2021, 2:32 AM
    why use much top-level function in compose?
    f
    z
    • 3
    • 2
  • n

    Nathan Castlehow

    08/17/2021, 3:16 AM
    Hi All, Wondering if anyone has thoughts on the best way to reserve space based on textSize (width wise)? Current use case is I have an area I which could have 0 to N characters in it (in reality itll be just 1,2, or 3 characters). I want the space to always be wide enough for the N characters based on the users current fontscale settings? My understanding is that it really depends on the font as to how much width each character will take?
    c
    h
    • 3
    • 8
  • n

    Napa Ram

    08/17/2021, 8:01 AM
    HI Everyone can you please suggest me, how can i achieve the background as per below image, like in starting for 1 dp i want to set black color and then Gray color
    d
    • 2
    • 3
  • r

    rajesh

    08/17/2021, 9:38 AM
    How can we attach ViewModel to specific composable using Hilt? VM should be removed when that composable screen is remvoed.
    c
    i
    • 3
    • 3
  • c

    Chachako

    08/17/2021, 9:39 AM
    See what I found: Add RenderEffect API, this makes me a little excitement 🙌. I also saw the
    desktop
    support the same effect by skija, then is it possible to be compatible with the version below
    android 12
    (eg, through RenderScript or Vulkan)?
    ➕ 1
    🎉 1
    m
    n
    s
    • 4
    • 30
  • a

    Anastasia Rozovskaya

    08/17/2021, 10:13 AM
    Hello! I rewrote logic of MaterialTheme and the app doesn’t use colors from dark theme when it is in dark theme. For example, in code I use it like
    modifier = Modifier(background = AppTheme.colors.background)
    but in dark theme it shows background color for light theme. Here is a theme implementation
    AppColors.kt
    https://gist.github.com/llama-0/9b92e8eed30fe65bbdc3b47bf57a1a49
    AppTypography.kt
    https://gist.github.com/llama-0/99f58df22ae9dbb8adb55dea410136c0
    AppTheme.kt
    https://gist.github.com/llama-0/4c65f4aa7fdccf8b35ca089f6b30fac1 Any thoughts?
    g
    • 2
    • 3
  • r

    rsktash

    08/17/2021, 10:48 AM
    [Solved] I'm trying to animate IME insets of bottom sheet via accomponiat lib. But I see strange behavior while animating
    Screen_Recording_20210817-154531_Bekachim.mp4
    c
    • 2
    • 2
  • e

    elye

    08/17/2021, 11:30 AM
    Hi, I wonder if we can have Composable Function in created in another library and use it from the MainApp? When I did that, and as I access the composable function, it crashes. Maybe I miss out some step needed to setup the library? I have reported this issue on StackOverflow too with the design replicating the issue. https://stackoverflow.com/questions/68816470/for-jetpackcompose-can-we-create-our-composable-function-in-another-library
    s
    c
    a
    • 4
    • 5
  • f

    Florian

    08/17/2021, 12:01 PM
    How can I use lazy loading inside a dropdown menu?
    c
    • 2
    • 2
  • d

    david.bilik

    08/17/2021, 12:51 PM
    Hey, I’m trying to use
    navigation-compose
    with viewmodels scoped to
    NavBackStackEntry
    to pass complex parcelable arguments since it’s not possible natively from list to detail screen. It works fine but when I press button it looks like the detail screen is “requested” again in
    composable
    call but the previous back stack entry is null. Details in 🧵
    👀 1
    c
    i
    s
    • 4
    • 24
  • b

    brandonmcansh

    08/17/2021, 1:57 PM
    Does anyone know where this falls in the roadmap? https://issuetracker.google.com/issues/193263965
    c
    t
    • 3
    • 18
  • m

    mattinger

    08/17/2021, 3:05 PM
    I’ve been starting to play with the compose version of NavController. I’ve got a basic drawer menu working, but it makes me wonder if there’s an equivalent of the “<action>” tag when building a NavController via composables. The nice thing about the “<action>” tag is that it makes a clearly defined graph and lays out where you can go from any given destination. I’m not seeing that in the documentation for navigation with compose (https://developer.android.com/jetpack/compose/navigation)
    i
    • 2
    • 9
  • d

    dimsuz

    08/17/2021, 4:18 PM
    Is there a reported bug for lost keyboard sync? I have a simple
    TextField
    and if I type few words in it and then press and hold Backspace on hw keyboard, in the end cursor goes out of sync and few symbols remain. Same thing happens in "forward" mode: if I type really fast.
    ➕ 4
    c
    c
    a
    • 4
    • 4
  • d

    Deepak Gahlot

    08/17/2021, 4:54 PM
    Hello All, I have been struggling with
    java.lang.IllegalArgumentException: SavedStateProvider with the given key is already registered
    I'm trying to launch the file explorer for the user to pick a file, and then when the user clicks to return back to the compose screen . I'm getting this error, this was not there before not sure what has changed
    c
    • 2
    • 5
Powered by Linen
Title
d

Deepak Gahlot

08/17/2021, 4:54 PM
Hello All, I have been struggling with
java.lang.IllegalArgumentException: SavedStateProvider with the given key is already registered
I'm trying to launch the file explorer for the user to pick a file, and then when the user clicks to return back to the compose screen . I'm getting this error, this was not there before not sure what has changed
Basically i have a Fragment which hold different jetpack compose navigation screens, and in one of the compose screen i have trying to launch the file explorer using
val registerTakeFile = rememberLauncherForActivityResult(
                ActivityResultContracts.OpenDocument()
            ) { uri ->}
when the user selects the file the exception is thrown. I'm using the same ViewModel across the screen and the fragment.
I guess this is also the same issue https://github.com/google/dagger/issues/2166
c

Colton Idle

08/18/2021, 1:52 AM
Can you possibly create a minimal sample github repo? I'll clone and take a look if I can help!
d

Deepak Gahlot

08/18/2021, 4:10 AM
Sure i will do that and share it here
View count: 5