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

    Fudge

    02/24/2021, 10:01 PM
    Why am I getting these errors after updating from the Compose version the project wizard starts you with to beta01?
    j
    • 2
    • 12
  • d

    Dieter Holz

    02/24/2021, 10:40 PM
    What happened to ConstraintLayout in beta01?
    v
    t
    +3
    • 6
    • 6
  • t

    Tash

    02/24/2021, 11:16 PM
    I recall an older convo on here regarding pausing animations with
    ManualAnimationClock
    . In general what’s the declarative way to think about “freezing” and “resuming/reverting” animations, and are there any related APIs at the moment? Came across *Pausable*MonotonicFrameClock but seems like a lower level API 🤔
    d
    r
    • 3
    • 11
  • c

    Colton Idle

    02/24/2021, 11:18 PM
    Can't resolve
    setContent
    in beta01. Search in slack doesn't show anyone with the same problem. Any ideas?
    t
    z
    i
    • 4
    • 17
  • t

    Tony Kazanjian

    02/25/2021, 12:18 AM
    Now that beta01 is out, should we expect the same release cadence as with the alpha releases, i.e. every two weeks?
    :yes: 2
    j
    s
    c
    • 4
    • 3
  • c

    Colton Idle

    02/25/2021, 3:26 AM
    Compose provides wrappers around common image loading libraries? Where do I find that?
    r
    f
    +2
    • 5
    • 7
  • i

    itnoles

    02/25/2021, 3:51 AM
    Is there is a way to see all items on the LazyColumn?
    a
    • 2
    • 4
  • c

    Colton Idle

    02/25/2021, 4:01 AM
    I know many people have congratulated the compose team on the beta milestone today. As someone that hasn't used it much but has tried to stay up to date (using this slack channel), this video about Lists in Compose (

    https://youtu.be/BhqPpUYJYeQ▾

    ) is truly mind blowing. • Displaying a list of items with just a forEach statement 🤯 • Convert that list to lazy list swapping a few characters 🤯 • Adding headers by to list items adding ~5 lines of code 🤯 • Convert those headers to sticky with a single keyword 🤯 • Animate button visibility on user scrolling with ~5 lines 🤯 I knew Compose was going to be great. I had no idea it was going to be this amazing. This is the highlight to my 2020/2021 and completely changes the game on how we build. The entire compose team (and anyone else that has had a hand in this) should feel beyond proud to deliver something this magnificent. 😛arty-parrot: Congrats! Hope you all can take a bit of a break and get some rest 😅
    :tnx: 4
    👍 2
    :mind-blown: 4
    🥳 11
    :kotlin-intensifies: 4
    i
    • 2
    • 2
  • y

    Yofou

    02/25/2021, 4:14 AM
    Hey So I'm wondering if there is anyway of finding the width (or height) of a component without implementing a custom layout to measure it? My use case is basically I want to have a lazy grid (which is just going to be lazy column with rows), but I need to chunk my images, so each row can fit perfectly with it's parent container, before going into the next one, luckly my images are fixed constant width, so all I need to do is figure out the width of the parent container, so i can calculate the amount i need to chunk it by, hopefully that expresses my use case and any solution to my problem would nice (hopefully without me having to implement my own lazy grid :P)
    j
    • 2
    • 2
  • k

    knthmn

    02/25/2021, 4:16 AM
    I see currently
    NavHost()
    already provides
    ViewModelStoreOwner
    ,
    LifecycleOwner
    , and
    SavedStateRegistryOwner
    locals. Is there a function like
    scopeViewModels(savedState: Bundle? = null, content @Composable () -> Unit)
    that I can use that also scopes all the view models inside content and automatically clear them like
    NavHost()
    does? I want to use it for dialogs which does not make much sense with
    NavHost()
    i
    • 2
    • 2
  • d

    Deepak Gahlot

    02/25/2021, 4:48 AM
    What happened to TextField in beta:01
    s
    s
    • 3
    • 8
  • s

    Shakil Karim

    02/25/2021, 6:00 AM
    Is there easy way to achieve snapping (paging) like behavior in LazyRow?
    👀 1
    ➕ 2
    a
    v
    a
    • 4
    • 5
  • p

    Paul Woitaschek

    02/25/2021, 6:41 AM
    Could you boldly clarify that compose beta doesn't mean ready-to-use? I see many voices where people think that it's now production ready. That's because there is this kind of google definition of stable which has established over the last year. By that definition beta is already stable but api changes can occur. But the compose beta seems to rather match the regular definition of beta.
    c
    f
    • 3
    • 8
  • a

    Aditya Wasan

    02/25/2021, 7:47 AM
    Hey guys, all my tests started failing in compose beta 01 and by logging it with the
    printToLog
    method it seems that now there is an extra node in the compose hierarchy
    |-Node #4 at (0.0, 171.0, 1080.0, 325.0)px
      SelectableGroup = 'kotlin.Unit'
      MergeDescendants = 'true'
    Is this a planned change or a bug? (Posting more details in the thread)
    j
    p
    v
    • 4
    • 13
  • a

    allan.conda

    02/25/2021, 8:41 AM
    Stuck with this runtime crash 😞 on beta01. Anyone else?
    java.lang.NoSuchMethodError: No static method painterResource(I)Landroidx/compose/ui/graphics/painter/Painter; in class Landroidx/compose/ui/res/PainterResources_androidKt; or its super classes (declaration of ‘androidx.compose.ui.res.PainterResources_androidKt’ appears in /data/app/com.example.app.debug-bpEZigKD1QJBwWERJb9cjw==/base.apk)
    t
    • 2
    • 1
  • a

    alorma

    02/25/2021, 9:14 AM
    Hi. I'm using
    CoilImage
    to show an image:
    CoilImage(
                data = "",
                modifier = modifier,
                contentDescription = "",
                contentScale = ContentScale.Crop,
                loading = { CircularProgressIndicator(Modifier.align(Alignment.Center)) }
            )
    But it not shows the image loaded from network (

    https://random.dog/00186969-c51d-462b-948b-30a7e1735908.jpg▾

    ) The error is:
    Error(painter=null, throwable=kotlinx.coroutines.JobCancellationException: StandaloneCoroutine was cancelled; job=StandaloneCoroutine{Cancelled}@7155d16)
    j
    • 2
    • 3
  • m

    Marko Novakovic

    02/25/2021, 9:49 AM
    I have this in gradle file
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0"
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha-02'
    but still can’t find
    viewModel()
    function. What should I do?
    k
    • 2
    • 3
  • e

    Eric Ampire [MOD]

    02/25/2021, 9:52 AM
    Hello, when I tried to use Scaffold, I have gotten this error message, I can’t understand why.
    j
    k
    s
    • 4
    • 4
  • e

    eygraber

    02/25/2021, 10:09 AM
    What's the status of Kdoc on Compose code? I'm looking at some of the compose runtime code to understand how it works, and the
    Composition
    function mentions that
    parent
    is optional, and defaults to null, but the parameter neither has a default value, nor is nullable. Is that something to file a bug about, or is documentation still a WIP?
    j
    • 2
    • 2
  • a

    Ahmet Delibaş

    02/25/2021, 10:11 AM
    Hello guys. I was using AmbientAnimationClock, but with beta release I realize this object is removed. What can I use for this ?
    👀 1
    p
    a
    • 3
    • 5
  • m

    Maciej Pigulski

    02/25/2021, 10:15 AM
    After upgrading to newest beta01, ringing any bells? I have tried cleaning, I have even removed .gradle folder, nothing helps
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/ui/platform/AndroidAmbientsKt;
            at androidx.navigation.compose.NavHostControllerKt.rememberNavController(NavHostController.kt:79)
    a
    k
    • 3
    • 5
  • a

    Albert Chang

    02/25/2021, 10:25 AM
    I'm trying to migrate my pager implementation to using 1.0.0-beta01. The newly introduced
    FlingBehavior
    makes the code much better. However, as
    performFling()
    will not be called if there is no fling velocity, I can't figure out a way to snap to a page in that case. Is there any other way to correctly implement this behavior (
    Modifier.swipeable
    doesn't seem to fit)? If there is no, I think it's reasonable to call
    performFling()
    even if there is no fling velocity.
    m
    a
    • 3
    • 4
  • o

    Orhan Tozan

    02/25/2021, 10:29 AM
    In contrast to ReactJS, Compose doesn't have a "virtual dom" that works by "diffing" the before and after UI in order to handle performance. I'm curious to know how "smart" Compose's system is. Are there any sources about how Compose handles efficient performance handling? Couldn't really find any articles about it.
    👀 1
    k
    a
    b
    • 4
    • 3
  • v

    Vivek Sharma

    02/25/2021, 10:32 AM
    I was using
    Modifier.size(dp)
    , and I tried to change its
    size(dp)
    again, but it doesnt get change, it fixes size with respect to the first value which we set, is this okay? I dont know, but felt weird and okay at same time
    s
    s
    • 3
    • 4
  • j

    John O'Reilly

    02/25/2021, 11:16 AM
    I may have missed this yesterday but was there mention of when it was hoped that Compose would be officially supported in non Canary version of AS
    j
    p
    c
    • 4
    • 4
  • d

    Deepak Gahlot

    02/25/2021, 12:01 PM
    Do we know how to get the activity result back to the Composable. I'm opening an activity using an intent where i'm selecting a file. I wan to get that in back to the composable. Do we have something like onActivityResult
    p
    s
    i
    • 4
    • 7
  • l

    Lucien Guimaraes

    02/25/2021, 12:32 PM
    What's the best way to create a smooth alpha fade animation ? For example, I want my TopAppBar backgroundColor alpha to be updated while the user is scrolling. Depending of the scrolling speed, the animateFloatAsState isn't updated as much as wanted. I have to scroll very slowly to have something not too bad. Is there a better way ? Code & video of the animation in thread
    t
    k
    g
    • 4
    • 26
  • m

    Marcello Galhardo

    02/25/2021, 12:58 PM
    Hi! Now that we have Compose Beta, do we have a date for Android Studio 4.2 to reach Stable*? I wanted to migrate our "design system prototype" to Compose Beta without customizations from my side (gradle plugin) but I did not want to break other developers using Android Studio 4.1 stable. Thank you.
    j
    z
    • 3
    • 13
  • j

    julioromano

    02/25/2021, 1:14 PM
    Is there a way to “hide/show” a composable in the hierarchy without making it recompose? I’m hiding/showing an
    AndroidView
    with a
    WebView
    inside and every time it becomes visible again it will recompose and therefore reload the website. Any ideas how to get around this?
    ✅ 1
    c
    z
    • 3
    • 13
  • a

    alorma

    02/25/2021, 1:19 PM
    ok, found it
    .clickable(
                    indication = rememberRipple(
                        color = MaterialTheme.colors.primary.copy(alpha = 0.20f),
                    ),
                    interactionSource = remember { MutableInteractionSource() },
                ) { }
    a
    • 2
    • 4
Powered by Linen
Title
a

alorma

02/25/2021, 1:19 PM
ok, found it
.clickable(
                indication = rememberRipple(
                    color = MaterialTheme.colors.primary.copy(alpha = 0.20f),
                ),
                interactionSource = remember { MutableInteractionSource() },
            ) { }
a

Andrey Kulikov

02/25/2021, 2:15 PM
do you mean the Card from material package? there is a contentColor param on it, ripple is using it by default
a

alorma

02/25/2021, 2:34 PM
uhmm
but, if change it, the content there (text, icons...) will be colored according, isn't?
a

Andrey Kulikov

02/25/2021, 2:36 PM
yeah, it is following the material design specification where ripple color is the same as the color of text/icons. but yes, feel free to set it directly on clickable if you don’t like that behavior
View count: 3