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

    aniruddha dhamal

    03/24/2021, 2:28 PM
    Want to understand how recompose work in following case. In case, uber state from view model is directly passed to all composables instead of passing state that individual composable need. Would that cause recompose on all composables? In the end, it will be calling basic composable (e.g Text) which won't trigger to regenerate UI but does it have any impact on performance issue since parent composables are revomposed? Or its just best practice to send the state what individual composable needs.
    j
    • 2
    • 5
  • d

    dewildte

    03/24/2021, 4:20 PM
    The answer to this may be “it depends” but I want to know which is generally better. From the
    ViewModel
    is it better to expose a single state object or multiple objects that make up the state? For example let’s say I have two properties
    title: String
    and
    isComplete: String
    that could change over time. The first option would be to wrap them up like so:
    data class State(
      val title: String = ",
      val isComplete: Boolean = false
    )
    And then exposing it like this:
    // MyViewModel.kt
    val state: StateFlow<State>
    And consuming it like this:
    @Composable
    fun ToDoUI(viewModel: MyViewModel) {
      val state by viewModel.state.collectAsState()
      ...
    }
    OR is it better to decompose the state and expose it like so:
    // MyViewModel.kt
    val title: StateFlow<String>
    val isComplete: StateFlow<Boolean>
    And then consume like this:
    @Composable
    fun ToDoUI(viewModel: MyViewModel) {
      val title by viewModel.title.collectAsState()
      val isComplete by viewModel.isComplete.collectAsState()
      ...
    }
    What are the ramifications for my composables between the two? Is there any performance issues or “gotchas” I should be aware of here?
    j
    s
    • 3
    • 21
  • a

    alorma

    03/24/2021, 5:30 PM
    What is the current way to add a click to a card... that clips the ripple into the card shape?
    j
    s
    +2
    • 5
    • 18
  • o

    oday

    03/24/2021, 5:39 PM
    in Android Studio 4.1.3 there’s a Compose plugin, does this mean I can develop with Compose on stable Android Studio?
    j
    • 2
    • 3
  • g

    Gabriel

    03/24/2021, 9:37 PM
    Basic question, sorry, is there a better way to do what I want to do here? This doesn't actually appear to work:
    var modifier = Modifier
    	if (isSelected) {
    		modifier.border(2.dp, Color.White)
    	}
    s
    s
    • 3
    • 14
  • j

    julioromano

    03/24/2021, 9:40 PM
    @Manuel Vivo Re: https://medium.com/androiddevelopers/a-safer-way-to-collect-flows-from-android-uis-23080b1f8bda Was wondering if a similar utility composable function would eventually find its way in compose in order to reduce boilerplate even further:
    @Composable
    fun <T> Flow<T>.rememberWithLifecycle(
      minActiveState: Lifecycle.State = Lifecycle.State.STARTED
    ): Flow<T> {
      val lifecycleOwner = LocalLifecycleOwner.current
      return remember(this, lifecycleOwner) {
        flowWithLifecycle(lifecycleOwner.lifecycle, minActiveState)
      }
    }
    P.S. Please read the thread to get an understanding of why this approach is probably a not very good idea.
    👍 1
    a
    m
    • 3
    • 7
  • c

    Colton Idle

    03/25/2021, 1:57 AM
    Did beta03 release today? There's typically a part in here about it. 😁
    j
    r
    +5
    • 8
    • 14
  • t

    Tlaster

    03/25/2021, 7:22 AM
    Just wonder I can only find
    PointerInputChange.consumePositionChange()
    but where is
    PointerInputChange.consumePositionChange(x, y)
    ? I remember there is one before.
    j
    • 2
    • 1
  • m

    Mehdi Haghgoo

    03/25/2021, 7:55 AM
    When using Bottom Navigation with Scaffold, I cannot navigate to nav graph destinations inside the same scaffold. The app keeps crashing.
    • 1
    • 1
  • s

    Spikey Sanju

    03/25/2021, 8:46 AM
    Hey Guys, Just wondering, how to measure
    width
    and
    height
    inside
    Box Layout
    ? Like we do in canvas layout?
    k
    • 2
    • 2
  • m

    mmaillot

    03/25/2021, 10:13 AM
    Question about compose and animation. I have a list of bubble which I want to animate. I have this code: https://gist.github.com/m-maillot/24ab08f338023bf306109d78355790fd A list of bubble will be updated every second by the viewModel. This part works 🙂 The problem comes from the composable
    when
    in the composable function
    Bubble(bubble: Bubble)
    which break the padding animation. If I directly use the
    fun Bubble(isBig: Boolean)
    , the padding animation works. Why a
    when
    condition will break the animation ? (here my case is simple, it’s a boolean but it can be a sealed class). Edit: put code in a gist.
    f
    a
    • 3
    • 13
  • u

    Utkarsh Tiwari

    03/25/2021, 10:37 AM
    How can I control the tint of a composable A from within Composable B, provided A is passed into B as a param?
    • 1
    • 1
  • g

    Geert

    03/25/2021, 10:47 AM
    I have this layout where I have a row with multiple Texts. Now I noticed that the last text is arranged weirdly. Is it possible to put multiple Texts in a row and then go to the next line when the row is full (like a column?)
    j
    • 2
    • 3
  • j

    julioromano

    03/25/2021, 10:57 AM
    How to convert a compose
    Color
    into an old-fashioned
    @ColorInt
    ?
    ✅ 1
    j
    • 2
    • 1
  • p

    patrick

    03/25/2021, 12:22 PM
    I played around a bit with Lelands Countdown (https://github.com/lelandrichardson/compose-dogfooding/tree/main/Countdown) and noticed that the performance of such a simple animation was not really that great (turned on the HWUI bars overlay) even on a High-End Device (Galaxy S21). For some reason these bars look better when I touch the screen vs when I don’t. Even when there is no pointerInput Modifier added for some reason the performance is better when I touch the screen anywhere 😮. Is this expected or is there anything I can do to improve it? (Video + Code in :thread-please: )
    :thread-please: 1
    😨 1
    r
    y
    +4
    • 7
    • 26
  • m

    Michal Klimczak

    03/25/2021, 1:07 PM
    Is there something like ScrollView
    fillViewPort
    but for
    LazyColumn
    (or
    Column
    )? The point is to do something like this.
    a
    n
    • 3
    • 6
  • j

    julioromano

    03/25/2021, 1:18 PM
    When using
    Card
    with a
    backgroundColor
    that has an alpha value (i.e. not 00 and not FF) I’m seeing visual artefacts in the form of a border around the card. See attached image (code in 🧵), is this working as intended or is this a bug?
    ✅ 1
    l
    t
    +3
    • 6
    • 8
  • d

    Deepak Gahlot

    03/25/2021, 1:26 PM
    Hi All, Any idea how does the animation works for NavHostController
    f
    • 2
    • 3
  • k

    Kshitij Patil

    03/25/2021, 1:32 PM
    Has anyone noticed
    BottomNavigationItem
    ripple freeze on frequent changes?
    ➕ 1
    c
    a
    +2
    • 5
    • 15
  • t

    tieskedh

    03/25/2021, 1:50 PM
    Maybe an "dumb" question, but is it possible to embed a fragment in Jetpack compose (So not Jetpack compose inside a fragment)?
    j
    c
    i
    • 4
    • 8
  • s

    skwalking

    03/25/2021, 2:08 PM
    Why for -Var isSelected -Val backgroundColor I'm getting weird error: "Type 'TypeVariable(T)' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate" when using 'by' keyword. No error when using '='
    j
    m
    • 3
    • 3
  • c

    Colton Idle

    03/25/2021, 2:10 PM
    I feel silly, but if I try to have a Row that contains a single line of text and a 24 x 24dp icon, the icon gets cut off. What am I doing wrong? Code in thread
    a
    t
    • 3
    • 19
  • k

    Kshitij Patil

    03/25/2021, 2:27 PM
    Just updated to compose
    beta03
    with zero lines of code change, that’s crazy 🤯
    🎉 6
    a
    • 2
    • 1
  • k

    Ky

    03/25/2021, 2:52 PM
    Is there any way to adjust corner radius on LinearProgressIndicator?
    a
    • 2
    • 3
  • m

    Maik

    03/25/2021, 3:06 PM
    Since the change to version "beta03" I get the following error message when I try to animate an Animatable with animateTo in a suspend function.
    exception: java.lang.IllegalStateException: A MonotonicFrameClock is not available in this CoroutineContext. Callers should supply an appropriate MonotonicFrameClock using withContext.
    How can I give the context the appropriate clock?
    a
    c
    • 3
    • 3
  • y

    Yahor

    03/25/2021, 3:33 PM
    Hello. Has anyone faced the same issue? If I resize the Activity with composable screen, than I see only blank screen. The fix is a restart application 😄
    i
    f
    • 3
    • 4
  • m

    Marko Novakovic

    03/25/2021, 3:35 PM
    how to recreate
    Toolbar
    enterAlways
    scrollBehavior
    ? is there built if way or I have to animate
    AppBar
    myself when scroll direction changes?
    j
    • 2
    • 2
  • c

    Colton Idle

    03/25/2021, 5:01 PM
    Is it possible to create a component like this in compose which will behave like the top when there is a lot of text, but show like the bottom when there's not a lot of text?
    s
    b
    +3
    • 6
    • 18
  • m

    Marko Novakovic

    03/25/2021, 7:18 PM
    Could not find androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-beta03
    what’s up with this?
    a
    i
    +2
    • 5
    • 15
  • n

    Neal Sanche

    03/25/2021, 10:05 PM
    I'm curious about the current state of text input fields in Compose. For example, I've seen that they don't support the hardware keyboard when running in an emulator. What about some of the other features such as support for things like Google Smart Lock, or offering autofill for passwords, or some of the other special features that were built into text fields over time? Magnifier support? Anyone willing to comment on these ones?
    🤔 4
    s
    i
    • 3
    • 3
Powered by Linen
Title
n

Neal Sanche

03/25/2021, 10:05 PM
I'm curious about the current state of text input fields in Compose. For example, I've seen that they don't support the hardware keyboard when running in an emulator. What about some of the other features such as support for things like Google Smart Lock, or offering autofill for passwords, or some of the other special features that were built into text fields over time? Magnifier support? Anyone willing to comment on these ones?
🤔 4
s

Siyamed

03/26/2021, 9:19 PM
• Hardware keyboard support was recently added. • Autofill should be there but i am not 100% sure about integration • Magnifier, smart select will not be in 1.0 but in our plans • I don't know what smart lock is
n

Neal Sanche

03/26/2021, 10:40 PM
Thanks. Smart lock is probably dead. Obscure stuff, used it a long time ago. Thanks for the updates on the rest.
i

Ian Lake

03/27/2021, 9:36 PM
Yeah, Smart Lock was ~entirely subsumed by Autofill + One Tap sign in: https://developers.google.com/identity/one-tap/android/get-saved-credentials
🙏 1
View count: 3