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

    Marko Novakovic

    06/24/2021, 4:39 PM
    when for example I want to redirect from my app to SMS app with
    Intent
    , how do I do it in Compose?
    z
    i
    +2
    • 5
    • 12
  • s

    Sergey Y.

    06/24/2021, 8:10 PM
    1741924: Docs June 30th Update | https://android-review.googlesource.com/c/platform/frameworks/support/+/1741924 Jetpack Compose RC1 next week 🎉
    :jetpack-compose: 22
    :kotlin-intensifies: 32
    🔥 34
    a
    c
    +3
    • 6
    • 7
  • a

    aoriani

    06/24/2021, 9:44 PM
    How to set the Text's width in the same way we use to do with
    android:ems
    ?
    d
    z
    • 3
    • 3
  • y

    YASAN

    06/24/2021, 11:26 PM
    When I show a
    Dialog
    , the phone's navigation bar buttons are still usable even though they are dimmed & they do not cause the
    Dialog
    to be dismissed automatically even though
    dismissOnClickOutside
    is set to
    true
    . Is this a bug or I am supposed to enable a specific behavior for it myself?
    • 1
    • 1
  • b

    Berkeli Alashov

    06/25/2021, 12:17 AM
    I'm trying to understand why this code doesn't work as expected without
    .copy()
    in `remember { colors.copy() }`:
    @Composable
    fun ProvideAppColors(
        colors: AppColors,
        content: @Composable () -> Unit
    ) {
        val appColors = remember { colors.copy() }.apply { update(colors) }
    
        CompositionLocalProvider(
        LocalAppColors provides appColors,
        content = content)
    }
    Without
    .copy()
    , it only works for the first change in state. Full code: https://gist.github.com/alashow/e67a75d662a13ce5529317bde3e241c2
    s
    a
    • 3
    • 16
  • e

    eneim

    06/25/2021, 1:04 AM
    Kinda tiny bug report:
    unregisterComposition
    is called twice in this screenshot (hope it is clear enough where it can be found. This is 1.0.0-beta09 by the way).
    a
    c
    • 3
    • 4
  • t

    Tolriq

    06/25/2021, 6:12 AM
    So with RC at the corner and Kotlin compiler still not stable enough to allow multiple versions support. Is there any documentation about how the Kotlin compiler version will be handled after 1.0 final since they are very tied?
    c
    • 2
    • 1
  • i

    Ioane Sharvadze

    06/25/2021, 8:52 AM
    Is there maximum Width Constraint in Compose? 🤔 I'm getting
    Can't represent a size of 1168750 in Constraints
    Error log when running this code
    @Composable
    fun Calendar() {
        Surface {
            Box(
                modifier = Modifier
                    .padding(10.dp)
                    .size(200.dp)
                    .horizontalScroll(rememberScrollState())
            ) {
                CalendarBox()
            }
        }
    }
    
    @Composable
    fun CalendarBox() {
        Box(modifier = Modifier.width(500_000.dp)) {
            Text(text = "Event 1", modifier = Modifier.offset(x = 50.dp))
            Text(text = "Event 2", modifier = Modifier.offset(x = 499_950.dp))
        }
    }
    
    @Preview
    @Composable
    fun CalendarPreview() {
        Calendar()
    }
    Basically, I want to write the widget that is very very wide. (Like calendar). I had similar code running in
    View-based-approach
    and it worked well. Now I want to translate that into compose based solution And I'm stuck with this issue. If this is framework limitation, is there any suggested approach how can I overcome this? 🤔
    g
    • 2
    • 9
  • l

    Luis Mierez

    06/25/2021, 2:04 PM
    Is there a way to host a fragment inside of a composable? I know we can host composables inside of a fragment but what about the opposite?
    i
    • 2
    • 1
  • n

    natario1

    06/25/2021, 3:50 PM
    Accompanist question - is there a way to apply ime padding without navigation bar padding? It's common for us to pass a
    navigationBarsPadding()
    modifier to different composables, but then one of them needs to also have the ime padding. And as docs say, calling
    navigationBarsPadding().imePadding()
    is not equal to
    navigationBarsWithImePadding()
    . Basically asking for an
    imePadding
    which is additive WRT
    navigationBarsPadding
    . Any hints on how to compute it?
    c
    • 2
    • 2
  • r

    raenardev

    06/25/2021, 4:08 PM
    Also question about accompanist and insets: There is an issue that
    ProvideWindowInsets
    has a certain delay, when used in fragment-based screens, which causes noticeable jumps with status bars. Are there any updates on that? (also bot closed the issue) https://github.com/google/accompanist/issues/155
    c
    n
    i
    • 4
    • 6
  • t

    Tolriq

    06/25/2021, 4:32 PM
    What is the proper way to get the activity in a pure compose world for the external things that requires it like Play Billing?
    a
    • 2
    • 4
  • c

    Cicero

    06/25/2021, 4:55 PM
    Hey people, I’ve experienced a recent behavior while using interoperability where in my MainActivity this other dev set up a bottom navigation and I’ve been nesting compose navigations from it. The behavior is the be bottom navigation bar is bumped up with the keyboard. Is this an interoperability glitch? If you suggest it could be a glitch I would be happy to write a repo with the issue.
    i
    • 2
    • 8
  • r

    Ryan Simon

    06/25/2021, 6:15 PM
    Hey all, I've been really struggling to get Compose to work with an existing Android project. I keep getting an error during compilation, and my googling of it hasn't been very helpful. I'm hoping someone here might have an idea of what's going on. Error message and more details in the thread...
    z
    • 2
    • 16
  • b

    Brian G

    06/25/2021, 8:36 PM
    Is it possible to do a visual transform without triggering a recomposition? E.g. say I want to use
    Box(Modifier.offset(x=x, y=y)) { Content() }
    but update x and y very frequently, while the contents of the box never changes. Right now I see the content get recomposed often, any way to avoid that? Is that in "future optimization" territory?
    a
    • 2
    • 2
  • e

    eneim

    06/26/2021, 7:37 AM
    It seems that the BottomSheetScaffold doesn’t allow the “Half-Expanded” state of the Bottom sheet, what is the reason?
    m
    • 2
    • 1
  • p

    Prashast Rastogi

    06/26/2021, 1:09 PM
    Facing this issue while adding
    clickable
    method in compose view
    org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
    kotlin version : '1.4.32' compose version : '1.0.0-beta09' Let me know if anyone has any clue how to resolve this. cc @Ian Lake
    a
    s
    +2
    • 5
    • 19
  • c

    Colton Idle

    06/26/2021, 6:52 PM
    I'm getting an NPE and I think I'm not understanding how snapshot state works? In essence I want to show a modal dialog as part of my state. Code inside the thread.
    r
    a
    +2
    • 5
    • 18
  • m

    Mohamed Ibrahim

    06/26/2021, 8:00 PM
    is there away to make the activity or the composable full screen?
    s
    t
    l
    • 4
    • 4
  • g

    gitai

    06/26/2021, 10:10 PM
    Regarding
    Snapshot.takeMutableSnapshot()
    , when inside a
    readObserver
    callback, how do you subscribe a composable to reads of the supplied state instance?
    z
    • 2
    • 14
  • t

    Tash

    06/26/2021, 10:30 PM
    Assuming that 1.0 release will come with stable AGP 7+ and AS Arctic Fox; is this correct? Would 1.0 still work with AGP 4.2+, though?
    c
    • 2
    • 2
  • y

    Yasutaka Kawamoto

    06/27/2021, 4:10 AM
    Is there a way to click Rects that draw use
    drawRect
    in Canvas?
    Canvas(modifier = Modifier.fillMaxSize()) {
        list?.forEach { item ->
            val bounds = item.bounds // Rect
            // I want to click this
            drawRect(
                color = Color.Blue,
                topLeft = Offset(x = bounds.left, y = <http://bounds.top|bounds.top>),
                size = Size(bounds.width(), bounds.height()),
            )
        }
    }
    z
    • 2
    • 5
  • k

    Kaustubh Patange

    06/27/2021, 6:34 AM
    Is there a way I can
    remember
    the value produced by a
    @Composable
    function that does not have a
    Unit
    return type?
    r
    r
    • 3
    • 3
  • r

    rajesh

    06/27/2021, 8:57 AM
    Is the
    stack
    (for overlapping ui) removed from compose 1.0.0-beta09? If so, what should I use instead?
    f
    • 2
    • 1
  • m

    ms

    06/27/2021, 9:22 AM
    Is anyone facing issues when generating a release build with Jetpack DataStore. I'm getting this on app start, I tried different proguard rules but didn't work Datastore beta02 Compose beta09 Using
    java.lang.NullPointerException
            at java.util.Objects.requireNonNull(Objects.java:220)
            at s8.e.F(:1)
            at n8.h.a(:6)
            at n8.h.b(:12)
            at n8.h.e(Unknown Source:100)
            at n8.h$f.j(Unknown Source:11)
            at o9.a.w(:2)
            at ea.j0.run(Unknown Source:86)
            at android.os.Handler.handleCallback(Handler.java:938)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:223)
            at android.app.ActivityThread.main(ActivityThread.java:7656)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    • 1
    • 1
  • t

    timrijckaert

    06/27/2021, 11:31 AM
    Hello I'm starting with Compose and want to replicate Google Home's full screen clock screensaver called Eclipse - Dark https://i2.wp.com/9to5google.com/wp-content/uploads/sites/4/2019/01/lenovo_smart_clock_11.jpg?w=2000&amp;quality=82&amp;strip=all&amp;ssl=1 However I'm completely stuck which composable to use. I started with a
    Row
    with some weighted `Text`'s inside, however how can I make the
    Row
    clip the
    Text
    ? Do I need a fixed width - height for the
    Row
    and calculate the
    TextStyle
    fontSize manually or is there a better alternative?
    @Composable
    fun Eclipse() {
        Row(
            modifier = Modifier
                .height(IntrinsicSize.Min)
                .width(IntrinsicSize.Min)
                .background(Color.Black)
        ) {
            EclipseIntTile(0, modifier = Modifier.weight(1F))
            EclipseIntTile(4, modifier = Modifier.weight(1F))
            EclipseIntTile(5, modifier = Modifier.weight(1F))
            EclipseIntTile(2, modifier = Modifier.weight(1F))
        }
    }
    
    @Composable
    fun EclipseIntTile(i: Int, modifier: Modifier = Modifier) {
        Text("$i", modifier = modifier, style = TextStyle(fontSize = 140.sp, color = Color.White))
    }
    Any pointers? Thanks
    j
    • 2
    • 6
  • s

    Shabinder Singh

    06/27/2021, 2:05 PM
    When Using Nested NavHost with a seperate navController in BottomSheetScaffold' Sheet , it AUTOMATICALLY EXPANDS! on launch , even when started using Collapsed State... Any Idea how to fix this?, Any help will be appreciated... Note: if i comment out navHost and simply use a Composable in Sheet it doesnt Expand automatically and everything works as Expected
    n
    i
    • 3
    • 11
  • b

    brandonmcansh

    06/27/2021, 4:52 PM
    Any one using ComposeView interop and noticing a slight lag when compose is starting up for the first time?
    l
    • 2
    • 4
  • j

    jw

    06/27/2021, 4:52 PM
    It will not. RC1 forked a week ago. Moreover, .20 has not landed in AOSP HEAD yet
    b
    • 2
    • 1
  • m

    Mohamed Ibrahim

    06/27/2021, 5:24 PM
    systemUiController.isNavigationBarVisible = false
    systemUiController.isSystemBarsVisible = false
    I’m using those functions to make my app full screen, when touching my app navigation bar is appearing again. what I want to achieve is to develop a blocker app so user can’t access system buttons, is that possible?
    a
    c
    t
    • 4
    • 4
Powered by Linen
Title
m

Mohamed Ibrahim

06/27/2021, 5:24 PM
systemUiController.isNavigationBarVisible = false
systemUiController.isSystemBarsVisible = false
I’m using those functions to make my app full screen, when touching my app navigation bar is appearing again. what I want to achieve is to develop a blocker app so user can’t access system buttons, is that possible?
a

Alejo

06/27/2021, 6:47 PM
Maybe you want something like
Activity.startLockTask()
? Here the docs https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode
c

Colton Idle

06/27/2021, 7:05 PM
An app blocking system buttons isn't possible AFAIK. The most you can do is override back, but the user should always be able to go home. You might want to look into kiosk mode
t

tad

06/28/2021, 1:31 AM
Correct, you cannot make an app that prevents interacting with System UI, for many good reasons.
m

Mohamed Ibrahim

07/01/2021, 4:14 PM
There is an app doing it called LockMeOut
View count: 2