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

    Anthony

    07/20/2021, 3:41 PM
    When using a ModalBottomSheetLayout, is there a way to track when the user dismisses the modal bottom sheet by clicking on the screen above it and not on the predefined button to close the bottomsheet itself?
    b
    d
    • 3
    • 3
  • a

    alorma

    07/20/2021, 4:51 PM
    Hi! I have a
    DropdownMenu
    with some
    DropdownMenuItem
    I want to show some items with icon and some without... but i got this: code in 🧵
    c
    • 2
    • 3
  • a

    Alexa_Gal

    07/20/2021, 5:40 PM
    just upgraded to Arctic fox 3.1 RC 1 and the preview works perfect with 1.0.0-rc02 :cheers:
    🙌 6
    :kotlin-intensifies: 14
    🙌🏼 1
    k
    s
    • 3
    • 2
  • s

    Shakil Karim

    07/20/2021, 5:42 PM
    Hi, I have a data class, is it correct to mark this class as
    @Immutable
    and what will be the difference with
    @Stable
    Code in 🧵
    :kotlin-intensifies: 3
    c
    m
    • 3
    • 4
  • p

    Peter Mandeljc

    07/20/2021, 6:00 PM
    I'm trying to implement 2 different contents for
    ModalBottomSheetLayout
    and I'm having a weird effect, please see video. Sheet layout seems to visually collapse on start. Any ideas? Source code in thread.
    untitled.webm
    i
    • 2
    • 23
  • o

    orangy

    07/20/2021, 6:26 PM
    There are
    Dp
    ,
    DpOffset
    and even
    DpRect
    , but no
    DpSize
    … For some reason, I need
    DpSize
    much more often than offset or rect. Could you please add it for completeness?
    ✅ 1
    ➕ 4
    g
    • 2
    • 4
  • m

    Marko Novakovic

    07/20/2021, 7:41 PM
    does marking
    sealed class
    with
    @Immutable
    has any effect on subclasses?
    ➕ 1
    c
    d
    • 3
    • 2
  • t

    Tash

    07/20/2021, 9:14 PM
    Trying to create a server-driven theme system, and would like to measure where recompositions occur when some theme components are changed. What’s the best way to detect recompositions? Something like using
    SideEffect
    etc, and putting logs in it, or something?
    👍 2
    👍🏼 1
    t
    • 2
    • 2
  • o

    orangy

    07/20/2021, 9:49 PM
    What’s the proper way to create layout like this: • Row with many items • Each item is measured according to its content • Row height is max height of all items • All items are laid out to fill this height, so their content can be properly aligned to bottom or center ?
    j
    g
    +2
    • 5
    • 8
  • a

    allan.conda

    07/21/2021, 3:27 AM
    I have a question about state management for snackbars. Currently we followed previous suggestion here about having a
    showSnackbar
    state and clearing it in on result, If user navigates to another screen before the snackbar result, the composable is not able to update its result because of cancellation. Then the user goes back to the Composable with a new composition and shows the snackbar again. Is there a better way of handling snackbarstates? Code in thread
    i
    • 2
    • 4
  • t

    Tlaster

    07/21/2021, 7:59 AM
    Will the stable release of jetpack compose come with koltin 1.5.20?
    t
    j
    • 3
    • 2
  • t

    Tiago Nunes

    07/21/2021, 10:47 AM
    Hey everyone! With Jetpack Compose, we’re able to erase almost all use of LiveData (previously we used it to facilitate observing respecting the lifecycles). Yet we still use LiveData when using savedStateHandle in the ViewModel. Why is it that there isn’t a way to do this using Flow? For example, if we have a form with fields, we’ll usually write the logic for each field in the ViewModel like this (using savedStateHandle to keep the state in case of process death):
    val nameFieldLiveData = savedStateHandle.getLiveData(NAME_FIELD_KEY, "")
    val nameFieldFlow: Flow<String> = maxPassengersLive.asFlow()
    
    fun setNameField(name: String) {
       nameFieldLiveData.value = name
    }
    It would be great if there was a savedStateHandle.getFlow which returned a MutableStateFlow, right? Our main issue with LiveData is the fact that it holds a String! instead of a String. So in the case of my example, nameFieldFlow becomes a Flow<String!>, unless I specify the type explicitly. And I always forget to specify the type explicitly
    ☝️🏼 1
    ☝️🏾 1
    ☝️ 4
    a
    • 2
    • 2
  • a

    Anudeep Ananth

    07/21/2021, 10:57 AM
    I have question on how to take screenshots of a composable function programatically : 1. In My App, I let users choose an Image from their gallery, then write some text on top of the image in an EditText field 2. Allow them to drag the EditText field across the canvas which is the image that was just chosen 3. Then take a screenshot of the view as a Bitmap and upload the Bitmap to a cloud storage for other users to view I am having trouble with step 3, Is there currently a way to take screenshots ? Taking Screenshots were quite straightforward in xml layouts
    m
    • 2
    • 1
  • m

    mario

    07/21/2021, 11:29 AM
    Hello, I have a question about alerdialog, this component only can have a title and a text? according the API one alertdialog have these parameters
    title: (@Composable () -> Unit)? = null,
    text: @Composable (() -> Unit)? = null,
     both are composable but the name indicate something specific (text). I have tried to create a OutlinedTextField in text parameter with a strange result, it would not be better to create a content parameter?
    a
    e
    • 3
    • 20
  • s

    Shakil Karim

    07/21/2021, 11:49 AM
    Hi, I'm getting this error when deploying preview Composable to device
    androidx.compose.ui.tooling.preview.PreviewActivity is not an Activity subclass or alias
    is it a known issue ? using compose 1.0.0-rc02
    g
    v
    • 3
    • 12
  • g

    George Kylafas

    07/21/2021, 2:03 PM
    Is there a reason
    androidx.compose.ui:ui-util:1.0.0-rc02
    includes a
    fastMap()
    but not a
    fastMapIndexed()
    function? Would it be the same as if using kotlin std lib's
    mapIndexed()
    ?
    d
    a
    • 3
    • 5
  • b

    brandonmcansh

    07/21/2021, 3:15 PM
    Im assuming no, but is there currently a way to animate the
    BottomAppBarCutoutOffset
    of the BottomAppBar?
    a
    • 2
    • 14
  • r

    Rick Regan

    07/21/2021, 3:43 PM
    I have a
    Text
    that is made both
    .draggable
    and able to detect
    onTap
    (with
    .pointerInput
    detectTapGestures
    ) if a flag is true (and neither of those if the flag is false). The
    .draggable
    Modifier has an
    enabled
    parameter which I use for this purpose, but
    .pointerInput
    does not, so I add and remove it from the Modifier chain as appropriate. I tried adding
    .draggable
    in the same manner, for consistency, instead of using
    enabled
    , and it seems to work just as well. I was wondering though if there was any reason to prefer
    enabled
    over changing the Modifer.
    a
    • 2
    • 1
  • d

    dimsuz

    07/21/2021, 4:39 PM
    Was there any consensus reached on "using dp instead of sp" for text? For example if I'm a bad guy and want to ignore font scaling settings, can I do that without repeating conversion each time?
    k
    g
    • 3
    • 5
  • s

    Se7eN

    07/21/2021, 5:56 PM
    Just updated Android Studio to Bumblebee Canary 4, created a new project and got this error after launching the app
    java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
    I'm using compose 1.0.0-rc02 and activity 1.3.0-rc02. Does anyone know what's wrong? 🧵
    • 1
    • 2
  • d

    Daniel Burnhan

    07/21/2021, 8:03 PM
    Have a question about the navigation component. If I instantiate a class that is not a viewModel in the NavHost within one of the compose route elements, will this object be disposed of when navigating to another route? All the examples I see are specific to viewModel objects here.
    a
    i
    m
    • 4
    • 8
  • l

    Lukasz Burcon

    07/21/2021, 8:15 PM
    Hey, I’ve spend the last couple of hours figuring out when
    @Immutable
    and
    @Stable
    should really be used to make the most out of them. I couldn’t really find any use cases for them, as even marking a class with
    @Immutable
    annotation doesn’t mean it will always be skipped from recomposition after being altered (code in the thread). Does anyone have any code examples showing benefits of using either one?
    s
    l
    a
    • 4
    • 20
  • m

    mattinger

    07/21/2021, 9:10 PM
    Does anyone know if the release version of compose is going to support kotlin 1.5.20? It seems odd that it’s a full release, yet the rc01 of compose chokes if you try to use it:
    e: This version (1.0.0-rc01) of the Compose Compiler requires Kotlin version 1.5.10 but you appear to be using Kotlin version 1.5.20 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
    what’s even odder is that i’m using rc02 of compose and it’s compiler.
    👍 1
    e
    e
    +3
    • 6
    • 16
  • h

    hfhbd

    07/21/2021, 11:42 PM
    Hey, I am using Compose Build262, and the
    uiTooling
    dependency requires
    androidx.activity:activity-compose:1.4.0-alpha01
    , which is not (yet) published to https://maven.google.com/web/index.html#androidx.activity:activity-compose
    i
    • 2
    • 5
  • s

    Shawn Tucker

    07/22/2021, 12:00 AM
    Hello, I have multiple LazyRows inside a LazyColumn. I would like to be able to scroll one of the LazyRows and that the others will scroll as well. How can I achieve it? I have tried using rememberLazyListState() but with not luck (Only the last LazyRow scrolled, the others stayed)
    n
    d
    • 3
    • 9
  • t

    tad

    07/22/2021, 12:13 AM
    I made a terrible hack to get
    RenderEffect
    in Compose! https://gist.github.com/tadfisher/dc908504a7189be82c8df2151ede590b
    🤩 2
    👀 2
    c
    • 2
    • 2
  • j

    Jason Inbody

    07/22/2021, 1:31 AM
    This might be a dumb question but.... is there any way to download the official jetpack compose documentation? I'm boarding a red eye flight and was going to work on my app while flying but with no internet it might be a little annoying being new to compose.
    👍 1
    a
    e
    • 3
    • 2
  • s

    Sudhir Singh Khanger

    07/22/2021, 4:26 AM
    1. Is a variable cached by
    remeber
    function only initialized during
    Initial Composition
    or is it always initialized during
    recomposition
    but with the last saved value? 2. Is 
    val state: Int = remember { 1 }
     as good as 
    val state: Int = 1
     because in both cases 
    state
     variable is immutable and once it is initialized it can only be read? 3. In
    val state: MutableState<Int> = remember { mutableStateOf(1) }
    , can you do something like
    state.value = 2
    to change value of state and which would trigger recomposition.
    🙌 1
    r
    h
    +2
    • 5
    • 5
  • r

    rajesh

    07/22/2021, 6:37 AM
    In compose, how can we update single item in paging list (paging 3 library)? I wants to update paging list (
    like
    property of an object) when user click on like button.
    s
    a
    • 3
    • 8
  • v

    Vitaliy Zarubin

    07/22/2021, 8:51 AM
    Bumblebee (2021.1.1) Canary 4 - new project with compose crashed, old projects too (gradle = '7.1.0-alpha04')
    r
    m
    • 3
    • 3
Powered by Linen
Title
v

Vitaliy Zarubin

07/22/2021, 8:51 AM
Bumblebee (2021.1.1) Canary 4 - new project with compose crashed, old projects too (gradle = '7.1.0-alpha04')
r

Rick Regan

07/22/2021, 1:56 PM
See above: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1626890175184900
:thank-you: 1
m

Mark Allison

07/22/2021, 2:43 PM
It’s an issue with AGP 7.1.0-alpha04 https://issuetracker.google.com/issues/194289155
➕ 1
Quick solution: Rollback to 7.1.0-alpha03
🙂 1
:thank-you: 2
View count: 1