https://kotlinlang.org logo
Docs
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
  • c

    Colton Idle

    04/12/2021, 11:16 AM
    This might be a dumb question... but one thing I've always wanted to have in android is like a completely flexible emulator height and width so that I can "check" that my designs and layouts work on a WIDE range of android phones. This is just something I'm used to with web dev. Load my site. And just drag the bottom right hand corner to expand and contract the window. Could compose-desktop be used for "stress" testing my layouts like I envision or does compose desktop do something differently and I shouldn't bank on the compose desktop to match what would actually happen on my android device?
    dumb.mp4
    k
    e
    +2
    19 replies · 5 participants
  • s

    SrSouza

    04/12/2021, 12:16 PM
    Hi folks, do AGP stable supports Compose?
    p
    1 reply · 2 participants
  • a

    Arsen

    04/12/2021, 12:45 PM
    Hi, is it fine that size Modifiers from parent has more priority than from inline layout e.g. Column?
    🤔 3
    a
    5 replies · 2 participants
  • p

    Piotr

    04/12/2021, 12:54 PM
    Hi, got a question regarding Dialog, usually it has some horizontal padding, now generally it is fine, but right now i need a dialog, that will fill the entire width of screen, is there some simple way of doing that? I found a solution on stack that, i can add properties in style.xml, but it changes it for every Dialog i have, and thats not what i’m looking for. Anyone had similiar problem?
    t
    1 reply · 2 participants
  • a

    Alex

    04/12/2021, 1:38 PM
    Regarding the reuse of an Android View. Is there any way of unloading resources once the view is destroyed? I want to avoid leaking things.
    h
    3 replies · 2 participants
  • u

    Utkarsh Tiwari

    04/12/2021, 1:42 PM
    I have a composable A which I want to be allowed to be used only within composable B (kind of like make it internal to Composable B). Is there any way to achieve this?
    a
    6 replies · 2 participants
  • o

    Olivier Patry

    04/12/2021, 2:44 PM
    I have a difficulties to deal with the
    pointerInput
    Modifier
    , I try to implement a custom drag behavior. Based on a position on a
    Box
    I compute a color. If I use
    var color by remember { mutableStateOf(initialColor) }
    inside my composable and update color value based on drag position it works. If I extract a state (to allow parent composable to consume it), and hoist it, it doesn't work anymore. My understanding is that the value captured by
    onDrag
    is stale and still consider the initial value used and never update it. I don't understand the difference with state being hoisted or inline within Composable… (code in thread)
    a
    36 replies · 2 participants
  • r

    Rafal

    04/12/2021, 4:02 PM
    Hi 👋 Do you know where I can get those samples from? I see them in docs but can’t find them when clicking on the link
    c
    j
    +1
    6 replies · 4 participants
  • j

    james

    04/12/2021, 11:19 PM
    when using LazyRow to show a list of items, at what point do views of items which are scrolled out-of-view get cleaned up/recycled?
    z
    a
    4 replies · 3 participants
  • c

    Chris Fillmore

    04/13/2021, 12:38 AM
    Is it possible to get a hardware-accelerated Canvas in Compose? I’m doing some canvas drawing currently with
    SurfaceView.lockHardwareCanvas()
    . I didn’t see anything here about it: https://developer.android.com/jetpack/compose/graphics
    n
    9 replies · 2 participants
  • m

    ms

    04/13/2021, 6:06 AM
    Hello all, I'm using
    HorizontalPager
    . When I run the app, I get
    java.lang.NoSuchFieldError: No static field Companion of type Landroidx/compose/foundation/layout/BoxScope$Companion; in classLandroidx/compose/foundation/layout/BoxScope; or its superclasses (declaration of 'androidx.compose.foundation.layout.BoxScope' appears in /data/app/~~t1Ai-4vbEvAZ8lELuEQ7cA==/com.partnersincrime.focuslauncher-I6-eS_JANYdA0QptWYtpzA==/base.apk)
            at com.google.accompanist.pager.Pager.Pager(Pager.kt:461)
            at com.google.accompanist.pager.Pager.HorizontalPager(Pager.kt:147)
    a
    4 replies · 2 participants
  • n

    Noé Casas

    04/13/2021, 8:08 AM
    Is it possible to have nested scrolling but with a scrollable component inside a draggable component? For example: a vertically draggable bottom drawer that can only be dragged up to a certain height and, inside it, a LazyColumn; in this case, when the bottom drawer has been dragged up to the maximum height, I would like the LazyColumn to receive the gesture as scroll.
    t
    2 replies · 2 participants
  • g

    Guilherme Delgado

    04/13/2021, 8:24 AM
    Here’s my latest medium post Compose, Camera and Canvas, it’s about creating a custom view using Jetpack Compose with the help of canvas and camera for 3D transformations. Also, this is the final result, had lots of fun developing it, maybe you find it worthwhile reading 🙂 thanks.
    👏 10
    🆒 5
    👏🏻 1
    a
    j
    3 replies · 3 participants
  • s

    Sudhir Singh Khanger

    04/13/2021, 9:31 AM
    Is there an easier way to preview
    CoilImage()
    similar to
    <ImageView tools:src="@tools:sample/avatars" ... />
    or possibly any alternatives to quickly viewing image composable while designing a screen?
    j
    v
    5 replies · 3 participants
  • c

    Colton Idle

    04/13/2021, 10:32 AM
    Is there any out of the box way to support the password toggle that came with material android/xml?
    k
    r
    +1
    7 replies · 4 participants
  • a

    Andrew Max

    04/13/2021, 11:22 AM
    Hello everyone. I'm new to Jetpack Compose and was experiencing a problem implementing it. Any assistance would be highly appreciated: https://stackoverflow.com/questions/67073647/java-lang-nosuchfielderror-no-field-companion-of-type-landroidx-compose-foundat
    a
    g
    4 replies · 3 participants
  • e

    efemoney

    04/13/2021, 12:02 PM
    Do compose material surfaces get that superpower where if two surfaces have the same elevation, and are placed on top one another or side by side, they are merged (somewhat) into one surface? (CardViews in View system have this ability; at least on recent android api levels) 🤔 (if no, how can I fake it?)
    c
    1 reply · 2 participants
  • l

    Lilly

    04/13/2021, 1:19 PM
    I try to migrate from
    compose-router
    to jetpacks
    navigation-compose
    and I'm wondering how to handle constructs like those properly:
    // (container) screen with a BottomNavigationBar
    fun ScreenContainer(
        ...
        childs: @Composable (PaddingValues, SomeState, SomeHighOrderFunction) -> Unit
    ) 
    
    ScreenContainer(
        ...
    ) { innerPadding, SomeState, onError -> // How to easily pass things like innerPading or highorder functions to child screens?
        NestedRouter(startPoint = Screen.A) { backStack ->
            when(backStack.last())
               is ScreenA -> ScreenA()
               is ScreenB -> ScreenB()
        }
    }
    
    vs.
    
    NavHost(navController = navController, startDestination = "container") {
        composable("container") { ScreenContainer(
            ...
        ) // childs are now called via navController
        composable("screena") { ScreenA(innerPadding = ?, state = ?, onError = ?) }  // How to get these parameters?
        composable("screenb") { ScreenB(innerPadding = ?, state = ?, onError = ?) }  
    }
    Thanks in advance!
    :thread-please: 1
    j
    i
    14 replies · 3 participants
  • j

    Jan Skrasek

    04/13/2021, 2:00 PM
    Let's say I have 4 versions of button (primary, error, secondary, ...) What is the preferred (more idiomatic?) way to do the API: 1️⃣
    ButtonPrimary(onClick = {}) { Text("Primary") }
    ButtonSecondary(onClick = {}) { Text("Secondary") }
    or having it configurable via a property and enum? 2️⃣
    Button(Kind.Primary, onClick = {}) { Text("Primary") }
    Button(Kind.Secondary, onClick = {}) { Text("Primary") }
    My SwiftUI friend forces me to the enum way but I would prefer rather the first one (their syntax seems better here - they may use only the
    .Primary
    token as the value.)
    1️⃣ 9
    🙌 1
    2️⃣ 2
    b
    d
    +2
    27 replies · 5 participants
  • r

    Rodri Represa

    04/13/2021, 3:20 PM
    Hello guys, I have an Animatable animation running in a coroutine, the problem is that when I put the app in the background, my animation stop, and when I return to the app, my animation has finished instead of continue in the interrupted value. How can I return to the app and continue my animation where I left off?
    a
    3 replies · 2 participants
  • e

    escodro

    04/13/2021, 5:03 PM
    Hello, everyone. 👋 Quick question: was real time code changes in the emulator (hot reload) enabled since day one or it was introduced in latest versions of AGP and Compose?
    👀 5
    a
    4 replies · 2 participants
  • y

    YASAN

    04/13/2021, 6:15 PM
    How can I show a Drawable object in an Image? The drawable is not from resources, its just an object from the Drawable class.
    n
    g
    110 replies · 3 participants
  • m

    mzgreen

    04/14/2021, 8:17 AM
    Is it possible to achieve
    android:ellipsize="middle"
    behavior with
    Text
    composable? I know there is
    TextOverflow.Ellipsis
    but how do I specify if it should be in the middle, end, etc?
    🇳🇴 1
    👀 1
    c
    o
    +1
    8 replies · 4 participants
  • m

    mzgreen

    04/14/2021, 11:03 AM
    Hey, I'm testing different methods for drawing a circle with a stroke. Why I'm getting a different result when using those 2 methods?
    // first method - result on the left
      Canvas(modifier = Modifier.size(50.dp)) {
        drawCircle(Color.Blue)
        drawCircle(Color.Green, style = Stroke(width = 2.dp.value))
      }
      / second method - result on the right
      Surface(
        shape = CircleShape,
        color = Color.Blue,
        border = BorderStroke(2.dp, Color.Green),
        modifier = Modifier.size(50.dp),
        content = {}
      )
    s
    a
    8 replies · 3 participants
  • y

    YASAN

    04/14/2021, 11:26 AM
    When showing lists, when my data changes the list is fully recreated. Is it possible to animate the item updates like how we could in DiffUtil?
    ➕ 4
    👀 2
    t
    2 replies · 2 participants
  • g

    Geert

    04/14/2021, 12:23 PM
    Is there a way to change the statusbar color using Jetpack Compose? Sometimes I can set it, but its not completely filled.
    d
    c
    3 replies · 3 participants
  • l

    Lilly

    04/14/2021, 1:02 PM
    How would you handle this
    when
    construct in a composable function:
    when (val state = presenter.uiState) {
            UiState.Success -> {
               CallComponent() // composable code
            }
            is UiState.Failure -> {
               CallAnotherComponent() // composable code
               state = "setState" // non-composable code
            }
        }
    presenter.uiState
    is a mutableStateOf. Optimally this code should only be called when presenter.uiState has changed but instead it's called on every recompose. What's the right way to handle this?
    p
    j
    +3
    45 replies · 6 participants
  • l

    loloof64

    04/14/2021, 1:32 PM
    Hi ! Let's say I've built an
    @Composable
    named
    NonInteractiveZone
    which has some process running or not based on a
    Boolean
    state (let's say
    shouldBeRunning
    ). I would like to let other
    @Composable
    call some "methods/events" on it, let's say
    startProcess()
    and
    endProcess()
    . So that I could call
    myNonInteractiveZone.startProcess()
    . Can I achieve something like that with a
    @Composable
    ? More in the thread.
    z
    4 replies · 2 participants
  • n

    Nthily

    04/14/2021, 4:11 PM
    Has anyone ever had a Switch that wasn't controlled by animation?
    val normalModifier = 0.dp
    val expandModifier = 700.dp
    
    val animatedHeight by animateDpAsState(
        targetValue = (if(viewModel.textListSwitch) expandModifier else normalModifier),
        animationSpec = tween(500)
    )
    I wrote a height animation of the expanded content, but I found that the Text control inside can be hidden in this way, while the Switch control is still displayed
    d
    14 replies · 2 participants
  • s

    Shakil Karim

    04/14/2021, 7:08 PM
    Do we have support for Transition animation on Compose Navigation yet?
    d
    i
    3 replies · 3 participants
Powered by Linen
Title
s

Shakil Karim

04/14/2021, 7:08 PM
Do we have support for Transition animation on Compose Navigation yet?
d

Dominaezzz

04/14/2021, 7:09 PM
What does that mean? What makes an animation transactional?
s

Shakil Karim

04/14/2021, 7:12 PM
Sorry, I mean Transition*.*
i

Ian Lake

04/14/2021, 7:23 PM
Not yet, still being tracked in https://issuetracker.google.com/172112072 if you want to star it for updates
👍 1
View count: 3