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

    Mohamed Ibrahim

    08/07/2021, 2:26 AM
    And how to pass Parcelable using compose navigation?
    c
    i
    • 3
    • 3
  • a

    Adib Faramarzi

    08/07/2021, 9:41 AM
    Is there a more basic version of
    BasicTextField
    ? 😅 I don't want to show the string that was entered as a text.
    z
    g
    c
    • 4
    • 5
  • s

    Shakil Karim

    08/07/2021, 9:55 AM
    Hi, is there a way to make the bottom sheet fully expandable and completely hide, I want to avoid the half expanded State with the new Navigation Material library?
    ➕ 3
    j
    c
    • 3
    • 4
  • m

    Michael Paus

    08/07/2021, 10:59 AM
    Does anybody know what happened to DataTables which were, e.g., described and used here: https://proandroiddev.com/jetpack-compose-data-tables-33a247f59fd5 I am definitely missing such a thing.
    d
    • 2
    • 2
  • l

    Louis

    08/07/2021, 11:10 AM
    Hey, do you know if there is a way in compose UI tests to check if an icon is displayed ?
    d
    • 2
    • 1
  • e

    Eric Ampire [MOD]

    08/07/2021, 11:30 AM
    Hello, does someone has an Idea about how to count lines of a string in order to show or not see more button using compose like on the following screenshot ?
    a
    r
    • 3
    • 4
  • c

    CLOVIS

    08/07/2021, 12:03 PM
    Since Compose splits the machinery and the UI, how complicated would it be to create adapt Compose for other frameworks? Let's say I'm writing something directly with OpenGL and I'd like to use Compose with it. Is it just a matter of reimplementing all Composables (which there are a lot of, so it would take a lot of time) or is there actually something complicated that ties Compose to Skija/Skiko?
    z
    z
    a
    • 4
    • 13
  • n

    Nthily

    08/07/2021, 12:33 PM
    Why does my timer's number get delayed when I use
    if
    or the
    compose animation api
    to control whether a screen is displayed or not?
    ➕ 1
    • 1
    • 1
  • a

    Alexander Black

    08/07/2021, 2:39 PM
    So I absolutely love this widget from the Google Podcast app, and I’m wondering if anyone has any advice on how I could go about implementing such a widget in Compose? I might be a bit out of my depth on it, but if anyone has any advice or places to start I’d greatly appreciate it.
    h
    t
    • 3
    • 43
  • f

    Florian

    08/07/2021, 6:02 PM
    I'm not really getting the point of this default surface in a new Compose Activity. What's it's purpose? And why does it set the background color?
    s
    c
    • 3
    • 14
  • j

    Jason Inbody

    08/07/2021, 8:02 PM
    Is there a way to grab the NavController like a singleton? I have an async api call that I want to switch screens if returned ok. Right now I have to physically pass the nav controller into the async cb and it would be alot cleaner if I could call it back as a singleton when ever I needed it in my code.
    a
    j
    • 3
    • 2
  • a

    Anton Dmytryshyn

    08/07/2021, 10:43 PM
    What would be the recommended approach to error handling text input in a composable show below? I could define an interface for the textfields that handle number input, and implement it based on whether it needs input validation but I am unsure if that is a good approach. Code in 🧵. ``````
    t
    • 2
    • 2
  • t

    treatmaster

    08/08/2021, 3:36 AM
    hi guys, I had a problem with compose and navigation. I have 2 screens, splash screen, stimulate delay some time and then navigate to home screen. it navigates normally but home screen blinking and I found splash screen is recompose again again. So this is problem from compose or my implementation is wrong? Please help me!!!
    a
    n
    n
    • 4
    • 14
  • m

    Mjahangiry75

    08/08/2021, 7:20 AM
    what's new in
    compose 1.0.1
    ?
    e
    b
    • 3
    • 3
  • a

    Alexander Sitnikov

    08/08/2021, 10:23 AM
    If there’s some clickable element in front of scrolling container, it seems like this element intercepts touch events, and container doesn’t scroll. Is there workaround for this behaviour? Code and video in 🧵
    n
    • 2
    • 4
  • s

    Slackbot

    08/08/2021, 10:59 AM
    This message was deleted.
    z
    • 2
    • 1
  • p

    Pawel

    08/08/2021, 12:51 PM
    Hello, I am getting this warning when I a compile a brand new android project that uses compose 1.0.1 and kotlin 1.5.21:
    w: ATTENTION!
    This build uses unsafe internal compiler arguments:
    
    -XXLanguage:+NonParenthesizedAnnotationsOnFunctionalTypes
    
    This mode is not recommended for production use,
    as no stability/compatibility guarantees are given on
    compiler or generated code. Use it at your own risk!
    I would like to use compose in production and I am just wondering if I should be worried about this.
    m
    z
    • 3
    • 5
  • a

    Archie

    08/08/2021, 1:59 PM
    Hi everyone, Just would like to clarify something about
    derivedStateOf
    . In the official Documentation here: https://developer.android.com/jetpack/compose/side-effects There is this sample code:
    @Composable
    fun TodoList(
        highPriorityKeywords: List<String> = listOf("Review", "Unblock", "Compose")
    ) {
        val todoTasks = remember { mutableStateListOf<String>() }
    
        // Calculate high priority tasks only when the todoTasks or
        // highPriorityKeywords change, not on every recomposition
        val highPriorityTasks by remember(todoTasks, highPriorityKeywords) {
            derivedStateOf {
                todoTasks.filter { it.containsWord(highPriorityKeywords) }
            }
        }
    
        Box(Modifier.fillMaxSize()) {
            LazyColumn {
                items(highPriorityTasks) { /* ... */ }
                items(todoTasks) { /* ... */ }
            }
            /* Rest of the UI where users can add elements to the list */
        }
    }
    Wouldn’t the same thing would be achieve even without the
    derivedStateOf
    ? Like:
    @Composable
    fun TodoList(
        highPriorityKeywords: List<String> = listOf("Review", "Unblock", "Compose")
    ) {
        val todoTasks = remember { mutableStateListOf<String>() }
    
        // Calculate high priority tasks only when the todoTasks or
        // highPriorityKeywords change, not on every recomposition
        val highPriorityTasks by remember(todoTasks.value, highPriorityKeywords) {
            todoTasks.filter { it.containsWord(highPriorityKeywords) }
        }
    
        Box(Modifier.fillMaxSize()) {
            LazyColumn {
                items(highPriorityTasks) { /* ... */ }
                items(todoTasks) { /* ... */ }
            }
            /* Rest of the UI where users can add elements to the list */
        }
    }
    Wouldn’t this do the exact same thing?
    ❤️ 1
    d
    l
    m
    • 4
    • 9
  • t

    theapache64

    08/08/2021, 3:02 PM
    ❓ Where can i find that sample? 🤔 I’ve looked at cs.android.com
    * @sample androidx.activity.compose.samples.BackHandler
    a
    i
    r
    • 4
    • 11
  • m

    MBegemot

    08/08/2021, 3:43 PM
    I have a weird problem related to Dialog or Popup, I have a screen that shows a lazy list of cards when I click on a card I display a Dialog that among other things allows to scroll up and down the aforesaid list. But after randomly 2,3,4 times the whole dialog is closed without passing by the onDismissRequest handler. If I call the code that produces the scroll in for example the topApp Bar then everything is ok.
    • 1
    • 1
  • a

    Alexander Black

    08/08/2021, 3:48 PM
    How might you implement drag velocity… Like the scroll fling behavior in a scroll view? I have detectHorizontalDragGestures working, but I’d love to have some continuous movement in a widget that I’m building after you stop dragging.
    a
    • 2
    • 2
  • r

    rkeazor

    08/08/2021, 5:54 PM
    Does anyone's compose previews work with the latest stable version I keep seeing
    PreviewActivity is not a subclass of Activity
    c
    m
    j
    • 4
    • 3
  • d

    Dmitry Chernozubov

    08/08/2021, 6:53 PM
    Hi all. I have strange behavior with TextField and keyboard. When i open activity and tap to field i see keyboard and it hides field. But if i close keyboard and tap again all works fine and works as ajustPan. What can be wrong? I use simple column with verticalScroll param and some text, switches and TextFilds widgets.
    ➕ 1
    m
    m
    • 3
    • 2
  • j

    Jason Inbody

    08/08/2021, 7:02 PM
    Whats the best way to get two columns to stick to the left and right side of a row?
    s
    a
    o
    • 4
    • 6
  • j

    Jason Inbody

    08/09/2021, 2:02 AM
    In jetpack compose how do you use timers? I have a progress bar that I want to continuously cycle until I get a response back from my servers. I was googling a bit but not getting much useful info. Maybe timer or clock isnt the right name to google?
    a
    • 2
    • 5
  • d

    darkmoon_uk

    08/09/2021, 2:25 AM
    EDIT: Solved this, solution in 👉 🧵 I'm integrating a
    TextField
    and
    DropDownMenu
    to make a fairly standard drop-down selection for a form. For this I want to suppress the standard text-editing interaction with the
    TextField
    and just respond to clicks by opening the menu. Found this becomes a bit of a catch 22 though: • Keeping the
    TextField
    enabled, and trying to apply an overriding
    clickable
    modifier to it, or its parent, does not stop the TextField from capturing user interaction and behaving normally, as hoped. • Disabling the TextField and applying
    clickable
    to its parent gives desired behaviour, but then of course the colours look disabled too, which I don't want. So I'm trying to apply new
    TextFieldColors
    to it, that maintain the enabled appearance. However I'm not finding this straightforward either - trying to reference the existing default colors gets you tangled up in interaction sources and stuff which does not feel necessary to be doing. Any 3rd way I'm missing?
    z
    s
    • 3
    • 7
  • d

    darkmoon_uk

    08/09/2021, 4:49 AM
    A design fault in Compose themeing/coloring 🤔 ? Why does
    LocalContentColor
    always default to black, and this default is not overridden by a
    MaterialTheme
    block? This means that even in Dark themes, the text colour inside a
    TextField
    , for example, is also black, leaving it hard to read. The API comments talk about this being 'typically' set to
    MaterialTheme.onSurface
    - but don't say whether this is the direct responsibility of the developer, or how to do it. This feels like something I shouldn't be handling directly - why do other Material elements adjust well to dark/light scheme, but the text inside a
    TextField
    does not? Either I'm missing something or this is inconsistent/broken? Edit: Straw-man solution 👉 🧵
    k
    i
    • 3
    • 5
  • a

    Abdalla Hassanin

    08/09/2021, 6:42 AM
    How to make Autosizing Text in compose
    o
    • 2
    • 1
  • n

    Napa Ram

    08/09/2021, 7:34 AM
    hello how to set drawable to button as background
    a
    • 2
    • 7
  • m

    Marko Novakovic

    08/09/2021, 9:00 AM
    how would I create screen for phones and tablets? in
    XML
    world I would have
    ...layout
    and
    …layout-w600dp
    . in compose do I use
    BoxWithConstraints
    and depending on the width I present correct content?
    👀 2
    a
    • 2
    • 4
Powered by Linen
Title
m

Marko Novakovic

08/09/2021, 9:00 AM
how would I create screen for phones and tablets? in
XML
world I would have
...layout
and
…layout-w600dp
. in compose do I use
BoxWithConstraints
and depending on the width I present correct content?
👀 2
https://developer.android.com/training/multiscreen/screensizes#Compose
a

Adam Powell

08/09/2021, 1:07 PM
BoxWithConstraints is one way, you can also use LocalConfiguration.current to read the Configuration object used by all of the Android resource directory qualifiers
✅ 1
smallestScreenWidthDp is the field that you can compare against your 600 breakpoint
✅ 1
m

Marko Novakovic

08/09/2021, 2:28 PM
thanks
View count: 1