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

    Daniel Candeias

    07/12/2021, 4:07 PM
    Hello! Using
    detectTapGestures
    how can i disallow user to pan/translate the content out of its bounding box? I have scale working with translations as well but the user is able to translate the image out of the screen. How can I set some limits for translation?
    👍 1
    r
    t
    j
    • 4
    • 5
  • a

    Artur Schwarz

    07/12/2021, 5:50 PM
    Is this a bug? Watch the scrollState.value go from 864 to 0 when the Row gets composed twice (for no obvious reason). This leads to the scroll position not being retained.
    Screen Recording 2021-07-12 at 19.48.38.mov
    a
    • 2
    • 12
  • c

    Chris Fillmore

    07/12/2021, 6:49 PM
    Hi everyone, happy Monday. Is there a best practice on using Custom Tabs with Compose Navigation? I currently have something like the following:
    composable(...) {
      val context = LocalContext.current
      SideEffect {
        CustomTabsIntent.Builder().build().launchUrl(context, myUrl)
      }
    }
    I’ll be expanding on this a bit to warm up the browser, etc, but is this basically what I need to do? Call
    launchUrl()
    from inside the Composable?
    i
    a
    • 3
    • 17
  • s

    smallshen

    07/12/2021, 9:55 PM
    The state is changing, but the recomposer doesn't update the TextNode, any solutions?
    a
    • 2
    • 4
  • n

    nglauber

    07/13/2021, 12:17 AM
    Having in mind a form with 10 fields (for instance) of different types (text, radio button, checkbox, combobox, … ). What do you folks think is the best approach? 1️⃣ Expose one `Flow`/`LiveData` for each field in ViewModel and collect/observe them individually in the screen. 2️⃣ Expose one
    State
    for each field in ViewModel and simply access them from the screen. 3️⃣ Encapsulate these 10 fields in a data class, expose one single `Flow`/`LiveData` and each “setter” create a
    copy
    of this data class instance to update the state. 4️⃣ Encapsulate these 10 fields in a data class, each field is a state, ViewModel has an instance of this class and you simply access it from the screen. 5️⃣ Other (please explain)
    2️⃣ 1
    5️⃣ 2
    3️⃣ 6
    c
    t
    +2
    • 5
    • 5
  • a

    Abhishek Dewan

    07/13/2021, 5:51 AM
    I am trying to add a centered loading indicator inside of LazyColumn like shown in the text snippets however, my loading view is never centered. I am guessing it has to do something with how the children of the lazy column are measured. Is there a way to have the loading view take up the rest of the screen so that I can center the circular progress indicator?
    Untitled
    c
    a
    • 3
    • 4
  • a

    Akram Bensalem

    07/13/2021, 7:00 AM
    Why preview don't work ??
    👍 1
    g
    t
    +3
    • 6
    • 16
  • k

    knthmn

    07/13/2021, 7:29 AM
    with the RC1
    ui-tooling
    split, is the following dependency declaration the "most correct" if I also need to annotate my composables with
    @Preview
    ?
    implementation("androidx.compose.ui:ui-tooling-preview:$compose_version")
    debugImplementation("androidx.compose.ui:ui-tooling:$compose_version")
    t
    • 2
    • 1
  • j

    julioromano

    07/13/2021, 8:21 AM
    I filed this bug some time ago but it didn’t get very much attention, can somebody tell me if you are also experiencing this? https://issuetracker.google.com/issues/190423020 It affects both compose preview and xml layout preview. NB: when checking out the attached images make sure you zoom to 1:1 scale or you won’t notice the low res artifacts
    t
    • 2
    • 3
  • j

    Jeff

    07/13/2021, 9:28 AM
    Noticed that previews do not work when I use a viewModel in a composable. How do you get around this?
    a
    b
    +2
    • 5
    • 15
  • a

    André Thiele

    07/13/2021, 1:07 PM
    what is the best way to pre populate a textfield in compose but remember the following state?
    a
    m
    p
    • 4
    • 6
  • p

    Peter Mandeljc

    07/13/2021, 3:49 PM
    Does anyone know, how to listen for lottie animation completed? Thanks!
    n
    h
    • 3
    • 5
  • d

    dimsuz

    07/13/2021, 5:19 PM
    If I have an inline (now
    value
    ) class, can I mark it as
    @Immutable
    ? Will this property transfer to the wrapped class and be understood accordingly by the Compose runtime later on?
    j
    • 2
    • 2
  • p

    Peter Mandeljc

    07/13/2021, 6:22 PM
    Is it possible to intercept click event before child composable? For (bad) example, how would one intercept event on Column level, and not pass it to TextField, without making any changes to TextField:
    Column(modifier = Modifier.clickable { Timber.d("click") }) {
        TextField(value = "smth", onValueChange = {})
    }
    t
    • 2
    • 1
  • j

    John O'Reilly

    07/13/2021, 6:56 PM
    Is there any indication yet whether next RC release will work with Kotlin 1.5.20? Running in to a few dependencies I need to pull in that only work with 1.5.20 (at least when using Kotlin/Native) and blocked as projects also use Compose.
    ☝️ 4
    ☝️🏼 1
    e
    a
    • 3
    • 2
  • n

    natario1

    07/13/2021, 7:33 PM
    Trying to wrap my head around pointer input. Can anyone explain why the first child is not clickable? Ideally with a link to source code. I'm not consuming touch events in the second child, I'm not even collecting them.
    Box(Modifier.fillMaxSize()) {
        Box(Modifier.fillMaxSize().clickable { error("Yay!") })
        Box(Modifier.fillMaxSize().pointerInput(Unit) {})
    }
    I mean, even if parent Box decides that the second child should get events first (which is questionable, but okay), why does
    pointerInput
    block the flow?
    k
    a
    +4
    • 7
    • 20
  • e

    Eric Ampire [MOD]

    07/13/2021, 8:17 PM
    Hi, since
    Card
    and Surface have the
    onClick
    parameter how can I define an
    onLongClick
    assuming that the code below does not work
    Modifier.combinedClickable(
        onLongClick = {
          Timber.e("Long Click")
        }
    )
    Modifier.genericClickableWithoutGesture
    that support
    onLongClick
    is marked as internal
    r
    t
    p
    • 4
    • 8
  • a

    Anthony

    07/13/2021, 9:37 PM
    What would be the best practice in jetpack compose to react to the application being paused, such as the user swapping to another application? This would be useful such as when the application is playing audio, you don't want the audio to continue playing when the app is in the background. I know we can override onPause() in the main activity, but how can we aim to let the rest of the application know that it is paused?
    j
    n
    • 3
    • 5
  • n

    nglauber

    07/13/2021, 10:39 PM
    Should
    ModalBottomSheetLayout
    collapses when back key is pressed? 🤔
    i
    • 2
    • 2
  • d

    df w

    07/14/2021, 1:30 AM
    Hello everyone, after Compose Canvas draws a graph, can I add a click event to the point in it?
    t
    • 2
    • 2
  • t

    tad

    07/14/2021, 1:32 AM
    Has anyone seen
    pending composition has not been applied
    before? Stack trace in thread
    a
    • 2
    • 2
  • c

    Colton Idle

    07/14/2021, 1:55 AM
    Is anyone building a "pure" Compose app? • single activity • no fragments • no AndroidArchComponent ViewModel If so, are you creating your own ViewModel (plain kotlin class, that does not extend AAC ViewModel)? I think most people agreed that AAC ViewModel was a not so great name when it came out. What is your project calling the thing that keeps state + handles events?
    👍 3
    t
    j
    +6
    • 9
    • 21
  • u

    ursus

    07/14/2021, 7:38 AM
    How would you model a state emited from viewmodel/presenter, if you need to render a "Hello Joe"?
    State(val greeting: String) and just render thr greeting
    
    State(val name: String) render "Hello $state.name"
    
    State(val user: User) render "Hello $state.user.name"
    TLDR; do you format in viewmodel or in composables?
    a
    • 2
    • 5
  • r

    Rak

    07/14/2021, 8:10 AM
    Does anyone know if Jetpack compose will allow configuration-driven UI easier? I’m working on a white label app and there are some differences between brands.
    :yes-black: 1
    c
    f
    +2
    • 5
    • 5
  • p

    pawegio

    07/14/2021, 10:35 AM
    Why
    AlertDialog
    takes a full width with no horizontal padding by default?
    a
    • 2
    • 1
  • p

    Peter Mandeljc

    07/14/2021, 12:37 PM
    Anyone had problems, when setting transparent background to Snackbar?
    l
    k
    a
    • 4
    • 6
  • t

    Tiago Nunes

    07/14/2021, 3:50 PM
    Hey everyone, Android studio has a code snippet to create a Box when you type W. Supposedly, it’s to facilitate wrapping composables. But how do you use it for wrapping?
    a
    • 2
    • 3
  • j

    jim

    07/14/2021, 3:58 PM
    Moreover, I think the concept of something being
    @Immutable
    is useful outside of just Compose.
    🧵 2
    ➕ 8
    b
    • 2
    • 1
  • d

    dambakk

    07/14/2021, 4:18 PM
    Is it possible to get the accumulated scroll offset from a
    LazyListState
    ?
    d
    • 2
    • 3
  • j

    jw

    07/14/2021, 5:52 PM
    of course. how else would we maintain the status quo of information silos and seeing the same questions over and over and over again?
    👎 1
    🧵 3
    :thread-please: 1
    👍 2
    😂 3
    a
    d
    e
    • 4
    • 6
Powered by Linen
Title
j

jw

07/14/2021, 5:52 PM
of course. how else would we maintain the status quo of information silos and seeing the same questions over and over and over again?
👎 1
🧵 3
:thread-please: 1
👍 2
😂 3
a

alorma

07/14/2021, 6:05 PM
😂 2
j

jw

07/14/2021, 6:11 PM
Yes, I know how threads work
d

dimsuz

07/14/2021, 6:14 PM
You also know how they don't work 😉
☝️ 1
j

jw

07/14/2021, 6:16 PM
Also a true statement!
a

alorma

07/14/2021, 6:33 PM
Do threads know how Jake works? :troll:
e

eygraber

07/14/2021, 10:02 PM
FWIW if I'm trying to find something I'll search for it, and the results include messages that are in threads. Granted, most people don't search in the first place, but then they also probably wouldn't scroll up to see if their question has been addressed before, so it's kind of a wash.
View count: 1