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

    Tgo1014

    07/27/2021, 9:18 AM
    I’m having a bit of issue to display my own app icon. Right now I’m trying the following
    Icon(ImageBitmap.imageResource(R.mipmap.ic_launcher), contentDescription = null)
    And I’m receiving:
    java.lang.ClassCastException: class android.graphics.drawable.AdaptiveIconDrawable cannot be cast to class android.graphics.drawable.BitmapDrawable
    m
    m
    • 3
    • 9
  • s

    Slackbot

    07/27/2021, 9:29 AM
    This message was deleted.
    a
    m
    • 3
    • 2
  • s

    Shakil Karim

    07/27/2021, 11:05 AM
    Is the Type still consider Immutable/Stable for Compose? if the class is something like this 🧵
    n
    m
    • 3
    • 6
  • m

    Mehdi Haghgoo

    07/27/2021, 11:36 AM
    Where in the build.gradle file should I add compiler options "-Xopt-in=kotlin.RequiresOptIn"?
    a
    • 2
    • 1
  • f

    Fanilog

    07/27/2021, 12:19 PM
    Question for those who are using LazyColumn (version 1.0.0-rc02). Do you feel that LazyColumn (with pager) feels a bit laggy? On older device feeling that it’s skipping frames 🤔
    👀 1
    v
    a
    • 3
    • 11
  • b

    bodo

    07/27/2021, 12:39 PM
    Is it possible to load network images in the compose preview?
    n
    c
    • 3
    • 4
  • p

    Paul Woitaschek

    07/27/2021, 1:17 PM
    Is there some kind of debug functionality for recomposition? I'd like to have a mode where a section of the screen flashes when it get's recomposed.
    ➕ 10
    c
    l
    a
    • 4
    • 5
  • j

    julioromano

    07/27/2021, 1:59 PM
    A colleague of mine tested one of my compose apps on a “Moto Z2 Play” running Android 9.0 and it turned out all composables render always in dark mode. Android 9 didn’t have dark mode yet but it had a “device theme” setting under “settings -> display -> advanced”. It seems changing that has no effect whatsoever. Every composable in the app is always displayed as if
    isSystemInDarkTheme()
    always returned
    true
    . I have tested on an API28 emulator and can’t reproduce: the composables are always rendered in light mode (as they are supposed to). Has anyone encountered a similar situation?
    c
    n
    • 3
    • 3
  • a

    Anastasia Rozovskaya

    07/27/2021, 2:27 PM
    Hello! What is your attitude to compose functions, wrapped into class/object? The reason behind this question states like this - “when you start typing name of some object, first things AS proposes you is compose functions even in scopes related to domain/data layers”.
    b
    a
    • 3
    • 5
  • t

    Tiago Nunes

    07/27/2021, 3:05 PM
    Hey everyone, I have a list of images that I’m saving locally, when entering the screen. I want to show them all at the same time when they are ready, in a LazyRow. To do this, I’m using produceState, to try to download the images, and return the Files of those downloaded successfully:
    val imageFiles = produceState(initialValue = emptyList<File>(), imageRefs) {
      imageRefs.map { imageRef ->
        async {
          downloadItemImage(imageRef, file)
        }
      }.awaitAll().filterNotNull()
    }
    Then, I’d like to map this List<File> to a List<Painter>, and send it to my ImagesRow composable, like this:
    val painters = imageFiles.value.map { file ->
      rememberImagePainter(file)
    }
    ImagesRow(painters = painters)
    Problem is: The painters aren’t being updated when imageFiles is updated. Any ideas?
    z
    • 2
    • 3
  • c

    Colton Idle

    07/27/2021, 4:37 PM
    I'm building an app for a kiosk. Full compose. I'm trying to add a "debug" dialog that pops up if you click the same "empty" spot on the screen 10 times in 5 seconds. I initially added this on the activity level by overriding my activities
    dispatchTouchEvent
    method, but now I'm thinking if it'd be possible to have another wrapper composable just inside my Theme declaration that would be able to do the same thing. i.e. Change this
    MyAppTheme {
     Scaffold { .. }
    }
    to this
    MyAppTheme {
     DebugDialogTouchInterceptor {
      Scaffold { .. }
     }
    }
    Does anyone know if it'd be possible to write something like that in compose?
    a
    f
    • 3
    • 6
  • d

    dimsuz

    07/27/2021, 4:51 PM
    Is there an inverse
    lerp
    in Compose? Like when I have
    start=10.dp
    ,
    end=20.dp
    ,
    current=15.dp
    and want to feed this to that function and receive
    fraction=0.5
    back.
    k
    • 2
    • 2
  • n

    Nacho Ruiz Martin

    07/27/2021, 5:13 PM
    Hey! I'm trying to send some events from any object (ViewModel, for example) to a Composable function. To do this I've though about using
    SharedFlow
    instead of
    StateFlow
    because this should be a hot observable. I'm trying to collect the Flow in the Composable with
    val state = flow.collectAsState(defaultValue)
    even if this feels weird because it's not a state. • The Composable is not being recomposed when a new event is send, how's that achieved? • Is there any better way to consume/collect/observe a SharedFlow in a Composable function?
    z
    k
    +8
    • 11
    • 115
  • e

    enighma

    07/27/2021, 7:03 PM
    regarding indications: Since last I looked at this the logic has been changed. Is there a way to change the indication of a material compose components? Button doesn’t expose and previously I could set my own provider. On that same subject how do I change the rippleTheme?
    c
    • 2
    • 3
  • l

    Landry Norris

    07/27/2021, 7:52 PM
    Has there been any progress on any community efforts to port Compose to K/N? I remember seeing that the Jetpack team won't necessarily make the port, so it would have to be a community effort. Some of the projects that I've seen seem promising, but stopped at some point.
    c
    v
    +3
    • 6
    • 21
  • r

    Rob

    07/28/2021, 2:34 AM
    It seems to me that Coroutine Context and Compose Local are just dynamically scoped variables. Is there any possibility that Jetbrains will implement dynamically scoped variables to unify these bespoke implementations?
    f
    c
    • 3
    • 7
  • c

    Colton Idle

    07/28/2021, 3:29 AM
    More out of curiosity than anything else, but does anyone know how to read this gerrit CL for when this update was merged? https://android-review.googlesource.com/c/platform/frameworks/support/+/1769505 I was attending an android conf today and someone mentioned they merged the version update today, but from what it looks like... this was actually merged on the 16th? Unless I'm reading gerrit incorrectly
    z
    • 2
    • 4
  • t

    Tgo1014

    07/28/2021, 8:11 AM
    I’m still having the issue where the app is impossible to build in the new canary 5. Does it happens to someone else? I thought such critical issue would be fixed in the new version 😕
    java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
    m
    m
    • 3
    • 4
  • r

    Rodri Represa

    07/28/2021, 10:39 AM
    https://twitter.com/rodriidev/status/1420330843755663361
    👍🏾 1
    👍 4
    c
    b
    • 3
    • 4
  • v

    Vitaliy Zarubin

    07/28/2021, 10:50 AM
    val navigateToRegOne: () -> Unit = {
        navController.navigate(GuestNavScreen.RegOne.route) {
            anim {
                enter = R.anim.slide_in
                exit = R.anim.fade_out
                popEnter = R.anim.fade_in
                popExit = R.anim.slide_out
            }
        }
    }
    Why the animation might not work? The page is displayed instantly.
    t
    • 2
    • 1
  • a

    Alejandro Rios

    07/28/2021, 12:57 PM
    I’m wondering if the Jetpack Compose release will include a new version of Android Studio as well
    :android-eyes: 3
    👀 5
    j
    h
    r
    • 4
    • 3
  • g

    Geert

    07/28/2021, 1:03 PM
    Is the onClick removed in Surface in 1.0.0-rc02? I see that my application is not responding to clicks anymore. It was experimental, is that why it fails?
    t
    b
    m
    • 4
    • 6
  • s

    Semyon Zadorozhnyi

    07/28/2021, 1:09 PM
    I have a question about navigation cases. Imagine we have Scaffold with BottomNav BottomNav has 3 items - HomeScreen, SettingsScreen, CreateOrderScreen When you click on Home or Settings NavHost just changes screens in Scaffold But when you click CreateOrder user should be navigated to completely standalone screen (like different feature) CreateOrder screen doesn’t have bottom navigation and can be written without Scaffold, but since NavHost is located inside Scaffold composable we need no configure BottomNav to be hidden. But when application is getting bigger this logic might grow. Is there a good example how to share NavHost outside of Scaffold and BottomNav and still use it as root Composable or how this case should be done in Compose? @Ian Lake
    z
    i
    • 3
    • 3
  • l

    lesincs

    07/28/2021, 1:28 PM
    What’s the best practice to manage state in JetPack Compose? See thread。
    👍 1
    z
    • 2
    • 7
  • c

    Chachako

    07/28/2021, 1:29 PM
    I want to know if the navigation transition has been available (including SharedElements). I am a bit curious, how to design to interact between widgets in the case of ComposeNode-APIs is not open
    s
    i
    d
    • 4
    • 5
  • a

    alorma

    07/28/2021, 1:34 PM
    C'mon google! Push the deploy button!
    👀 2
    😂 10
    :jetpack-compose: 19
    :android-eyes: 5
    🚀 7
    :party-parrot: 7
    :kotlin-intensifies: 23
    :google: 4
    h
    b
    m
    • 4
    • 4
  • t

    Tash

    07/28/2021, 2:30 PM
    Noticed that Accompanist-Glide library is now deprecated (as of v0.14), had some questions around this: • Why was this done? Is Coil the recommended official solution? • For existing Android Views that use Glide, is Glide -> Coil migration now a pre-requisite of Android View -> Compose migration?
    😏 1
    t
    c
    • 3
    • 5
  • b

    bodo

    07/28/2021, 2:32 PM
    I am currently trying to integrate compose in my existing app… nearly all screens are build with a recyclerview and round about 200 different viewholder types…. every screen can display all of this viewholder types. so my problem is that i can´t migrate all types at once and i created a viewholder with a composeview where i can call the migrated stuff
    fun bindView(item) {
      composeContainer.setContent {
        MyCustomTheme {
          item.Content()
        }
      }
    }
    1. Is it a good practice to do migration like this. i noticed that every call to MyCustomTheme creates new CompositionLocals that i create in it 2. will the view be recomposed every time the bind method is called?
    z
    • 2
    • 3
  • g

    Geert

    07/28/2021, 3:25 PM
    I just updated Android Studio and build.gradle to use compose 1.0.0-rc02 but since then some of my files wont work. I already invalidated cache and restarted AS and PC.
    k
    a
    h
    • 4
    • 13
  • t

    Tin Tran

    07/28/2021, 3:44 PM
    Hi! Is this issue being considered? https://issuetracker.google.com/issues/160665122
    a
    z
    • 3
    • 3
Powered by Linen
Title
t

Tin Tran

07/28/2021, 3:44 PM
Hi! Is this issue being considered? https://issuetracker.google.com/issues/160665122
a

alorma

07/28/2021, 3:45 PM
put it on a link form instead of code, please, 🙏 Otherway we have to copy it manually, and doing it on mobile is tedious
t

Tin Tran

07/28/2021, 3:48 PM
edited
z

Zach Klippenstein (he/him) [MOD]

07/28/2021, 4:07 PM
I don’t think it has enough +1 comments yet 😜
:plus-one: 3
View count: 3