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

    Cicero

    05/10/2021, 1:43 PM
    Please if you have time, have a look at this issue.
    type = NavType.IntArrayType
    I’m getting this crash because IntArray is not supported. Funny enough I should be using ArrayList<Int> This is really not intuitive, or am I not being intuitive? haha
    i
    • 2
    • 23
  • d

    Daniele B

    05/10/2021, 3:09 PM
    About Navigation: what does it actually happen when you call
    NavHostController.navigate()
    as in:
    val navController = rememberNavController()
    navController.navigate("detail")
    It seems no recomposition is triggered. What is the basis on which Compose is able to update the screen without a recomposition? And how can we achieve the same in a Compose non-Android app?
    i
    l
    • 3
    • 10
  • n

    Nurseyit Tursunkulov

    05/10/2021, 4:32 PM
    https://stackoverflow.com/questions/67474260/how-to-create-textfield-in-compose
    c
    d
    • 3
    • 4
  • d

    Denis Capkovic

    05/10/2021, 4:44 PM
    Is there a performance penalty when we use
    Modifier.weight(1f)
    instead of
    Modifier.fillMaxSize()
    when we want the component to take up as much space as is available (it is the only component of the parent)?
    ➕ 1
    s
    a
    • 3
    • 4
  • a

    Alexander Karkossa

    05/10/2021, 5:57 PM
    Hey guys, maybe i found a performance issue in mixed compose/non compose app. We tried to implement a detail view within a single activity (multiple Fragments) app as compose view. Everything works fine, but the the first contact to the "compose world" seems to be laggy. If you push the button to navigate to the detail compose view, there is a delay more or around one second. It feels not good. After these delay, you can navigate back and forwards to compose without delay until you restart the app. After restart, the same performance issue at first contact. Maybe some "initial compose things" going on here?
    r
    a
    +2
    • 5
    • 12
  • a

    Alexandru Hadăr

    05/10/2021, 6:43 PM
    Hey guys, I have a few 
    TextFields
     and a 
    Button
     at the bottom of the screen (max space between the 
    Button
     and 
    TextFields
    ). What I’m trying to achieve is that when keyboard is opened, the button will be pushed up till below the last `TextField`(with minimum space between), so the user only has to scroll a bit to push the button. (🧵  with some attempts)
    n
    • 2
    • 12
  • m

    Marco Pierucci

    05/10/2021, 7:37 PM
    Hi Folks! Am struggling into drawing a VectorDrawable with the Canvas composable, full info in the 🧵
    i
    n
    • 3
    • 13
  • b

    Billy Newman

    05/10/2021, 8:33 PM
    Hello all, Trying to implement compose in pieces in an old app written mostly in Java. Is it possible to launch a compose BottomSheet from an Activity and then of course communicate the bottom sheet selection back to the activity?
    s
    • 2
    • 4
  • n

    Nurseyit Tursunkulov

    05/11/2021, 5:11 AM
    https://stackoverflow.com/questions/67446507/compose-rise-text-field-up-when-typing-text/67450604#67450604
    n
    • 2
    • 2
  • h

    Heikki Rauhala

    05/11/2021, 7:42 AM
    Hi, we're using SurfaceView to hold a MediaPlayer to play video, and then an overlay with controls on top. On Compose Beta 6 the overlay doesn't show up at all. I created a minified version (code in thread) and found out that depending on Android version and some unidentified thing the overlay might or might not work. Any ideas what might be wrong? 🧵
    • 1
    • 2
  • s

    Shivam Sethi

    05/11/2021, 8:03 AM
    Hello Composers, please help. I am getting a ridiculous error which I have no idea about. Read in the thread.
    a
    n
    • 3
    • 4
  • j

    james

    05/11/2021, 8:41 AM
    If I am inside of a compose activity, and I want to end this activity and go back to my previous non-compose activity, what is the best way to do this?
    c
    • 2
    • 1
  • c

    Cicero

    05/11/2021, 9:26 AM
    I just updated my project androidx.compose.ui:ui to 1.0.0-beta06 and I’m having a crash here:
    r
    • 2
    • 12
  • d

    Deepak Gahlot

    05/11/2021, 9:48 AM
    Hi All, Can we have custom indication on the selectable param under Modifier
    ❓ 1
    c
    s
    • 3
    • 10
  • c

    carbaj0

    05/11/2021, 10:25 AM
    class ProduceStateScopeImpl<T>(
        state: MutableState<T>,
        override val coroutineContext: CoroutineContext
    ) : ProduceStateScope<T>, MutableState<T> by state {
    
        override suspend fun awaitDispose(onDispose: () -> Unit): Nothing {
            try {
                suspendCancellableCoroutine<Nothing> { }
            } finally {
                onDispose()
            }
        }
    }
    Why
    suspendCancellableCoroutine<Nothing> { }
    is being executed?
    z
    a
    • 3
    • 16
  • n

    nglauber

    05/11/2021, 1:03 PM
    I’m facing a strange behavior with focus + keyboard type… All the
    TextField
    are numeric and when I move the focus to the previous
    TextField
    , the keyboard type changes very quickly to the alpha numeric and then changes again to the numeric… 😕 Here’s my code: https://gist.github.com/nglauber/312052d2989aff50b9331aa6e0f816f7 And here’s the gif:
    n
    z
    +2
    • 5
    • 9
  • f

    FunkyMuse

    05/11/2021, 2:14 PM
    Hey guys, i'm trying to show the modal bottom sheet above the bottom navigation bar
    val zIndex = if (state.targetValue == ModalBottomSheetValue.Hidden) {
        0f
    } else {
        2f
    }
    
    ModalBottomSheetLayout(
        modifier = Modifier.navigationBarsPadding().zIndex(zIndex)
    it worked on beta03, it doesn't work anymore, is there an issue related to this? My BottomNavigationComposable has a zIndex of 1f
    l
    i
    • 3
    • 4
  • c

    Colton Idle

    05/11/2021, 2:41 PM
    I want to show an AlertDialog (material alert dialog) but have it display my custom composable inside of it. The reasons why I want an alertDialog is because I want the size of an AlertDialog and I want it's container as well (i.e. an alertDialog seems to be on a rounded corner material card) Should I start with
    Dialog
    and try to morph it into alertDialog design, or is there a way to pass a composable into an AlertDialog that I'm missing?
    l
    • 2
    • 4
  • a

    alexsullivan114

    05/11/2021, 4:07 PM
    I'm struggling a bit with getting a shadow to show for an image (like an elevated profile photo). I'm using the
    shadow
    modifier as follows:
    @Composable
    @Preview
    private fun ProfileItem() {
      Box(modifier = Modifier.background(Color.White).padding(20.dp)) {
        Image(
            painter = painterResource(id = R.drawable.charles),
            contentScale = ContentScale.Crop,
            contentDescription = "Profile Image",
            modifier = Modifier
                .size(48.dp)
                .shadow(8.dp, CircleShape)
        )
      }
    }
    This results in a circular avatar-esque image, but there's no shadow. However, if I swap out the
    Image
    Composable with a
    Text
    Composable, I see a shadow:
    @Composable
    @Preview
    private fun ProfileItem() {
      Box(modifier = Modifier.background(Color.White).padding(20.dp)) {
        Text("Testing shadow", modifier = Modifier.size(48.dp).shadow(8.dp, CircleShape))
      }
    }
    I've tried playing around with padding, nesting boxes, and using a surface instead of the shadow modifier, all without any luck. I'm sure I'm missing something obvious - any ideas?
    c
    r
    • 3
    • 36
  • n

    Neal Sanche

    05/11/2021, 4:58 PM
    In handling a deep link in Compose navigation I'm seeing a couple of strange things that I can't figure out. First is the deep link seems to be delivered to the app twice. Second, the backstack seems to be recreated properly, however, the ViewModel I've linked to the sub navigation gets recreated when the app handles the deep link. That's really unexpected. I feel like I must be doing something very wrong at this point. Any ideas?
    i
    • 2
    • 10
  • b

    Billy Newman

    05/11/2021, 5:02 PM
    Hello all, I am struggling to implement an onClick handler for a Compose TextField. Current functionality is to handle the TextField click but disable manually editing of the field. For my use case I would like to handle the click and do something else. I would like the click animation to still happen. This is the layout I used that worked:
    <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/editText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:focusable="true"
                android:focusableInTouchMode="false"
                android:textIsSelectable="false"
                android:cursorVisible="false"
                android:clickable="false"
                android:inputType="textNoSuggestions"
                android:text='@{value}'
                android:onClick="@{() -> clickListener.invoke() }"/>
    z
    • 2
    • 15
  • m

    Marko Novakovic

    05/11/2021, 7:00 PM
    I want to create layout like this. Cloud above everything else and user should be able to move the cloud around. Cloud is menu that opens on
    +
    . Problem I have with my current implementation is that top layer with cloud is consuming all inputs so I can’t interact with rest of the app. Do you have any ideas how to do this. Code in 🧵
    c
    c
    • 3
    • 16
  • l

    Luis Mierez

    05/11/2021, 9:49 PM
    I’m trying to figure out why I keep getting an error when trying to add compose to my project. Haven’t been able to find an answer from searching online, so maybe y’all can help me. I’ll post the stack trace in thread
    i
    l
    • 3
    • 27
  • s

    Steve

    05/11/2021, 10:39 PM
    I have some OutlinedTextFields and I would like to know which is currently on Focus. Is there a good way to achieve that?
    k
    • 2
    • 3
  • z

    Zhelyazko Atanasov

    05/12/2021, 8:03 AM
    Is it possible to have a
    TextField
    but when user clicks on it - don't show the keyboard and the cursor 🤔 On the same time have the "focused" highlight of the
    TextField
    . I came across SofttwareKeyboardController class but it seems like it's suited for other use cases
    ✔️ 1
    • 1
    • 1
  • t

    Tigran Galstyan

    05/12/2021, 10:20 AM
    Hi everyone! I'm new to Jetpack Compose and Kotlin. Our company is starting a mobile app based project. I'm researching about Jetpack Compose and, especially, Android Flavors Support for Jetpack Compose. Is there any example projects where I can see how resources are managed? For each flavor I need to have: theme, colors, shape, typography, strings (I would like to not keep them in .xml file, and I'd like to to change the app language on the fly).
    c
    a
    a
    • 4
    • 8
  • p

    Pierre Kuhn

    05/12/2021, 3:25 PM
    Hi everyone! Has anyone managed to successfully integrate compose to a production app that still builds with AGP 4.1? I've heard of this trick, and was wondering if anyone had this setup in their project.
    j
    c
    i
    • 4
    • 7
  • l

    Lilly

    05/12/2021, 5:54 PM
    I'm wondering, what are the differences between
    StateFlow
    and
    MutableState
    in viewmodel/presenter layer? Is there a rule of thumb when to use one over the other, are there any drawbacks to use the one or the other? It seems to me both work the same way
    ❤️ 1
    a
    j
    +2
    • 5
    • 9
  • v

    Vince Rickey

    05/12/2021, 5:57 PM
    I copied the setup and example from Testing Your Compose Layout into androidTest and for some reason it successfully installs on the emulator but none of the tests run. Am I missing something basic? Info in thread.
    b
    • 2
    • 2
  • a

    Aman Kapoor

    05/13/2021, 7:04 AM
    In the video below, I want the image to be on top of all other elements in the hierarchy. This is in a LazyColumn. I tried increasing the z-index but didn’t work. Is there any way to achieve this? Also can we play/change z index after items are drawn?
    Image from iOS.MOV
    a
    • 2
    • 4
Powered by Linen
Title
a

Aman Kapoor

05/13/2021, 7:04 AM
In the video below, I want the image to be on top of all other elements in the hierarchy. This is in a LazyColumn. I tried increasing the z-index but didn’t work. Is there any way to achieve this? Also can we play/change z index after items are drawn?
Image from iOS.MOV
a

Andrey Kulikov

05/13/2021, 10:52 AM
zIndex changes the drawing order for the children of the same parent. here seems like you need to change zIndex() for multiple layout layers, especially for the one which is a direct child of LazyColumn
a

Aman Kapoor

05/13/2021, 10:56 AM
Yes. Also this text below the image is part of the same parent.
a

Andrey Kulikov

05/13/2021, 11:04 AM
if it doesn’t work it means you set zIndex on an incorrect layout. I will be able to help if you share the code
a

Aman Kapoor

05/13/2021, 11:10 AM
I’ll share the code in a while[I had removed that code]. Also will try updating zIndex for the direct child of lazycolumn too… also updating the zIndex while transforming the image will work right? I mean it can be changed/animated.
View count: 1