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

    KotlinLeaner

    08/07/2022, 5:25 PM
    I am learning State hosting in jetpack compose. I am trying to separate my variable in single function and view logic to separate function. But I am getting weird issue in my code. Can someone guide me on this?
    z
    • 2
    • 20
  • k

    KotlinLeaner

    08/07/2022, 10:49 PM
    Another question, I am using compose 1.1.1 in my jetpack compose. I am getting error on my weight modifier. Can someone tell me how can I get my weight modifier in Row?
    c
    j
    • 3
    • 8
  • m

    Mehdi Haghgoo

    08/08/2022, 3:26 AM
    Why common Compose operations like clip and border allowing creation of shapes are not supported in the Android framework or are somehow hidden from the average developer?
    r
    a
    • 3
    • 6
  • r

    Roudy Korkis Kanaan

    08/08/2022, 4:21 AM
    Question about
    LazyLayout
    , I'm working on a lazy tiles based maps in Compose and using
    LazyLayout
    to lazily load the tiles as I scroll in both X and Y directions. The logic works well and I'm able to get the performance that I like. The only thing missing is prefetching/ pre-composing and measuring the out of bounds items. Looking at the
    LazyList
    implementation, it uses a modifier implementing
    ModifierLocalProvider<BeyondBoundsLayout?>, BeyondBoundsLayout
    , I am trying to do the same and applied to modifier to my
    LazyLayout
    but the
    layout
    function inside that implementation is never called. I know this is experimental, but any ideas on how to get the beyond bounds modifier to work ?
    s
    • 2
    • 3
  • a

    allan.conda

    08/08/2022, 7:54 AM
    👋 If there’s
    drawBehind
    to optimize animated background, is there an equivalent for animating alpha?
    f
    • 2
    • 2
  • l

    Luka

    08/08/2022, 8:13 AM
    I need to animate scale up image (and then scale down) and after this animation finishes, i need to change image drawable and change its tint color. Getting lost in so many options https://developer.android.com/jetpack/compose/animation#animatable. Please help
    j
    • 2
    • 4
  • z

    Zoltan Demant

    08/08/2022, 9:28 AM
    Is it possible to request focus to a (text field) composable without it showing the keyboard? Im using `FocusRequester.requestFocus`; code in 🧵
    • 1
    • 1
  • h

    harry248

    08/08/2022, 9:29 AM
    I am curious - are you doing optimizations like mentioned here: https://multithreaded.stitchfix.com/blog/2022/08/05/jetpack-compose-recomposition/? Especially unstable lambdas are something I've never thought about before.
    s
    • 2
    • 6
  • s

    Slackbot

    08/08/2022, 10:56 AM
    This message was deleted.
  • k

    K Merle

    08/08/2022, 1:59 PM
    How do you load a lot of items in
    ExposedDropdownMenu
    UI freezes for me if there are to many items.
    j
    s
    • 3
    • 9
  • o

    orangy

    08/08/2022, 2:20 PM
    Is it possible to get exact offset from
    TextLayoutResult
    , kinda like
    getOffsetForPosition
    but returning null, if there is no text at coordinates? E.g. if text is wrapped and second line is shorter, I would like to know if coordinates are over real text, or over blank part here ->
    h
    s
    • 3
    • 4
  • z

    Zac Sweers

    08/08/2022, 5:05 PM
    were all the submissions to
    #AndroidDevChallenge
    ever aggregated anywhere for future learning? I’m having a hard time trying to actually find all the cool projects people made
    c
    m
    • 3
    • 5
  • d

    Daniel Okanin

    08/08/2022, 6:05 PM
    Hi everyone! Im trying to count my onClick events in my composable function and overload this counter on callback. So I define var counter = remember{0} But this counter is reset always. I dont want to define the counter as remember{mutableSatateOf(0)} becuase by increase the counter I dont want to trigger recomposition. So how can I define remember parameter that not override by recompostion ?
    f
    s
    • 3
    • 9
  • h

    Harold Scissors

    08/08/2022, 7:39 PM
    What would be a good pattern for calling
    WebView.evaluateJavaScript()
    from Compose, when using UiModels from a ViewModel? The assumption being that the
    WebView
    is wrapped in an
    AndroidView
    • 1
    • 1
  • c

    CLOVIS

    08/08/2022, 7:39 PM
    Does anyone know when
    Abstract Composable functions cannot have parameters with default values
    will be fixed? Googling for it only returns one tweet with no answer…
    m
    • 2
    • 2
  • c

    Colton Idle

    08/08/2022, 8:51 PM
    I have an
    IconButton
    , with an
    Icon
    inside, but the icon is dark and so the dark touch ripple is kind of hard to see. Is there any way to inverse that somehow so the touch ripple brightens up the inner
    Icon
    ?
    l
    • 2
    • 15
  • k

    KotlinLeaner

    08/08/2022, 9:12 PM
    I have few doubt using viewmodel in composable function. I am adding my activity code, I am passing my intent bundle. 1. So I want to ask is this best practise to use viewmodel like this to create
    viewmodel
    global in the activity?
    • 1
    • 3
  • a

    Asad Mukhtar

    08/09/2022, 6:42 AM
    Hi, Everyone Please let me know what`s wrong with this code, Please check the attached video. I have three different textx on all pages.
    o
    • 2
    • 5
  • t

    Tower Guidev2

    08/09/2022, 8:28 AM
    Hi i am attempting to employ a
    androidx.compose.material3.ExposedDropdownMenuBox
    to implement an Autosuggest drop down list
    • 1
    • 2
  • l

    Lukasz Kalnik

    08/09/2022, 9:57 AM
    How do I set
    Switch
    colors in my theme?
    s
    • 2
    • 2
  • l

    Lukasz Kalnik

    08/09/2022, 9:58 AM
    Do I have to create a custom composable where I set
    colors
    to my theme colors? Sounds not optimal.
  • z

    Zoltan Demant

    08/09/2022, 10:18 AM
    If an interface is annotated with
    @Immutable
    , but is implemented as a value class that wraps a domain class (without
    @Immutable
    ), does compose still consider it immutable? Code example in thread 🧵
    f
    a
    s
    • 4
    • 23
  • k

    K Merle

    08/09/2022, 12:59 PM
    Is there any helper function that darkens the compose color?
  • l

    Lukasz Kalnik

    08/09/2022, 1:03 PM
    var thresholdProgress: Float by rememberSaveable(uiState.thresholdProgress) {
            mutableStateOf(uiState.thresholdProgress)
        }
                Slider(
                    value = thresholdProgress,
                    onValueChange = {
                        thresholdProgress = it
                        viewModel.onThresholdProgressChanged(it)
                    },
                )
    fun onThresholdProgressChanged(progress: Float) {
            val progressStep = (progress * 100).roundToInt()
            val lux = if (progressStep <= 50) {
                progressStep
            } else {
                50 + (progressStep - 50) * 5
            }
            _uiState.update { it.copy(lux = lux) }
        }
    uiState.lux
    is used for continuously updating the lux number in the UI as user drags the slider.
    f
    z
    +3
    • 6
    • 93
  • d

    dimsuz

    08/09/2022, 1:21 PM
    I have a
    Box(modifier = Modifier.draggable()) {
      Button(modifier = Modifier.clickable())
    }
    If I start the drag inside the button, clickable() completely intercepts it, but I want it to behave like this: if drag touch slop is passed, then clickable() should be ignored and drag should be started. Is there a way to configure this?
  • l

    Landry Norris

    08/09/2022, 2:59 PM
    I created a branch experimentally converting a project at work from Views to Compose to show the rest of the team. I’m liking the diff numbers
    +17,613 −188,973
    . Same functionality. Looks like Compose could help us get this repo to a much more manageable size.
    s
    • 2
    • 5
  • b

    Billy Newman

    08/09/2022, 5:11 PM
    Hello all, having problems trying to set the height of a Row to the full height based on its childrens height. If you can take a peek, thanks in advance. Code in comments
    l
    t
    • 3
    • 6
  • l

    Lokik Soni

    08/09/2022, 5:11 PM
    I have a media player dependency which is required in one of my composable screen. I don't know how do I inject media player in my compose. Should I pass media player throughout the navGraph or should i inject in viemodel and create function in viewmode like play pause etc.
    class RingtonePlayer @Inject constructor(
    	@ApplicationContext private val _context: Context,
    	audioManager: AudioManager
    ): RingtonePlayerAdapter(audioManager) {
    }
  • a

    AN

    08/09/2022, 8:36 PM
    I'm getting an error when trying to navigate to another graph with arguments. I'm not sure what I'm doing wrong here This is the error I'm getting:
    java.lang.IllegalArgumentException: Wrong argument type for 'userId' in argument bundle. integer expected.
    code:
    object ProfileDestination : GenericDestination {
        override val route = "profile_route/{userId}"
        override val startDestination = "profile_destination/{userId}"
        const val argsUserId = "userId"
        operator fun invoke(id: Int) = "profile_route/$id"
    }
    
    fun NavGraphBuilder.profileGraph() {
        navigation(startDestination = ProfileDestination.startDestination, ProfileDestination.route) {
            composable(
                route = ProfileDestination.startDestination,
                arguments = listOf(navArgument(ProfileDestination.argsUserId) {
                    type = NavType.StringType
                })
            ) { Profile() }
        }
    }
    navController.navigate(ProfileDestination(1))
    i
    • 2
    • 7
  • m

    Mohan manu

    08/10/2022, 6:58 AM
    When using accompanist bottomsheet if we navigate from bottomsheet to other screen, bottomsheet entry is remove when pressed back. How can we fix this ? Thanks in advance
    f
    c
    • 3
    • 2
Powered by Linen
Title
m

Mohan manu

08/10/2022, 6:58 AM
When using accompanist bottomsheet if we navigate from bottomsheet to other screen, bottomsheet entry is remove when pressed back. How can we fix this ? Thanks in advance
f

Filip Wiesner

08/10/2022, 7:27 AM
Seems like a similar question: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1659522240977349
c

Colton Idle

08/10/2022, 7:00 PM
tl;dr you can't since it's a modal destination.
View count: 7