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

    alorma

    09/09/2021, 1:22 PM
    Hi. I have a Column with some
    Surfaces
    on it, first of them has an elevation of
    8.dp
    , however the shadow is not displayed. If i add some bottom padding to the Surface, then it shows... but... why is that? shouldn't shadow draw over other elements?
    a
    • 2
    • 8
  • b

    Bradleycorn

    09/09/2021, 3:15 PM
    is there a way to focus a composable (specifically a TextField) in a
    @Preview
    ? I tried adding a focus requester and requesting focus in a DisposableEffect, but as I suspected, no luck.
    c
    • 2
    • 3
  • r

    Rick Regan

    09/09/2021, 3:56 PM
    I am using Preferences DataStore and a
    LaunchedEffect
    in my top-level composable to read in app preferences. I have hardcoded defaults for the preferences so that my UI can initially compose. When the stored preferences are loaded, the UI recomposes to match them. This happens quickly, but it's noticeable. I was hoping there was a way to skip right to the stored preferences based composition, i.e., delaying startup composition until the preferences are loaded.
    a
    • 2
    • 2
  • r

    rajesh

    09/09/2021, 5:42 PM
    I'm using
    LazyVerticalGrid
    to loading images. If there's any error while decoding image bitmap, it shouldn't be loaded (as per code in thread), but
    LazyVerticalGrid
    is using empty cell (shown in image) instead of avoiding that item. what should i do to resolve it?
    a
    a
    • 3
    • 10
  • a

    Ash

    09/09/2021, 10:33 PM
    Teaching Compose to designers. Do we have a drag/drop tool -/- GUI UI builders for Compose?
    🙈 1
    🔥 2
    k
    r
    • 3
    • 13
  • d

    darkmoon_uk

    09/10/2021, 3:11 AM
    ❓ "How can we guarantee that
    @Preview
    annotated functions do not end up in production code?"
    ☝️ This came as a fair challenge from within our team today. I'm working in an environment where adherence to architectural layers, and guaranteed correctness is paramount. As such, it was fairly pointed out that
    @Preview
    functions strictly belong in a different place to production code. There's an obvious tension there between architectural purity and the practical benefits of placing them alongside `@Composable`'s (such as the intent behind the Code / Split / Design pane). We've arrived at a place where it's deemed acceptable as long as we have a way of guaranteeing that
    @Preview
    annotated functions cannot accidentally make it into a Release build (either as live or dead code). Do any easily configurable means exist today? If not, could we implement something using the recently released KSP?
    e
    r
    a
    • 4
    • 14
  • k

    K Merle

    09/10/2021, 7:48 AM
    Should I use inline function instead of regular function?
    @Composable
    fun <T : FilterModel> FilterScreen(
        listResult: Result<List<T>>,
        filteredList: (list: List<T>) -> List<T>,
        onItemSelect: (T) -> Unit,
        navigate: () -> Unit
    )
    a
    • 2
    • 6
  • p

    Peter Mandeljc

    09/10/2021, 9:31 AM
    how would one override back behavior for specific navigation destination? For example, if I have destination A,B,C,D, I would like for D to always pop back to A, given that you can navigate to D from A,B,C.
    i
    • 2
    • 2
  • m

    myanmarking

    09/10/2021, 9:38 AM
    I am reading dominat color using palette from an image. I want to place a background with that color, and text inside. How can i check if the color is predominantly light/dark so i can change textColor to white/black. Is there any build-in feature for this ?
    a
    c
    • 3
    • 3
  • j

    Jeff

    09/10/2021, 10:16 AM
    I can't seem to get the text to the middle of the circle shape. Code in thread 🧵
    a
    t
    c
    • 4
    • 8
  • s

    shahroz

    09/10/2021, 11:22 AM
    In navigation component, when i navigate to different composable. My previous composable is still observing state changes. Shouldn't the scope of the composable stop observing?
    s
    m
    +2
    • 5
    • 19
  • a

    adjpd

    09/10/2021, 11:32 AM
    In Android Studio, the documentation samples are unresolved. Is there something I can do to resolve them?
    🇳🇴 3
    • 1
    • 1
  • с

    Стоян Тинчев

    09/10/2021, 12:00 PM
    I want to create an application that is like google calendar one day view. So I have a scroll state for different hours in a day and one line that represents the current time. This line is created with Stateflow and it is dynamic. I want the following user experience with the latter: • when the app is launched to scroll directly to that line • when the user scrolls down or up - at a certain time this line to be focused again How can I achieve it? Currently app looks like below pictures(in the second is the suspect line):
    :thread-please: 3
    🧵 2
    f
    • 2
    • 5
  • z

    Zoltan Demant

    09/10/2021, 12:39 PM
    Is there a sensible way to support a smaller
    TextField
    (width) than the material design one? 🧵👀
    a
    • 2
    • 12
  • d

    Dylan

    09/10/2021, 2:13 PM
    Hey there, I'm trying to sync the elevation of a
    TopAppBar
    based on the scroll position within a
    LazyList
    . The
    TopAppBar
    is within a
    Scaffold
    , and the Scaffold content is a
    NavGraph
    . This NavGraph contains a composable which contains my LazyList. I tried to do it by creating an
    AppBarState
    which holds the current elevation as a
    MutableState<Float>
    and also the elevationRange (
    0f..4f
    ). I also created a
    LocalAppBarState
    which holds the current
    AppBarState
    . The elevation of my
    TopAppBar
    is defined using
    LocalAppBarState.current.elevation.dp
    . To define the elevation I created a composable that return a
    LazyListState
    . It uses the
    LocalAppBarState
    to define the calculated elevation based on the
    LazyListState
    . Unfortunately, doing this cause my app to lag when scrolling. But I'm not sure I know any other way to do it. I read some things about
    Modifier.graphicsLayer
    , but even after trying that the issue remains the same. Is there a better way to do it? I will leave as the first comment in this thread the code for all of that.
    a
    g
    • 3
    • 6
  • m

    myanmarking

    09/10/2021, 2:17 PM
    With a List of Items, whats the best practice to remember if specific item is expanded or not ? Item internal state =?
    h
    • 2
    • 4
  • s

    ste

    09/10/2021, 2:18 PM
    is there a built-in
    Modifier
    that disables any gesture detection of its children? I don't want children to override gestures of their parents
    👀 3
    a
    • 2
    • 2
  • m

    myanmarking

    09/10/2021, 3:23 PM
    how can i align the text vertically ?
    a
    • 2
    • 3
  • g

    georgiy.shur

    09/10/2021, 3:48 PM
    I’m having problems using Hilt injection into custom Compose view. I’m using this as an entry point.
    @AndroidEntryPoint
    class CustomComposeView(context: Context) 
        : AbstractComposeView(context, null, 0)
    But I’m getting an error:
    The base class, 'androidx.compose.ui.platform.AbstractComposeView', of the @AndroidEntryPoint, 'com.example.CustomComposeView', contains a constructor with default parameters. This is currently not supported by the Gradle plugin. Either specify the base class as described at <https://dagger.dev/hilt/gradle-setup#why-use-the-plugin> or remove the default value declaration.
    I cannot modify the base class because I don’t own it and I don’t understand where should I specify the base class. Any ideas?
    s
    • 2
    • 1
  • m

    myanmarking

    09/10/2021, 3:56 PM
    is there any example how to go about collapsing header + sticky toolbar ? I manager to implement parallax looking at some samples, but i cannot quite grasp how to make the toolbar not scroll past the top screen
    👍 1
    c
    • 2
    • 1
  • j

    Justin Yue

    09/10/2021, 5:03 PM
    I'm currently working on conditional navigation where if the user is not logged in, the app navigates to the authentication screen. Currently, I place this conditional navigation logic in a
    launchedEffect
    of my main screen, but the app then momentarily shows the main screen before navigating to the auth screen if no user is logged in. I would like to remove the delay in navigating to the auth screen. I'm not entirely sure if using
    launchedEffect
    in this case is best practice too.
    w
    • 2
    • 3
  • w

    Waqas Tahir

    09/10/2021, 5:07 PM
    I want to create a text field with line numbers , is there any way I could do this , I don't want to use multiple text fields
    z
    • 2
    • 1
  • m

    myanmarking

    09/10/2021, 5:28 PM
    is there any way of knowing the total scroll from LazyListState ?
    a
    r
    • 3
    • 7
  • b

    brabo-hi

    09/10/2021, 5:33 PM
    hi all, when navigating from A to B, what is the best way to return data back from B to A when B finishes?
    i
    • 2
    • 2
  • v

    Vinícius Santos

    09/10/2021, 5:39 PM
    Hey there I'm working on a project with feature modules and compose navigation, I've been searching for approaches using compose navigation but all of them seems to centralize navigation in a single spot and I was wondering, is there any way I can have multiple independent graphs just like we already have with jetpack navigation nested graphs?
    i
    • 2
    • 2
  • b

    Bradleycorn

    09/10/2021, 8:10 PM
    Has anyone built a
    TextField
    composable with masking/formatting of input (for example to format a phone number or date)?
    n
    • 2
    • 2
  • r

    rajesh

    09/10/2021, 9:19 PM
    I've Boolean variable in child composable which I want to reassign from parent composable. How do I do that? Tried state hoisting but that didn't worked.
    z
    • 2
    • 2
  • j

    josefdolezal

    09/10/2021, 10:09 PM
    Hello all! 👋 Could you point me to the right direction with animating position of composable? I am trying to animate text and it’s position based on
    isLoading
    variable alongside animating progress indicator’s visibility
    Screen Recording 2021-09-11 at 0.02.05.mov
    c
    d
    • 3
    • 7
  • t

    Tash

    09/10/2021, 10:15 PM
    Is it possible to unit test models and classes that define
    mutableStateOf
    s or other snapshot state APIs outside of an Android integration test? We are defining some models with snapshot state APIs that we would like to just have unit tests for, since we don’t have CI infra set up for Android integration tests.
    z
    a
    • 3
    • 5
  • s

    Sergey Y.

    09/10/2021, 10:28 PM
    Some fun with Compose and Raycasting 👀 😄 WIP
    device-2021-09-11-011857.mp4
    👏🏼 1
    😮 15
    👏 16
    👏🏽 1
    👏🏻 2
    a
    • 2
    • 7
Powered by Linen
Title
s

Sergey Y.

09/10/2021, 10:28 PM
Some fun with Compose and Raycasting 👀 😄 WIP
device-2021-09-11-011857.mp4
👏🏼 1
😮 15
👏 16
👏🏽 1
👏🏻 2
a

andrew

09/11/2021, 4:59 PM
That's pretty nifty, almost reminds me of the fluent ui lighting model a bit
s

Sergey Y.

09/13/2021, 12:00 AM
@andrew Thanks. I continue to work on this. I'm not sure how this will end, but I find the process amusing. The latest progress https://twitter.com/desugar_s/status/1437171470061420549
a

andrew

09/13/2021, 1:09 AM
WOW! That's cool! 😎
Do you plan on open sourcing it?
s

Sergey Y.

09/13/2021, 6:50 PM
Of course, at some point. But nothing special there, the code is a bit messy and not optimized.
a

andrew

09/19/2021, 6:34 PM
That's fair, still though, neat stuff!
Curious to see what comes out of it next haha
View count: 3