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

    gpaligot

    10/27/2021, 8:00 PM
    Hi here! I would like to know if it is possible to extends the clickable zone of a
    Checkbox
    or it is impossible? I tried to add a padding in the modifier of the composable but it doesn't work.
    c
    c
    • 3
    • 7
  • t

    Tolriq

    10/27/2021, 8:25 PM
    Seems also Material3 colorScheme no more have the concept of isLight, this was super useful to set the status bar icons dark / light mode or to know what palette to extract from images. What would be the new way to achieve that without passing a value all over the app compoenents that needs that info?
    👀 1
    a
    • 2
    • 4
  • a

    Alexander Karkossa

    10/27/2021, 9:08 PM
    Material3 seems to break the existing themings. If you want to switch from Material2 to Material3, you have to rework every single composable and rethink the existing typography and coloring scheme. Is that the way it's supposed to be?
    ➕ 2
    i
    f
    • 3
    • 5
  • l

    Lucas Reis

    10/27/2021, 10:37 PM
    Hello! I already searched a lot about conditional
    BottomNavigation
    here but didn't found a solution for something I have in my project. We created a
    AuthScreen
    in
    composable()
    that don't need to have a
    BottomNavigation
    and it's the first screen of the App. I have only one
    Scaffold
    for the app that encapsulates the
    NavHost
    . I added a conditional logic on the
    BottomNavigation
    to only show when the current route is equal to some screens but not for the
    AuthScreen
    , similar to how this works on the compose samples. Everything works fine, but I notice when the
    AuthScreen
    transitions to my
    HomeScreen
    (that is a route that has the
    BottomNavigation
    ) the
    BottomNavigation
    appears before the
    AuthScreen
    fades away, and I found this behaviour a little strange, I think that it's something to do with the fade animation of navigation compose, anyone has this problem too and found a solution? I tried putting
    Scaffold
    in all screens that has the
    BottomNavigation
    but I think this is not good, since
    Scaffold
    is better to be shared throughout the application.
    i
    • 2
    • 7
  • i

    itnoles

    10/28/2021, 12:52 AM
    No more ListItem and Card in Material3?
    r
    • 2
    • 3
  • c

    Colton Idle

    10/28/2021, 1:03 AM
    "Glance uses Compose Runtime and Compose-like syntax, but is an independent framework" 🤔 So we have Compose RT, Compose UI, and now Compose remote view (widget) UI?
    👀 1
    :kotlin-intensifies: 5
    j
    r
    s
    • 4
    • 5
  • d

    Danish Ansari

    10/28/2021, 6:01 AM
    Is there any ETA when
    androidx.navigation.navigation-compose
    will be stable?
    a
    • 2
    • 1
  • a

    AmrJyniat

    10/28/2021, 7:39 AM
    When I set 
    isError = true
     to the TextField the border's color not becomes only Red but I see it's combination of PrimaryColor and Red, any tips about the issue?
    f
    • 2
    • 4
  • s

    solidogen

    10/28/2021, 8:08 AM
    how to pop the backstack I’m not currently on / all multiple backstacks at once (e.g. on logout)? [thread]
    ➕ 1
    a
    i
    • 3
    • 10
  • j

    JulianK

    10/28/2021, 8:35 AM
    Hi, I have a Row with some Columns. The content inside those columns have different intrinsic heights. I use IntrinsicSize to get same height on all columns. Now, i'd like to use a swipable Modifier, which seems to use SubcomposeLayout. This leads to the following exception:
    java.lang.IllegalStateException: Asking for intrinsic measurements of SubcomposeLayout layouts is not supported.
    One advice given is using a Custom Layout to avoid measuring, which I've tried, but how would i place the content without first calling measure?
    • 1
    • 1
  • f

    Florian

    10/28/2021, 9:13 AM
    I'm launching my MainActivity from a notification click. Through this intent, I'm sending a piece of data. How can I get this piece of data to the start destination? I'm using navigation compose.
    l
    • 2
    • 5
  • f

    Felix Schütz

    10/28/2021, 11:01 AM
    I finally got to implement one approach I mentioned in https://github.com/google/accompanist/issues/729: https://github.com/fschuetz04/compose-navigation-test. This is a very very bare-bones implementation, but it works surprisingly well. I still need to add all the fancy navigation stuff and animations. Can this approach be made compatible with AndroidX navigation?
    m
    • 2
    • 3
  • s

    steelahhh

    10/28/2021, 1:13 PM
    Running into a bug with the new
    *TopAppBar
    and scroll behavior combined with Accompanist's
    HorizontalPager
    . As soon as I add the
    Scaffold
    with the
    nestedScroll
    (as per docs), the pager cannot be scrolled anymore Code in 🧵
    o
    • 2
    • 2
  • g

    galex

    10/28/2021, 2:02 PM
    Does Compose have any issues with
    kotlin-android-extensions
    ? Meaning, both in the same module?
    z
    • 2
    • 2
  • l

    Lucas Reis

    10/28/2021, 2:10 PM
    Hello! Anyone knows if it's possible to use Scaffold with a BottomNavigation only on certain screens using navigation graphs (loginGraph, mainGraph, etc using nested navigation), I know that we can't use Composables on NavHost() but there is another way? In this way we can encapsulate the Scaffold only on parts of the app that needs BottomNavigation and we can control this state separately
    f
    i
    • 3
    • 21
  • d

    Diego

    10/28/2021, 3:25 PM
    Hi guys. I'm working on a trading app. I need to list the user stocks and their value (profit or loss) among with the total value of the portfolio. For the holdings list, in an MVP architecture I would create a presenter for each list item but for this app I decided to use MVVM (Compose, ViewModels and Hilt ). My first idea was to create a different ViewModel for each item of LazyColumn. When using MVVM architecture, is what I'm trying to do the correct way or I should use a single ViewModel? Are you aware about any project I could have a look at? The image below is a super simplification of my actual screen, each cell is complex and that's why I wanted to use a different ViewModel for each cell. Any suggestion is very welcome.
    d
    • 2
    • 2
  • c

    Colton Idle

    10/28/2021, 3:29 PM
    The live literals feature and @Preview annotation shown at AndroidDevSummit gets me excited to use that stuff, but I basically only use composable in a separate library. Was there an issuetracker for supporting @Preview in library modules that we could star? (I tried a quick search and no luck)
    a
    n
    • 3
    • 29
  • a

    Anthony Martin

    10/28/2021, 3:44 PM
    Material3 doesn't support EditTexts yet? Is this correct?
    b
    t
    • 3
    • 4
  • n

    nglauber

    10/28/2021, 5:15 PM
    Hi, I’m trying to migrate to the new compose version and facing this issue:
    Flow operator functions should not be invoked within composition
    Basically, almost all flows of my app are using something like this:
    val someStateInViewModel by viewModel.myState.flowInLifecycle()
        .collectAsState(initial = null)
    This
    flowInLifecycle
    function is doing the following:
    @Composable
    fun <T> Flow<T>.flowInLifecycle(): Flow<T> {
        val lifecycleOwner = LocalLifecycleOwner.current
        return remember(this, lifecycleOwner) {
            this.flowWithLifecycle(lifecycleOwner.lifecycle, Lifecycle.State.STARTED)
        }
    }
    Any suggestion? Because I’m using this function is 225 places in my app 😭
    w
    t
    a
    • 4
    • 5
  • a

    Arpit Shukla

    10/28/2021, 5:29 PM
    How can I create a translate animation in Compose, I have an image in top right section of my app and i want to animate it to the centre of screen when clicked. I am unable to figure out how to do this? What modifiers do I need to animate?
    d
    d
    • 3
    • 3
  • m

    Michael Langford

    10/28/2021, 7:00 PM
    Hi, I'm trying to untangle a tricky routing/data passing question in jetpack compose on android: We have 3 types of events we help users record. Think "I cut my toe, it's still got a scab". These sometimes reference past events, including ones of other types. Sometimes the users haven't created the past events. Events aren't officially created until the user hits a save button (as deleting is kind of hard, and we're matching iOS behavior). So let's say they make a BTypeEvent. BTypeEvents have a reference to an optional past BTypeEvent, (lets call it previousBEvent) , a past ITypeEvent, and a past ATypeEvent. In my routing table, I currently have entries like:
    composable ("/EntryEditor/BTypeEditor/${logEntryId}") {
        val existing = it.arguments?.getString(logEntryIdentifierName)
        EventEditorBType(navController = navController, eventStoreModel = eventStoreModel,        existing?.let{BTypeIdentifier(value = it)})
    }
    This successfully lets us edit new log items as well as select existing log items via nested navigation. Here is where the problem hits. When editing new log items, the log items only exist in the ViewModel of the EntryEditor as they aren't saved to the flow store, or the backend, so "deeper" events can't reference the "shallower" events by just parsing the route when the shallower events aren't yet saved to the eventStoreModel. We do need to not save the events until the user confirms they've entered everything to both match iOS and meet scientific needs of the tool. E.g. User hits "New BType" Floating Action Button on main screen. User partially enters in BType event. Hits "previous BTypeEvent" button on this Btype event. This launches a screen kinda like the main screen, except it only shows BType events. It does also have a + button. If the user selects an event, how do we easily pass this selected event back to the first editor screen? it's easy enough to go off the route to get the logEntryId in the case where the toplevel BTypeEvent is saved to the event store, however, when a new BTypeEvent event is being recorded, this avenue isn't available, as the event isn't yet in the event store. This problem also has to be "technically infinitely scalable" but de facto, like 8 levels deep scalable. A person could start to record a current BType record, start storing a new BType record about a past report on this topic, and in that, start storing a past BType record on this item. In iOS, this is easy, we don't use path based routing, so we can just push a list of BTypeEvents with a + button on it, and if the user hits plus, we let them record the event, save it, etc, then when we return, we call a closure which was passed to the invoked editor when we navigated. We can't pass such closures with jetpack. One idea I've had is to delve into the backstack to guess if you're saving events for "shallower" events by the path, but with this approach, I'm not sure how to get the reference to the previous screen from this and google is failing me there. I've heard the approach to "share a view model"...and that feels like a bit of a stretch with how "nested" all of this is and how complex saving that view model wold be, as only parts of it would save at a time. Any ideas folks?
    i
    • 2
    • 99
  • a

    Alexa_Gal

    10/28/2021, 7:33 PM
    hi guys have anyone noticed that some characters are not ignored when passing them in the arguments when using Navigation. i have my composable like
    composable("Screen.Login.route?email={email})
    and when i want to push to that screen like
    navController.navigate(Screen.Login.route?email=<mailto:user+test@example.com|user+test@example.com>)
    in the next screen ill get the email argument like
    user <mailto:test@example.com|test@example.com>
    without the
    +
    but that only happens when i use argumentes like
    ?foo={bar}
    no when i use something like
    /{bar}
    ✅ 1
    i
    • 2
    • 2
  • c

    Colton Idle

    10/28/2021, 9:33 PM
    Anyone have a working example of using a webview in Compose?
    a
    l
    • 3
    • 4
  • n

    Neal Sanche

    10/28/2021, 9:40 PM
    I have an app using Compose Navigation, and it is handling a deep link. The app processed the deep link just fine, however the user backgrounds the app and sometime later the app is returned to, and that same deep link is delivered to the app again. This time, however, since it's been processed already, returns an error. Is there any way to mark an intent in Android as 'processed' and not have it re-delivered to the app? I suspect the answer is no, but if anyone has an idea, I'd love to hear about it.
    i
    • 2
    • 12
  • y

    YASAN

    10/28/2021, 11:42 PM
    I am trying to add bottom sheet destinations using the material navigation accompanist but it keeps throwing this exception:
    java.lang.IllegalStateException: Could not find Navigator with name "BottomSheetNavigator". You must call NavController.addNavigator() for each navigation type.
    i
    • 2
    • 3
  • z

    Zoltan Demant

    10/29/2021, 5:14 AM
    Is anyone familiar with a crash related to
    Can't represent a size of X in Constraints
    ? Full stack-trace in thread! 🧵
    o
    • 2
    • 6
  • c

    Colton Idle

    10/29/2021, 6:27 AM
    I have a MainActivity that contains a Box with a navhost that's set to fillMaxSize and my bottomNavBar aligned to the bottom. My bottomNavBar is transparent and my content draws under it. It looks cool (like how my designers want), but now my content doesn't know how much padding to add under it so that the bottom piece doesn't get cut off. If I hardcode a height, it works fine, but is there some way to get the height of bottomNav in my navHost even though they are laid out on top of each other in a box?
    👀 1
    a
    • 2
    • 6
  • s

    Steffen Funke

    10/29/2021, 7:40 AM
    Hi there. Given that I have a
    LazyList
    with items, and each item performs an expensive calculation for itself (Think of very item constrained data, like loading an image, …). At the moment, as I scroll down and back up the list, the calculation is re-executed, as the item enters composition. This makes sense, but is not quite what I would like to achieve. Instead, I imagined some kind of
    LazyList
    built-in caching mechanism - since the input parameters of the items are known and not changed, and the calculation has already taken place once. So my questions are: • is there any way to “cache” such calculations over item compositions in a
    LazyList
    ,
    to avoid a re-calculation on item appearance? • I wrapped the calculation in a
    LaunchedEffect
    keyed by the input, but it does run every time item enters composition. Makes sense, but not sure if there is a better way? • Or is this totally wrong think, and I should implement this caching myself, e.g. with a ViewModel type of data holder? Some sample code, hope it makes sense 👉 Thanks!
    z
    • 2
    • 4
  • t

    therealbluepandabear

    10/29/2021, 7:51 AM
    Hey guys, I heard instant preview times for Compose are coming up in the latest Canary? Can someone validate it? Is this true?
    k
    • 2
    • 1
  • t

    Tanaka

    10/29/2021, 8:20 AM
    Hello devs. I was wondering is it possible to create homescreen widgets with compose?
    s
    a
    +3
    • 6
    • 8
Powered by Linen
Title
t

Tanaka

10/29/2021, 8:20 AM
Hello devs. I was wondering is it possible to create homescreen widgets with compose?
s

sindrenm

10/29/2021, 9:13 AM
It's on the roadmap: https://developer.android.com/jetpack/androidx/compose-roadmap
a

Albert Chang

10/29/2021, 9:25 AM
Announced yesterday:

https://youtu.be/15Q7xqxBGG0?t=569▾

🎉 3
n

Nat Strangerweather

12/10/2021, 7:50 PM
Is it too early to use at this point? The tutorial linked above looks fairly easy. Or is it best to use xml for now?
c

Chris Sinco [G]

12/10/2021, 8:04 PM
The API is pre-alpha so use at your own risk
🙂 1
b

Bryan Herbst

12/10/2021, 8:33 PM
I just played with it a bit for an innovation week - definitely a few rough edges so test thoroughly for your use case, and be wary of investing too much time right now if you run into issues.
Worked great for the innovation week though 😆
:kotlin-intensifies: 1
👍 1
n

Nat Strangerweather

12/10/2021, 9:13 PM
I'll try it for the fun. I started with Compose when it was in Alpha after all...
:kotlin-intensifies: 1
c

Chris Sinco [G]

12/10/2021, 9:22 PM
Yes you can certainly try it! But I do have to have the pre-alpha disclaimer to set expectations properly 🙂 • API will change • Docs may not exist and/or will change • Likely no codelabs • No tooling support in Android Studio
👍 1
😩 1
View count: 14