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

    Jesse Hill

    10/07/2022, 9:51 PM
    Is it an anti-pattern to trigger a navigation change based on some state? For example, if I had a
    hasCompletedOnboarding
    state would it be improper to trigger a navigation change to the
    onboarding
    navigation graph from the
    home
    graph based on the given state? The thought would be to use
    LaunchedEffect
    so that the navigation would only happen when the state changed and wouldn’t be explicitly tied to the composition of that composable but that feels like the wrong approach. There is a code example in the thread.
    z
    i
    p
    • 4
    • 7
  • j

    Jaime

    10/07/2022, 10:14 PM
    Hello all, I have a problem with compose and some small devices when the keyboard is opened immediately it closes by itself but it only happens on small devices video in the thread
    z
    • 2
    • 5
  • l

    louiscad

    10/08/2022, 3:28 AM
    How to have "fun": Use
    import androidx.compose.material3.MaterialTheme
    Use
    import androidx.compose.material3.Text
    in some files Use
    import androidx.compose.material.Text
    in some other files Regret your career path
    s
    • 2
    • 1
  • s

    ste

    10/08/2022, 5:36 AM
    You should pass a scroll offset, which is 0 by default
    c
    • 2
    • 2
  • t

    trashcoder

    10/08/2022, 10:29 AM
    hello, i use a
    Slider
    and noticed that the
    onValueChangeFinished
    is executed before the
    onValueChange
    event when i do not drag the slider but simply click on a new location:
    I/System.out: onValueChangeFinished: 76.77
    I/System.out: onValueChange: 15.1843815
    when i drag, everything works as expected:
    ...
    I/System.out: onValueChange: 72.501526
    I/System.out: onValueChange: 72.402824
    I/System.out: onValueChange: 72.451195
    I/System.out: onValueChange: 72.36809
    I/System.out: onValueChange: 72.342735
    I/System.out: onValueChange: 72.66811
    I/System.out: onValueChangeFinished: 72.66811
    is this a known issue? EDIT: moved source snippets to thread.
    r
    • 2
    • 4
  • s

    ste

    10/08/2022, 2:29 PM
    I'm facing a problem with Android 12 overscroll configuration and nested scroll. I'm using
    nestedScroll
    to detect whether a child
    ScrollState
    reaches the top, so I can forward the deltas to the parent's
    DraggableState
    (see video). However, the android 12 stretch overscroll effect seems to use the available deltas (which is expected to perform the animation), but it also consumes them, and it causes my
    nestedScroll
    onPreScroll
    available
    parameter to be very close to zero. How can I tell the overscroll effect to not the deltas? (the first clip is how it looks like without the overscroll effect)
    a
    • 2
    • 7
  • a

    Aaron Waller

    10/08/2022, 2:59 PM
    Hey, It’s me again, the guy who just can’t get his HorizontalPager + LazyVerticalGrid to run smooth… After trying now for several months, again and again, to get the performance right I’m finally at a point where I lost hope. I read/watched everything I could find on Google and YouTube about Jetpack Compose’s performance and tried so many different things. Here is a short breakdown of the things I tried/checked: • No calculations etc in the composable • using remember {} when possible • only using stable data classes • Using @Immutable wrapper classes for my lists • Checked with compiler metric that all composables are skippable • Checked with Layout Inspector for recompositions (No unwanted re-compositions when swiping) • Generated Baseline Profiles for that swipe gesture • Enabled R8 + release build + shrinkResources • Uploaded to Google Play to download it from there so baseline profiles are installed (using Android 12 so no sideloading) • Using a key for my lists • Used Perfetto stack tracing to analyze what’s happening but besides janky frames can’t see anything wrong. (I’m gonna setup a big StackOverflow question the coming days where I explain everything I tried so far in detail) The exact same setup is running totally fine on XML with ViewPager + RecyclerView. The Items inside the LazyVerticalGrid consists of: • 2x TextViews • 1x AsyncImage loaded from URL (512x512) • 2x Icons Now I think all that’s left for me is to switch back to ViewPager + RecyclerView and try out interoperability or does anyone know why HorizontalPager + LazyVerticalGrid performs so poorly and how to fix it? Also is this a known issue and are there maybe some plans for the future to improve the performance?
    m
    r
    +4
    • 7
    • 16
  • i

    Ilya Nothen

    10/08/2022, 5:27 PM
    Hello, how would I fix this:
    Cannot access class 'kotlin.ranges.ClosedFloatingPointRange'. Check your module classpath for missing or conflicting dependencies
    There was a similar issue with kotlinx.coroutines but I fixed it by declaring a concrete dependency on it. My project compiles and runs perfectly, but it is just painful to see red underlined project folder name. It started happening after some gradle reload and then didn't go away for a week. Tried refreshing caches, straight up deleting ~/.gradle/caches (this was a disaster) but nothing helped.
  • s

    Sebastian Höbarth

    10/08/2022, 5:58 PM
    Hello everyone, it’s me again 😛 I use Accompanist Navigation to animate between screens. I use the example Transition from the Docs of the
    AnimatedNavHost
    . Navigating from overview to detail screen, the overview has this as exitTransition set. So the current screen should just slide out, although when the transition starts, the UI jumps up and then slides out. I can’t figure out where this Jump originates. Does someone have a similar problem and can pinpoint me in the direction what I’m doing wrong? (Attached a video in the thread)
    exitTransition = {
     when (targetState.destination.route) {
          DetailDestination.route -> slideOutOfContainer(
              AnimatedContentScope.SlideDirection.Left,
              animationSpec = tween(600)
              )
          else -> null
     }
    },
    o
    n
    • 3
    • 8
  • o

    Oleksandr Balan

    10/09/2022, 6:09 AM
    I would set the bottom sheet content to transparent and place both Element and BottomSheet in Column. Then set a background and rounded shape to the BottomSheet composable. There is a drawback though, user would not be able to close the bottom sheet by taping near (left/right) the Element.
  • y

    Young Rock

    10/09/2022, 7:18 AM
    hey guys, i'm confusing about whether it is appropriate to provide
    NavController
    in the form of
    CompositionLocal
    ?
    y
    n
    • 3
    • 7
  • n

    nlindberg

    10/09/2022, 8:27 AM
    Anyone have a good solution to the situation where you .
    .animateContentSize()
    On something that is aligned bottom in a Box, where sizing animation happens before the placing leaving white space below the item during the content size animation ?
    d
    • 2
    • 3
  • a

    Alexandru Hadăr

    10/09/2022, 2:28 PM
    Can we customise the activity that’s used for @Previews in compose ? In the Compose Tooling documentation (Deploy Preview) it only says that the activity has the same context and permissions. I’m interested in making it edge-to-edge
    c
    • 2
    • 3
  • a

    Alejandro Rios

    10/09/2022, 4:53 PM
    In case that if wasn't shared before: https://twitter.com/JorgeCastilloPr/status/1579057096360079361
  • s

    Stylianos Gakis

    10/09/2022, 5:42 PM
    Out of curiosity, has anyone ever tried to use anvil and still get the convenience that Hilt gives with hiltViewModel(), especially when inside a composable destination where you get it scoped to the NavBackStackEntry. I guess I could go with hilt directly, but I really like the syntax anvil allows and the fact that my modules can stay kapt-free, so I’m trying to figure out if I can avoid it before just going with hilt 😅
    • 1
    • 2
  • k

    KotlinLeaner

    10/10/2022, 10:14 AM
    Hey guys, I want to use
    broadcast receiver
    in my
    composable
    function. Is it good idea to create in
    viewmodel
    ? I am little bit concern about passing
    activity/ context
    in
    viewmodel
    ? Because
    viewmodel
    has greater
    lifecycle
    than
    composable
    . So what is best solution for this?
    z
    j
    • 3
    • 5
  • a

    abu naser

    10/10/2022, 12:16 PM
    hello guys . i wanted to use
    LazyVerticalStaggeredGrid
    from foundation api . here is the link https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/package-summary but the problem is even after adding
    implementation 'androidx.compose.foundation:foundation-layout:1.2.1'
    implementation 'androidx.compose.foundation:foundation:1.2.1'
    these two i cant call this compose function . my compose version is 1.2.0 .
    • 1
    • 1
  • k

    KotlinLeaner

    10/10/2022, 1:08 PM
    Hi, I am using compose version
    1.1.1
    in my project. I am using
    LocalRippleTheme
    like this
    • 1
    • 2
  • z

    zt

    10/10/2022, 1:55 PM
    Is there some way that I can run code when AnimatedContent finishes the animation?
  • j

    Jakub Wiśniewski

    10/10/2022, 2:41 PM
    I’m getting bunch of weird looking crashes when I use
    ComposeView
    within my application. I’ve dug trough all the sources and still cannot find the cause od the problem. TLDR version of it is that I have a list with error view on top of it that contains “refresh” button. Clicking it with my internet off (so that the view will appear) makes my app crash with bunch of compose related logs that do not point in any direction such as:
    java.lang.ArrayIndexOutOfBoundsException: length=3; index=3 -> ViewGroup
    java.lang.IllegalArgumentException: Failed requirement -> androidx.compose.ui.node.MeasureAndLayoutDelegate
    java.lang.IllegalArgumentException: Failed requirement -> androidx.compose.ui.platform.AndroidComposeView.notifyLayerIsDirty
    java.lang.IllegalStateException: Underflow in restore - more restores than saves
    
    Exception Type: Unknown (SIGSEGV)
    What is important to mention is that it only happens on RELEASE version of the App. I’ve dissected my app and trying to reproduce the issue on fresh repo but I wasn’t able to, yet. No such problems when I switch to
    ComponentActivity
    instead of
    Fragment
    with
    ComposeView
    as its only view. I don’t have unusual amount of recompositions either - around 2 for state. Would appreciate any kind of help, guidance, ideas what might be the source of my problem.
    z
    r
    • 3
    • 32
  • l

    Luigi Giustiniani

    10/10/2022, 3:45 PM
    Hello guys! Can I use Emoji2 with jetpack compose?
    a
    s
    • 3
    • 3
  • g

    Gaurav Tyagi

    10/10/2022, 5:19 PM
    Hi,
  • g

    Gaurav Tyagi

    10/10/2022, 5:19 PM
    Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
    a
    • 2
    • 4
  • n

    nlindberg

    10/10/2022, 5:38 PM
    Couldn't you put the entire text in a scrollable composable and then vertically scroll it according to playback time?
  • s

    Sean Proctor

    10/10/2022, 7:22 PM
    I created a signature pad for Compose. It currently targets Android and JVM. https://github.com/sproctor/SignaturePad/
    • 1
    • 1
  • t

    Tolriq

    10/10/2022, 8:32 PM
    What would be the idiomatic way to have a reusable dialog in compose that accept some input and trigger a callback?
    z
    • 2
    • 6
  • k

    KotlinLeaner

    10/10/2022, 8:32 PM
    Hi, why
    Spacer
    is not working in simple function?
    j
    s
    d
    • 4
    • 13
  • a

    Alex Petitjean

    10/10/2022, 10:47 PM
    Could/should a data class with a
    @Composable
    parameter be marked as
    @Immutable
    ? I've got something like this for controlling what is in a
    TopAppBar
    as part of a `Scaffold`:
    private data class MyTopAppBarState(
        @StringRes val titleResId: Int,
        val actions: (@Composable RowScope.() -> Unit)?,
    )
    The contents of the
    actions
    Composable lambda are `TextButton`s with
    onClick
    lambdas that would likely reference a ViewModel. I don't know if that matters, but it feels like it might.
    z
    • 2
    • 2
  • r

    Radoslaw Juszczyk

    10/11/2022, 7:15 AM
    Hello I have three activites, one classic and two with composable layout inside. I am trying to write an espresso test which starts in the Activity A, then clicks something, navigates to the Activity B, then clicks something (inside compose), and navigates to the Activity C and assert something there (on compose). How do I do it? If I use
    createEmptyComposeRule
    then the Activity C comes blank...
    g
    • 2
    • 3
  • m

    Michael Elgavi

    10/11/2022, 9:08 AM
    Has anyone had issues with
    TextAlign.Justify
    not working on some devices? Specifically having issues with OxygenOS (Nord CE2 Android 12.0)
    z
    • 2
    • 1
Powered by Linen
Title
m

Michael Elgavi

10/11/2022, 9:08 AM
Has anyone had issues with
TextAlign.Justify
not working on some devices? Specifically having issues with OxygenOS (Nord CE2 Android 12.0)
z

Zach Klippenstein (he/him) [MOD]

10/11/2022, 12:17 PM
Please file a bug. The tracker link is in the channel topic.
View count: 8