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

    Napa Ram

    08/20/2021, 5:30 AM
    Hello is there a configuration for handle Landscape and Portrait UI in compose
    a
    • 2
    • 2
  • z

    Zoltan Demant

    08/20/2021, 5:55 AM
    Has anyone had success when using
    SaveableStateHolder.SaveableStateProvider()
    and
    AnimatedContent
    together? Whenever I try, the ui-state just seems to be lost after navigation; e.g. I can navigate between screens A/B/C while they keep their individual scroll-positions, but as soon as animated content enters the picture the scroll-positions are reset on each navigation. Id love to understand why this happens, if theres a way to work with it, or if I should just use
    Animatable
    and do the work myself?
    d
    d
    • 3
    • 30
  • c

    Colton Idle

    08/20/2021, 6:30 AM
    I want to add a slideIn and slideOut animation on a
    Image
    , but I want the animation state of the slideIn/Out to be driven by the scrollState of my Column. Is there any way to hook those up to each other?
    • 1
    • 2
  • a

    Alex

    08/20/2021, 8:02 AM
    Does anyone know if 1.1.0 is going to be released at any point in the near future? What is Googles release cycle? Is 1.1.0-alpha02 a safe version to migrate to (like it is with fragmentx for example)?
    z
    • 2
    • 2
  • c

    curtjrees

    08/20/2021, 8:30 AM
    Are there any potential flaws with using
    DisposableEffect
    to handle tracking screen views? Seems it’s a pretty good fit to know when a Composable is shown on screen and then knows when it leaves the screen as well It’s not really a operation that needs cleaning up though, so maybe doesn’t fit the typical use case of
    DisposableEffect
    d
    s
    • 3
    • 8
  • j

    Jason Ankers

    08/20/2021, 8:54 AM
    Myself and @Nathan Castlehow at Vitruvian recently had the opportunity to rewrite our react native app entirely in compose. It took us about 6 months, and we’ve seen dramatic improvements in all areas. We couldn’t be happier with the decision to choose compose, huge thanks to the team and community! We’d love if you checked it out 😉
    ❤️ 14
    👀 1
    a
    t
    • 3
    • 5
  • a

    Alex

    08/20/2021, 9:00 AM
    Is there a way to get proper hyphenation in compose?
    j
    • 2
    • 1
  • s

    Stanislav Pestov

    08/20/2021, 9:54 AM
    Is there a way to show preview of the left and right pages of a fixed size with accompanist
    Pager
    without parent measuring with BoxWithConstraints/SubcomposeLayout?
    z
    c
    c
    • 4
    • 8
  • e

    Ernestas Balčiūnas

    08/20/2021, 11:19 AM
    Been searching for a while, is there a way to extract text from resource id in compose while testing it? All the matchers expect text as string
    a
    • 2
    • 2
  • c

    Cacato86

    08/20/2021, 11:21 AM
    Hi! Do you know if it’s possible to change the size of the
    CheckBox
    . I’m taking a look on the internal implementation and it defines his size as a private val
    private val CheckboxSize = 20.dp
    . I don’t know why some Framework components are not be able to change their size. Same for the padding, it has an internal padding
    private val CheckboxDefaultPadding = 2.dp
    and I can’t figure out how to get rid of it.
    s
    a
    +3
    • 6
    • 13
  • p

    Piotr Prus

    08/20/2021, 11:33 AM
    Consider a Composable function with Logger at very first line. If I see the logs few times or dozens, is that means my Composable is recreated that amount ? Or simple Log.d() is not sufficient to judge that?
    c
    • 2
    • 1
  • h

    hussan

    08/20/2021, 12:22 PM
    Hi, can I set a Spanned to Text( ) ?
    a
    • 2
    • 1
  • n

    Nick

    08/20/2021, 1:19 PM
    How anal is it to use state hoisting? My screen params are starting to build up a lot of `OnClick() -> Unit`’s . Is it preferred that I pass the viewmodel around at this point? I was trying to avoid that because then I can’t preview the screen at all.
    ➕ 2
    t
    s
    +2
    • 5
    • 9
  • s

    Stylianos Gakis

    08/20/2021, 1:38 PM
    Okay I am sure this has been asked before in some form, but I am still being confused about how to properly collect flows from a VM inside my composables. More in Thread 🧵
    ☝️ 1
    a
    a
    n
    • 4
    • 14
  • n

    nlindberg

    08/20/2021, 1:42 PM
    Is there any setting or similar in compose to show rerenders visually like they have in flutter? https://flutter.dev/docs/development/tools/devtools/inspector#highlight-repaints
    s
    • 2
    • 4
  • m

    Marco

    08/20/2021, 2:10 PM
    Hi guys, I'm fighting with a problem that seems trivial. Currently I have a
    Button
    that contains a
    Column
    (that contains other stuff), but I want that this column fills the remaining space inside the
    Button
    , basically I want that the column fit all the space inside the Button. In the old world I was used to put
    match_parent
    width.
    .fillMaxWidth()
    doesn't work well because in this way the buttons fills all witdh space in my composable. Any ideas?
    s
    j
    • 3
    • 12
  • n

    nglauber

    08/20/2021, 3:09 PM
    Is there an easy way to call a function just when the screen is opened? 🤔 Detailed explanation: Using Navigation, I’m opening
    ScreenA
    which I’m using
    LaunchEffect(viewModel) {
        viewModel.loadSomeData()
    }
    In this screen, somewhere in the future I call
    ScreenB
    . But when I go back to
    ScreenA
    , the
    loadSomeData()
    is called again… Is there a way to avoid that?
    l
    k
    +4
    • 7
    • 18
  • r

    rajesh

    08/20/2021, 4:28 PM
    I've implemented bottom bar in compose. When I click on bottom bar item once, it navigate to that section, but if I click on it again, it's not showing that section. What am I missing here? (code is in thread)
    c
    t
    • 3
    • 7
  • t

    Tash

    08/20/2021, 5:15 PM
    Is there a preference between providing
    Text
    its
    color
    via a
    TextStyle
    (esp when using a
    TextStyle
    is coming from a
    Theme.typography
    ), vs via the
    color
    parameter? i.e.
    Text(style = MyTheme.typography.title.copy(color = #123456))
    
    VS
    
    Text(style = MyTheme.typography.title, color = #123456)
    trying to choose the “best” approach in this case
    h
    • 2
    • 1
  • a

    Abhishek Dewan

    08/20/2021, 5:34 PM
    Can someone explain to me why after upgrading to compose stable this code would fire the sideeffect twice after launching the app
    SideEffect {
            viewModel.getPlatforms()
        }
    In other words viewModel.getPlatforms fires twice where as it didn’t use to be the case before. Perhaps I was misusing the api before
    o
    z
    • 3
    • 3
  • s

    Shakil Karim

    08/20/2021, 6:53 PM
    Is there any performance improvement/benefit in using `lazy Column`/`Row` vs `verticalScroll`/`horizontalScroll` if there are only 5 to 10 items to show? but items will recompose multiple times.
    z
    s
    t
    • 4
    • 11
  • l

    Lorenzo Benevento

    08/20/2021, 8:12 PM
    How do you handle text capitalization in Button()? The text gets automatically styled with Typography.button as far as I understood but it doesn't seem to be actually capitalizing it.
    c
    l
    • 3
    • 3
  • j

    Jason Inbody

    08/20/2021, 11:16 PM
    Is there any example code on how to use the google sign in button in jetpack compose? Or do I need to wrap the google sign in button in an android view?
    • 1
    • 1
  • j

    Jason Inbody

    08/21/2021, 1:54 AM
    How do I use onActivityResult if FB's SDK is eating the intent and I cant use
    rememberLauncherForActivityResult
    because there's no intent to send into the launcher
    • 1
    • 4
  • z

    Zach Klippenstein (he/him) [MOD]

    08/21/2021, 2:03 AM
    Is there any way to write a compose test to check for certain behavior when a composition fails? E.g. logic in
    RememberObserver.onAbandoned()
    👀 2
    c
    • 2
    • 3
  • a

    Anton Dmytryshyn

    08/21/2021, 3:27 AM
    Is there a way to run a callback when a composable is finished animating it's transition in? In my use case I have a BottomSheetScaffold with a constant peekheight. However, when We use an animation, to navigate to the screen, it looks off as the bottom sheet slides towards the bottom nav bar, with a visible gap to begin with in between. I would like to show the sheet after the transition is done animating in.
    d
    d
    i
    • 4
    • 15
  • j

    Jason Inbody

    08/21/2021, 3:55 AM
    Does anyone know how fragments work in jetpack compose? the documentation has a bunch of holes in its examples https://developer.android.com/jetpack/compose/interop/interop-apis#compose-in-fragments.
    i
    • 2
    • 8
  • c

    Colton Idle

    08/21/2021, 6:10 AM
    I have a bottom sheet. When collapsed the padding on top of the text is perfect (according to my designer), but when it's fully expanded, we want to add extra padding so that the text is pushed down. We want the bottom sheet to go all the way up because that's what our designer wants in our edge to edge application.
    sheet_before.mp4
    m
    j
    • 3
    • 12
  • a

    Adib Faramarzi

    08/21/2021, 6:53 AM
    Is there any way to get the
    size
    of the screen as a value? I thought it would be available in
    LocalDensity.current
    but it isn't.
    c
    a
    z
    • 4
    • 8
  • m

    Mjahangiry75

    08/21/2021, 10:39 AM
    I need to pass activity to
    Composable
    for billing stuff like the code bellow
    @Composable
    internal fun BillingScreen(activity: Activity, billingClient: BillingClient)
    is this a bad idea?
    a
    c
    • 3
    • 5
Powered by Linen
Title
m

Mjahangiry75

08/21/2021, 10:39 AM
I need to pass activity to
Composable
for billing stuff like the code bellow
@Composable
internal fun BillingScreen(activity: Activity, billingClient: BillingClient)
is this a bad idea?
a

Ashu

08/21/2021, 10:43 AM
This is bad, very bad. Why do you need to pass it to the composable.?? It should be the other way around.
Instead only pass the required state to render the ui.
m

Mjahangiry75

08/21/2021, 10:45 AM
to start purchaseflow of billingClient it needs an activity instance
a

Ashu

08/21/2021, 11:06 AM
but compose is just for ui, your purchase flow should start in activity/viewmodel and should be triggered by events from ui
☝️🏻 1
☝️ 1
c

Colton Idle

08/21/2021, 4:37 PM
@Mjahangiry75
@Composable
internal fun BillingScreen(navigationAction: () -> Unit, billingClient: BillingClient)
then when something is clicked in BillingScreen you send that event up to your activity or navHost or whatever and it can handle the navigation.
View count: 2