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

    escodro

    04/23/2021, 2:18 PM
    Hello, everyone! 👋 I’m facing some issues regarding Instrumented Tests with Compose. My tests passes on multiple emulators locally, but it fails on GitHub Actions (I’m using ReactiveCircus/android-emulator-runner). The fails are simple ones like
    Reason: Expected exactly '1' node but could not find any node that satisfies
    for screens I’m sure are working. Has anyone faced any issue with it? Is there any recommended configuration for Compose Test or Android Emulator? Thanks a lot in advance! ❤️
    z
    • 2
    • 6
  • m

    Muhammad Zaryab Rafique

    04/23/2021, 2:47 PM
    Hey Devs, how to recompose function after every ten seconds. Kindly guide me.
    z
    a
    c
    • 4
    • 7
  • c

    Colton Idle

    04/23/2021, 5:07 PM
    To create a "text area" in compose, should I actually set a fixed height, or is there a way to set a max number of lines, or should I calculate height based dynamically by measuring font size or something.
    d
    • 2
    • 2
  • p

    popalay

    04/23/2021, 5:15 PM
    Hi everyone! Does anyone know why the
    Shapes
    class takes a
    CornerBasedShape
    and not just a
    Shape
    , and because of this I cannot use
    GenericShape
    as a theme parameter?
    a
    • 2
    • 2
  • a

    Afzal Najam

    04/23/2021, 5:19 PM
    Is it true that for a pure Compose app, we should set
    android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
    ?
    l
    a
    • 3
    • 10
  • l

    Lilly

    04/23/2021, 7:29 PM
    In my @Preview function I reference a composable function which sits in another kt file. This gives me render problems. When I move same composable function in the file where @Preview function is defined, it works. The stack trace doesn't really help me to figure out the reason, why this happens. Can someone have a look please. I'm on beta05 and Canary 14.
    stack_trace.txt
    z
    • 2
    • 3
  • s

    Slackbot

    04/23/2021, 7:34 PM
    This message was deleted.
    a
    • 2
    • 1
  • m

    mzgreen

    04/23/2021, 8:46 PM
    What happens if I add multiple clickable modifiers one after another? Will they overwrite each other?
    z
    • 2
    • 4
  • n

    Nat Strangerweather

    04/23/2021, 9:18 PM
    I wanted to move some code out of my Composable, as a function, to make my code generally clearer, but I have trouble referencing the drawLine method of my CanvasDrawScope as a parameter. I thought it would be a Unit, but no success. I am putting the snippet in the thread. Any ideas or is it best to keep all that code within the Composable?
    l
    • 2
    • 16
  • g

    grandstaish

    04/23/2021, 9:37 PM
    is the source code for the compose layout inspector available anywhere?
    • 1
    • 1
  • a

    Arkadii Ivanov

    04/23/2021, 9:46 PM
    Found in the Compose javadocs such a term: "composition's apply thread". E.g.
    RememberObserver.onRemembered
    . What is it about?
    a
    • 2
    • 3
  • l

    Lilly

    04/23/2021, 10:21 PM
    There is a unidentifiable top padding in
    OutlinedTextField
    . Is it intended?
    @Preview
    @Composable
    fun OutLinedTextPreview() {
        Box {
            var text by rememberSaveable { mutableStateOf("") }
    
            OutlinedTextField(
                value = text,
                onValueChange = { text = it },
                label = { Text("Label") }
            )
        }
    }
    d
    • 2
    • 10
  • j

    jw

    04/24/2021, 1:53 AM
    didn't you write TextClock like a week before the final OS build?
    r
    • 2
    • 1
  • r

    robnik

    04/24/2021, 3:19 AM
    The docs here show a
    viewModel()
    function, but don't show where to import it. IntelliJ is not helping me. Where is it? (Not sure why I need this magic function. Can I just create my ViewModel like a normal object?)
    i
    • 2
    • 2
  • r

    rsktash

    04/24/2021, 5:51 AM
    Is there a plan to support compose ui in widgets ?
    😁 4
    ➕ 5
    a
    • 2
    • 2
  • l

    loloof64

    04/24/2021, 11:02 AM
    Hi ! I've got a behaviour that I don't understand with Recomposition and Tap gesture. More in the thread.
    a
    z
    • 3
    • 12
  • a

    alorma

    04/24/2021, 11:19 AM
    Hi! Anyone has an example on how to show a Modal bottom sheet ? I think i'm doing something wrong.. .but cannot find what is, code in thread
    m
    • 2
    • 6
  • s

    Se7eN

    04/24/2021, 12:22 PM
    How do I add a stroke on
    Text
    ? (not canvas)
    d
    g
    • 3
    • 6
  • x

    xxfast

    04/24/2021, 1:12 PM
    What is the best way to toggle visibility of a composable based on available height? - so that we can show/hide when the keyboard is up for instance
    z
    • 2
    • 2
  • r

    robnik

    04/24/2021, 4:14 PM
    I'd like to measure the width of a hypothetical composable, and then use that to set other widths. Is there a good way to do that? My layout looks like:
    Row { Text(t1) Canvas Text(t2) }
    . I want to measure a hypothetical
    Text(longestPossibleString)
    and use that to set width of the two Texts, so that things are centered and don't move as t1 and t2 change.
    z
    • 2
    • 4
  • c

    Chachako

    04/24/2021, 5:38 PM
    Does Compose have something similar to Android EdgeEffect?
    👀 7
    a
    l
    +2
    • 5
    • 11
  • s

    Slackbot

    04/24/2021, 6:39 PM
    This message was deleted.
    n
    s
    m
    • 4
    • 8
  • c

    Chachako

    04/24/2021, 6:59 PM
    I was wondering if there has been any recent optimization of the scrolling behavior of the
    LazyColumn
    . I compared it today to
    RecyclerView
    and it's really bad...
    :jetpack-compose: 1
    ☝️ 4
    💯 2
    h
    r
    +2
    • 5
    • 5
  • r

    robnik

    04/24/2021, 11:14 PM
    I'm having trouble seeing how the parts fit together. Eg, I have a
    NavHost(...) { composable(..., arguments = ...) {
    ... inside that I extract at argument (id: String), now I can want to query my Room database, like
    db.getThing(id):Flow<Thing>
    and pass it to a
    @Composable fun ThingView(thing)
    but that DB function is not callable outside of a coroutine context. So... where do I get the coroutine context, and then how to I hook the result obtained within that back to some MutableState that Compose can observe, in ThingView.
    i
    d
    • 3
    • 5
  • s

    Samir Basnet

    04/25/2021, 3:36 AM
    Will the bug where the list item has ripple animation even while scrolling be fixed in next beta?
    ➕ 7
    c
    • 2
    • 1
  • p

    Philip Blandford

    04/25/2021, 11:55 AM
    Struggling to get a chat-like interface behaving correctly - I'm using accompanist-insets to set the padding, but about half the time it shoots the textfield nearly to the top of the screen.
    @Composable
    @Preview
    private fun InsetsTest() {
      val activity = LocalContext.current as Activity
      WindowCompat.setDecorFitsSystemWindows(activity.window, false)
    
      MaterialTheme {
        ProvideWindowInsets {
    
          val text = remember { mutableStateOf("") }
    
          Column(
            Modifier
              .fillMaxSize()
              .background(Color.White)
          ) {
            Box(
              Modifier
                .fillMaxWidth()
                .weight(1f)
                .background(Color.LightGray)
            )
            Column(
              Modifier
                .navigationBarsWithImePadding()
                .background(Color.Yellow)) {
              BasicTextField(
                text.value,
                { text.value = it },
                Modifier
                  .fillMaxWidth()
                  .heightIn(50.dp)
              )
              Box(Modifier.height(50.dp))
            }
          }
        }
      }
    }
    c
    • 2
    • 2
  • o

    orangy

    04/25/2021, 2:12 PM
    I have a main/detail UI, where user can select an item in the list, and then details are shown in another box. That box has a scrollable layout inside, and everything is working fine, except the scroll state is shared with all the items in the main list. I figured I should inline the
    rememberScrollState
    and provide inputs there (selected item in the main list), but now the scroll is not remembered at all, every switch in main list starts with initial position. How do I make scroll state in detail pane be persisted per item in the main list?
    z
    d
    • 3
    • 6
  • m

    Michal Klimczak

    04/25/2021, 2:36 PM
    Is this a legitimate use of
    LaunchedEffect
    or am I abusing something? I'm trying to detect changes to multiple
    States
    and make a callback out of them.
    @Composable
    fun FooSlider(
        onStartedSelection: () -> Unit,
        onSelected: (value: Float) -> Unit
    ) {
        var sliderPosition by remember { mutableStateOf(0f) }
        val sliderInteractions = remember { MutableInteractionSource() }
        val isDragged by sliderInteractions.collectIsDraggedAsState()
        val isPressed by sliderInteractions.collectIsPressedAsState()
    
        LaunchedEffect(isDragged || isPressed) {
            when {
                isDragged || isPressed -> onStartedSelection()
                else -> onSelected(sliderPosition)
            }
        }
    
        Slider(
            value = sliderPosition,
            onValueChange = { sliderPosition = it },
            interactionSource = sliderInteractions
        )
    
    }
    z
    • 2
    • 7
  • r

    robnik

    04/25/2021, 2:54 PM
    How do I stop Android Studio from reindenting my entire file just because I autocompleted something in a Composable function? Screenshots in thread...
    ✔️ 1
    ❤️ 2
    ➕ 1
    d
    d
    • 3
    • 32
  • o

    Oleg Tretiakov

    04/25/2021, 3:40 PM
    Hey everyone! Is it possible to measure children at runtime? I'd like to achieve the behavior when visibility of 2nd child of the layout depends on how many lines 1nd child has
    o
    • 2
    • 2
Powered by Linen
Title
o

Oleg Tretiakov

04/25/2021, 3:40 PM
Hey everyone! Is it possible to measure children at runtime? I'd like to achieve the behavior when visibility of 2nd child of the layout depends on how many lines 1nd child has
o

orangy

04/25/2021, 3:52 PM
Yes, see
Layout
, you control measurement and placements there.
o

Oleg Tretiakov

04/25/2021, 3:53 PM
Will do, thx
View count: 1