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

    Cacato86

    05/05/2021, 12:32 PM
    Hi everyone! I have a question: Which is the best way to manage with compose all the variation that I can have in one screen? I mean, how to manage
    portrait - landscape
    /
    mobiles - tablet
    The typical example with List-Detail (Navigation on phone, same screen in Tablet)
    ➕ 1
    👀 1
    o
    r
    • 3
    • 4
  • c

    Colton Idle

    05/05/2021, 1:35 PM
    https://github.com/JakeWharton/mosaic
    :trollface: 7
    :party-parrot: 4
    👍 21
    :jetpack-compose: 2
    t
    c
    +4
    • 7
    • 6
  • r

    Roman Polach

    05/05/2021, 4:07 PM
    Hi...Is there a way to create Modal bottom sheet in Compose? I need to create bottom sheet, which is blocking UI underneath..
    n
    • 2
    • 2
  • t

    tad

    05/05/2021, 5:54 PM
    Was I not supposed to update the Kotlin IDEA plugin? Getting an error when syncing the project
    • 1
    • 3
  • s

    ste

    05/05/2021, 6:24 PM
    This is VERY stupid... the following pattern seems occurring quite frequently when writing compose code:
    @Composable
    fun Element(state: ElementState, content: @Composable ElementScope.() -> Unit) { ... }
    
    class ElementState {}
    
    @Composable
    fun rememberElementState(): ElementState { ... }
    
    class ElementScope {}
    I was wondering why it is preferred against the version in the thread? The guidelines do not mention it.
    🇳🇴 1
    k
    t
    +2
    • 5
    • 6
  • c

    Cicero

    05/05/2021, 10:26 PM
    So I’ve been doing some playing around with this grid and I wanted it to move around X and Y. To try to make this happen I draw gridSize+2 and I made the offset X and Y - 1 (so we have this extra 1 in every border -x/x/-y/y). Now when I’m animating I slide the offSet X or Y into the direction I want (minus or positive), after the animation of offset ends I update the logical position and then redraw the grid back to offset 0, whatever X or Y direction I moved. My issue is that I can’t get to draw my columns out of my screen bounds. Is this a limitation that I can get around?
    • 1
    • 6
  • r

    robnik

    05/06/2021, 2:57 AM
    I updated the Kotlin plugin and now a project won't build. Is the plugin incompatible with Compose?
    e: This version (1.0.0-beta06) of the Compose Compiler requires Kotlin version 1.4.32 but you appear to be using Kotlin version 1.5.0 which is not known to be compatible. Please fix your configuration (or
    suppressKotlinVersionCompatibilityCheck
    but don't say I didn't warn you!).`
    🇳🇴 2
    c
    • 2
    • 3
  • t

    Tlaster

    05/06/2021, 3:13 AM
    It's been a while since the last paging-compose release, is there any plan to have an update?
    i
    c
    • 3
    • 7
  • j

    Justin Yue

    05/06/2021, 3:25 AM
    hello, i'm a little bit late in upgrading to the latest android study canary, and now the ide is that there's unresolved references with functions in kotlin's standard library like absoluteValue(), roundToInt(), listOf() and so on. It doesn't seem to be affecting the compose project, but I was wondering if anybody has already resolved the issue already.
    d
    c
    • 3
    • 21
  • g

    Gaurav Gangwar

    05/06/2021, 6:18 AM
    Hello everyone, what is a good way of handling click events in a Lazy Column consisting of multiple item types ? Should I pass a separate lambda for all of my different items or is there anything better that I can do ?
    c
    • 2
    • 1
  • j

    julioromano

    05/06/2021, 6:49 AM
    When loading images with Coil through Accompanist, what is the difference using Coil’s
    crossfade
    and/or Accompanist’s
    fadeIn
    ?
    a
    c
    • 3
    • 3
  • t

    Tlaster

    05/06/2021, 8:28 AM
    Does any have the issue
    java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap
    after upgrade to beta06 with accompanist 0.9.0, full stacktrace in thread
    c
    • 2
    • 8
  • a

    adauguet

    05/06/2021, 9:31 AM
    How can I set a shadow/elevation on a GlideImage? The following is working as expected:
    Surface(elevation = 5.dp, shape = CircleShape, modifier = Modifier.size(200.dp)) {}
    But I do not see any shadow with this code:
    Surface(elevation = 5.dp, shape = CircleShape, modifier = Modifier.size(200.dp)) {
        GlideImage(
            data = contact.avatarURL ?: "",
            contentDescription = "",
        )
    }
    What am I missing?
    c
    • 2
    • 2
  • p

    Piotr

    05/06/2021, 9:36 AM
    Hi, Did Someone notice issues on beta06 with Arrangement.spacedBy() inside box/dialog? Using this code: https://gist.github.com/piotrsedlak/9de5319f1748762b1ed2990fa07d858f between beta05 and beta06 produces different results, is it a bug or did something change that i didnt notice in release notes?
    😒ame: 1
    s
    y
    • 3
    • 3
  • l

    louiscad

    05/06/2021, 12:17 PM
    Am I the only one disliking how Composable functions autocompletion works? I don't like that it doesn't automatically show parameter hints, and I don't like the live template behavior. I wish it just wasn't custom.
    ➕ 10
    a
    v
    z
    • 4
    • 10
  • n

    Nthily

    05/06/2021, 12:47 PM
    Why does alpha not work when two parameters are written together?
    l
    • 2
    • 6
  • a

    André Thiele

    05/06/2021, 12:57 PM
    I am currently getting a "java.lang.IllegalStateException: Launcher has not been initialized". What am I doing wrong?
    i
    a
    • 3
    • 10
  • c

    Colton Idle

    05/06/2021, 1:11 PM
    Feeling... not smart. I'm having a simple problem with centering text. Here is what it looks like. Code in thread.
    r
    v
    s
    • 4
    • 28
  • l

    louiscad

    05/06/2021, 1:56 PM
    Is it impossible to preview a custom view that embeds a
    ComposeView
    from Android Studio? It complains about missing
    ViewTreeLifecycleOwner
    , and
    ViewTressSavedStateRegistryOwner
    😕 Also, does it mean it's impossible to have a compose view outisde of an Activity? I'm thinking about the few
    WindowManager
    use cases.
    a
    z
    • 3
    • 11
  • s

    Slackbot

    05/06/2021, 1:58 PM
    This message was deleted.
    g
    • 2
    • 3
  • s

    Slackbot

    05/06/2021, 2:04 PM
    This message was deleted.
    c
    a
    • 3
    • 24
  • z

    Zhelyazko Atanasov

    05/06/2021, 2:07 PM
    It's not 100% related to Compose but still - probably a good place to ask. I started implementing our internal design system in Compose and I published it to Maven Local. Then I wanted to use it in another project, but I'm not able to call any "global" functions - e.g. I have a file called
    OneButton
    with a single method in it (no classes or objects):
    @Composable
    fun OneButton(
        modifier: Modifier = Modifier
    ...
    If I try to call it from my other project, Android Studio does not recognize the function. Then I decided to experiment and created a dummy Kotlin class with a single
    @Composable
    method in it. Published the .aar to Maven Local and used it in the other project. I created an instance of the dummy class and successfully called the
    @Composable
    function. What am I missing - my setup is more or less the same as in Accompanist (I'm not using Metalava and/or API file), I'm using the same Gradle plugin for publishing the artefacts... Any idea what may be wrong?
    ✅ 3
    :thread-please: 1
    l
    • 2
    • 7
  • g

    Geert

    05/06/2021, 2:53 PM
    Is there maybe someone who can help me with this issue? I implemented a BottomNavigationBar, but it crashes on start. It does not crash when I do comment the bottomBar line. https://github.com/geertberkers/JetpackComposeBottomNavigationCrash/issues/1
    j
    • 2
    • 2
  • a

    Archie

    05/06/2021, 5:07 PM
    Hi, Is there a way to add a Shape to a Scrollable Container so the shape would encompass all the children? I’d appreciate any help. Thanks in advance.
    c
    • 2
    • 22
  • n

    nglauber

    05/06/2021, 7:16 PM
    I just answered this question in StackOverflow… Is there a better way? How about this error indication in Android Studio? https://stackoverflow.com/questions/67423907/possible-to-use-layout-a-compose-view-in-and-activity-written-in-java
    a
    • 2
    • 3
  • m

    Mahmudul Hasan Shohag

    05/06/2021, 10:55 PM
    I want to create collapsible effect like Jetsnack details view (https://github.com/android/compose-samples/tree/main/Jetsnack#custom-layout) with
    LazyColumn
    . For
    ScrollState
    we can use the
    scroll.value
    to get the scroll position/offset. But with
    LazyListState
    , we only have
    initialFirstVisibleItemScrollOffset
    , which give offset for per item. So how can I create the same kind of collapsible effect with
    LazyColumn
    ?
    s
    • 2
    • 1
  • j

    Justin Yue

    05/07/2021, 12:07 AM
    My navigation graph is a nested graph for an authentication flow. Once authenticated, I want to navigate to a screen with a bottom navigation bar, and my current implementation is to use a 2nd navigation controller for this bottom nav bar. Is it possible to do away with the 2nd navigation controller and use the 1st?
    c
    i
    n
    • 4
    • 21
  • a

    Adrian Tappe

    05/07/2021, 9:11 AM
    Having a
    LazyColumn
    within a
    ComposeView
    within… a `CoordinatorLayout`: The Behaviors (FAB moving out of sight while scrolling e.g.) of the
    CoordinatorLayout
    seem to not work. How can the scrolling be propagated?
    a
    • 2
    • 1
  • c

    Cicero

    05/07/2021, 11:27 AM
    Anyone having issues with Preview? I need to close and reopen my classes and I just realized I’m doing this very often. Rebuilding works 50/50
    😒ame: 6
    a
    • 2
    • 3
  • m

    Marcin Środa

    05/07/2021, 12:57 PM
    How to test a LazyColumn items?
    • 1
    • 2
Powered by Linen
Title
m

Marcin Środa

05/07/2021, 12:57 PM
How to test a LazyColumn items?
The tree from testRule:
Printing with useUnmergedTree = 'true'
    Node #1 at (l=0.0, t=210.0, r=1080.0, b=762.0)px
     |-Node #2 at (l=32.0, t=273.0, r=1048.0, b=415.0)px
     | Actions = [OnClick]
     | MergeDescendants = 'true'
     |  |-Node #3 at (l=174.0, t=291.0, r=365.0, b=348.0)px
     |  | Text = 'Channel 1'
     |  | Actions = [GetTextLayoutResult]
     |  |-Node #5 at (l=174.0, t=348.0, r=387.0, b=397.0)px
     |    Text = 'Description 1'
     |    Actions = [GetTextLayoutResult]
     |-Node #7 at (l=32.0, t=415.0, r=1048.0, b=557.0)px
     | Actions = [OnClick]
     | MergeDescendants = 'true'
     |  |-Node #8 at (l=174.0, t=433.0, r=365.0, b=490.0)px
     |  | Text = 'Channel 2'
     |  | Actions = [GetTextLayoutResult]
     |  |-Node #10 at (l=174.0, t=490.0, r=387.0, b=539.0)px
     |    Text = 'Description 2'
     |    Actions = [GetTextLayoutResult]
     |-Node #12 at (l=32.0, t=557.0, r=1048.0, b=699.0)px
       Actions = [OnClick]
       MergeDescendants = 'true'
        |-Node #13 at (l=174.0, t=575.0, r=365.0, b=632.0)px
        | Text = 'Channel 3'
        | Actions = [GetTextLayoutResult]
        |-Node #15 at (l=174.0, t=632.0, r=387.0, b=681.0)px
          Text = 'Description 3'
          Actions = [GetTextLayoutResult]
composeTestRule.onNodeWithText("Channel 1").assertExists()
returns
Reason: Expected exactly '1' node but could not find any node that satisfies: (Text = 'Channel 1' (ignoreCase: true))
FIXED Did forget to use
useUnmergedTree = true
View count: 8