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

    andrew

    03/22/2023, 8:20 PM
    Marquee is supported now????? 😮 I've been trying to come up with a way to do it properly and it's finally a real thing!
    r
    d
    +2
    • 5
    • 31
  • b

    Ben Trengrove [G]

    03/22/2023, 9:36 PM
    In case you haven't seen it. We released Compose 1.4 stable and Compose BOM March Release today. 😛arty-parrot: https://android-developers.googleblog.com/2023/03/whats-new-in-jetpack-compose-march-23-release.html
    d
    • 2
    • 2
  • s

    Stylianos Gakis

    03/22/2023, 10:40 PM
    Why is
    resources()
    marked as internal in androidx.compose.ui.res ? I am in a place where I need to decide on a string to be used inside my ViewModel. As described here, I am only exposing the StringRes Int from there, and I need to then resolve that string inside my composable. Specifically, I am outside of a composable context since I am resolving it inside a lambda, so I can’t just use the
    stringResource()
    function which uses this function internally. So it turns out I need to do what
    stringResource()
    does interally myself, which is
    LocalConfiguration.current
    return LocalContext.current.resources
    So that I make sure I read LocalConfig in order to make sure I do not grab stale data.
    resources()
    already exists and does this exact thing, but it’s marked as internal, shouldn’t that just be a public function?
    d
    m
    • 3
    • 15
  • j

    jayjiang

    03/23/2023, 8:08 AM
    Isn't touch still supported in UIKit interop in Compose Multiplatform? I add a Mapview to the view, but I find that I can't operate it with gestures. Have any of you encountered similar problems?
    n
    • 2
    • 1
  • s

    Stylianos Gakis

    03/23/2023, 11:19 AM
    When in ColumnScope for example, if I need to have a AnimatedVisibility, for the contents of it, they don’t “inherit” this column scope, and they are laid out on top of each other. To mitigate that you need to have another column in there to make it work as you want it to. Something like this:
    Column {
      Stuff()
      AnimatedVisibility(shouldShow) {
        Column {
          Text()
          Spacer(Modifier.width(8.dp))
          Icon()
        }
      }
    }
    But when doing this with CompositionLocalProvider like this:
    Column {
      Stuff()
      CompositionLocalProvider(LocalContentColor provides LocalContentColor.current.copy(alpha = ContentAlpha.medium)) {
        Text()
        Spacer(Modifier.width(8.dp))
        Icon()
      }
    }
    You don’t need to do this, it just works. Why is this the case?
    CompositionLocalProvider
    isn’t even inline or something like that, nor is it an extension on ColumnScope for it to work due to that. So how does it work? What am I missing here?
    z
    l
    • 3
    • 2
  • m

    myanmarking

    03/23/2023, 12:04 PM
    does any1 know how to use the new Api LazyLayoutPinnableItem ?
    • 1
    • 3
  • u

    Umar Saidu

    03/23/2023, 12:04 PM
    Not that I know of
  • e

    Elio Maroun

    03/23/2023, 2:20 PM
    https://github.com/thellmund/Android-Week-View/issues/299#issue-1637184622 Has anyone used this library and facing the same issue?
    k
    • 2
    • 4
  • m

    mattinger

    03/23/2023, 2:51 PM
    Does anyone know how to properly handle bottom sheets in a hybrid app (part xml, part compose)? Basically the issue is that ModalBottomSheetLayout cannot scrim content that is not part of it’s child content, nor can it or BottomSheetScaffold have the sheet cover content that is not part it’s child content. In a hybrid type of app, the compose portion is likely not to be in control of the entire screen. Would the recommendation still be to use BottomSheetDialogFragment and BottomSheetBehavior, but have the views be written in compose?
    a
    c
    +3
    • 6
    • 7
  • v

    vide

    03/23/2023, 3:28 PM
    It seems there is yet another focus regression in compose-ui:1.4 😰
    E  java.lang.IllegalStateException: Check failed.
        [Full trace in thread]
       	at androidx.compose.ui.focus.FocusOwnerImpl.moveFocus-3ESFkO8(FocusOwnerImpl.kt:150)
       	at androidx.compose.ui.platform.AndroidComposeView$keyInputModifier$1.invoke-ZmokQxo(AndroidComposeView.android.kt:212)
    j
    • 2
    • 12
  • c

    Colton Idle

    03/23/2023, 4:51 PM
    Compose 1.4.0 stable released yesterday 🎉 Also, 1.1.0-beta01 of m3 • Updated the
    DateRangePicker
    to allow selecting a range with the same date for its start and end. (I16529, b/272882497) • Text fields now properly position their text elements when font size is smaller than expected. This may result in a few pixels change in your apps based on font settings and script. (I8b8d0) • Add layout type param to
    TimePicker
    composable. It allows to use different layouts, depending on the screen configuration (Ia0e16) • Added shadow elevation to
    BottomSheetScaffold
    (I94e0f) • Added support for displaying the date pickers without the header part And first releases of 1.5.0 (alpha 01) •
    AnimatedContent
    APIs are now stable
    AnimatedContentScope
    has been renamed to
    AnimatedContentTransitionScope
    .
    scaleIn
    and
    scaleOut
    are now stable APIs. (Iaf54e) • Text and
    BasicText
    is refactored to use the new modifier system. This leads to substantial performance improvements in many cases. No changes should be visible. (If1d17, b/246961435) • Added the
    PerformImeAction
    semantics action to invoke the IME action on text editor nodes. (IDK what this does, but sounds sorta importatnt?) • Add a chipgroup reflow sample. Update the horizontal padding in between child chips in the single line chipgroup sample to match spec. (I3b155) • Fixed an issue where
    ModalBottomSheetLayout
    would crash in an edge case on orientation change. Layout animations (e.g.
    Modifier.animateContentSize
    ) in/on the sheet content now work smoothly. (I2f981, b/266780234) • Adds
    Modifier.Node#coroutineScope
    to allow
    Modifier.Nodes
    to launch coroutines (I76ef9) • Allow
    Modifier.Nodes
    to read
    CompositionLocals
    by implementing the
    CompositionLocalConsumerModifierNode
    interface. (Ib44df) • LookaheadLayout has been replaced by LookaheadScope, which is no longer a Layout. This allows chid content in a LookaheadScope to be directly controlled by parent's MeasurePolicy. (Ibe2e5)
  • d

    dorche

    03/23/2023, 4:52 PM
    Looks like Material3
    BottomSheetScaffold
    has had a regression - it used to work fine with a LazyColumn but now the dragging of the sheet is broken if you do it in the bounds of the LazyColumn. Min repro in 🧵
    j
    • 2
    • 4
  • l

    Landry Norris

    03/23/2023, 6:45 PM
    Just learned that in compose UI 1.3.3, at least, trying to draw a text on a DrawScope off the canvas causes a crash. The latest androidx main appears to have the same code, so likely will crash as well.
    j
    • 2
    • 7
  • c

    CRamsan

    03/23/2023, 7:01 PM
    Does someone know if the Layout Inspector supports Jetbrains compose libraries for Android? They do not seems to work for me.
    l
    c
    • 3
    • 5
  • o

    Omkar Amberkar

    03/23/2023, 7:35 PM
    can jetpack compose motion scene xml have different start and end destination? can you share a info or link to any doc?
    c
    • 2
    • 5
  • l

    Lucca Beurmann

    03/23/2023, 7:56 PM
    Hello guys, can i use early returns inside @Composable to conditionally add UI elements?
    t
    • 2
    • 6
  • s

    Sergio

    03/23/2023, 9:03 PM
    Hello, can someone help me understand why I'm getting
    java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
    for this composable when doing a state read in the layout scope. The problem doesn't occur when I change using
    graphicsLayer
    from the lambda style (layout layer update) to the parameters arguments one (composition layer)
    s
    • 2
    • 10
  • e

    eygraber

    03/24/2023, 2:22 AM
    Is it OK to use
    @ReadOnlyComposable
    if the function only reads a
    State
    value?
    s
    • 2
    • 2
  • c

    chanjungskim

    03/24/2023, 3:55 AM
    How can I limit the size of input of TextField? in XML I used
    InputFilter
    something like this:
    val limitSizeInputFilter = arrayOf<InputFilter>(ByteLengthFilter(100, "UTF-8"))
    
    binding.nsetName.filters = limitSizeInputFilter
    Is there any equivalent to it in compose?
    c
    • 2
    • 1
  • s

    Stylianos Gakis

    03/24/2023, 9:34 AM
    Is there a way to get a Drawable from a ImageVector? I want to use something like
    androidx.compose.material.icons.Icons.Default.ArrowForward
    as a placeholder for my Coil AsyncImage, but it only takes in a
    @DrawableRes
    or a
    Drawable
    . Looking for if I am missing some way to do ImageVector -> Drawable before I opt to use the SubComposeAsyncImage instead.
    a
    • 2
    • 2
  • t

    Tung97 Hl

    03/24/2023, 10:01 AM
    Hi everyone I have a question. How do I use a custom font in Compose multiplatform?
    a
    • 2
    • 2
  • y

    Yariv Ziporin

    03/24/2023, 10:49 AM
    Hi everyone, I have a navigation drawer with a transaction report so whenever I press the "report" button in the nav drawer I want to fetch trasnaction using retrofit. I have a mutableList in my viewmodel and I update it with the data I get from the server. The problem is that in my screen I call getTransactions() and everytime the screen is composed this function is called over and over again. I understand the basic of compose and I know to handle states with remember, mutableStateOf etc., but I think I am missing something with lists. The exmaple I found are only shwoing how to fetch a one time list for example, a list of trivia questions and how to use it in the screen but not a test case where everytime you enter the screen you have to refresh the list and see if there are any new tranactions. Any ideas?
    z
    • 2
    • 3
  • s

    Stylianos Gakis

    03/24/2023, 11:49 AM
    Looking at the material icons here https://fonts.google.com/icons?icon.query=device+unknown I can see that for example this “Device Unknown” icon exists. But in here, one can play with the settings, weight, fill and so on. Most importantly I am interested in the “Fill” one, which makes the icon look quite different when filled vs not filled. From the icons provided by the dependency
    androidx.compose.material:material-icons-extended
    I don’t see any such configuration being possible. None of the options
    Filled, Outlined, Rounded, Sharp and TwoTone
    seem to be doing this. Is there something I am missing or is this simply not possible at the moment?
    c
    l
    • 3
    • 5
  • a

    alaershov

    03/24/2023, 11:51 AM
    Hey Composers! What's the state of dev on parallel composition execution? Is there an issue to track the progress on this?
    v
    • 2
    • 2
  • p

    Peter Mandeljc

    03/24/2023, 12:04 PM
    Is it just me, or is "side effect" in Compose weirdly named? Usually, outside of compose world, side effect is kind of undesired behavior you would want to avoid.
    f
    l
    +3
    • 6
    • 5
  • c

    Chachako

    03/24/2023, 12:24 PM
    I have a rather naive question purely out of curiosity :) Why does Compose make the reactive system so “complex”? Instead, couldn’t the Compose compiler analyze all composable functions that call
    state
    at compile time and records them, followed by inserting logic to update these composables after the corresponding “state operation”? Wouldn’t this approach effectively reduce the runtime overhead associated with recomposition?
  • s

    Stylianos Gakis

    03/24/2023, 12:28 PM
    For Material3 typography, when trying to dig into what is the default font style used, I see this line which simply says that the default is
    TextStyle()
    which internally does not specify the font size and so on, they are set as
    TextUnit.Unspecified
    . How do I know which typography value from the material3 typography is used by default if I simply call
    material3.Text("blahblah")
    without specifying the text myself? I know if I am in a contained which internally has set
    ProvideTextStyle
    it will be that, but what if I am not inside such a contained which has set that composition local? Couldn’t find anything in the m3 docs either for this.
    h
    • 2
    • 4
  • z

    Zaki Shaikh

    03/24/2023, 2:22 PM
    Hi all, in navigation 2.6.0-alpha navController.backQueue is private so and I want to know navigation history how can I do?
    c
    i
    v
    • 4
    • 6
  • t

    Tijs Gobbens

    03/24/2023, 4:06 PM
    Using the latest navigation 2.6.0-alpha07 im getting a strange exception when navigating without saveState, the strange part is it is triggered when having the navcontroller in the composable screen
    java.util.NoSuchElementException: ArrayDeque is empty.
        at kotlin.collections.ArrayDeque.removeLast(ArrayDeque.kt:163)
        at androidx.navigation.NavController.launchSingleTopInternal(NavController.kt:1850)
    e
    i
    • 3
    • 4
  • v

    vide

    03/24/2023, 4:10 PM
    Any pointers on how to use BringIntoViewRequester properly with padding around boundaries? I have used an approach of using a custom rect with
    .bringIntoView()
    before but this seems to break after
    1.4.0-alpha03
    . 🧵
    • 1
    • 5
Powered by Linen
Title
v

vide

03/24/2023, 4:10 PM
Any pointers on how to use BringIntoViewRequester properly with padding around boundaries? I have used an approach of using a custom rect with
.bringIntoView()
before but this seems to break after
1.4.0-alpha03
. 🧵
This is how it used to work
bringintoview-1.4.0-alpha03.webm
This is how the same code "works" on
1.4.0
bringintoview-1.4.0.webm
The idea is to scroll so that there's always a little bit of the next big square showing.
This is the bigger square container:
.border(2.dp, Color.Black)
.bringIntoViewRequester(bringIntoViewRequester)
.focusProperties { canFocus = false }
.onFocusChanged {
    if (it.isFocused) {
        scope.launch {
            bringIntoViewRequester.bringIntoView(
                Rect(-200F, -200F, 200F, 200F)
            )
        }
    }
}
.focusTarget()
I am not sure if this is a bug or if it has never been the correct approach to this 😅
View count: 2