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

    Colton Idle

    06/02/2022, 7:07 AM
    Compose Version 1.2.0-beta03 released! 😛arty-parrot: Lotsa small cool stuff. (this is just my opinion from release notes + commit messages) • Added Experimental Easing Curves for Animations • Added new experimental
    IntervalList
    and
    MutableIntervalList
    . It allows to represent some list of values via multiple intervals. It will be useful when you want to define your own dsl similar to the one used by
    LazyColumn
    where list items can be defined via multiple item/items calls. (I2d05e, b/228580728) • Clarified the documentation for
    WindowInsets.ime
    to state that
    ime
    insets are reported as far back as API 23, but only animated on 30+. (Ia7fc0, b/230756508) • Pressing the forward delete key when the cursor is at the end of a text field will no longer crash. • Fix incorrect offset calculation for Modifier.animateItemPlacement() in lazy lists • Fix for stretch overscroll clipping the shadow (OHHHH YEAHHH. This made carousels look kinda bad. 💯 ) • Show selection handles in read-only text field • Fixed a bug where
    BottomSheetScaffold
    was drawing over the top app bar's shadow.
    BottomSheetScaffold
    now also takes the sheet's state into account when placing Snackbars: in the collapsed state, Snackbars are placed above the sheet and FAB; in the expanded state, Snackbars are anchored to the sheet's bottom. (thanks Jossi 😄 ) • Fix Material outline text field label measurement • Fix inner text field position of the OutlinedTextField when label is multiline • Clean up invalidated compositions during disposal • Fix derive state read during recomposition ("sometimes causing infitinite recompositions" ?) • Baseline profiles for compose should be derived using benchmarks. • The
    Show Layout Bounds
    setting will now be applied for composables immediately after toggling it from the quick settings tile, without having to leave and re-enter the activity. (OHHHH YEAH) • Some minor fixes for custom font stuff • Material3 Version 1.0.0-alpha13 released
    🎉 6
    👍 3
    :thank-you: 22
    e
    t
    +3
    • 6
    • 8
  • a

    Aaron Waller

    06/02/2022, 7:22 AM
    How can I perform an action when the user closes the keyboard? All i can find is how to handle ImeAction clicks. I want to call focusManager.clearFocus() no matter how the user closes the keyboard.
    f
    z
    • 3
    • 2
  • t

    Tolriq

    06/02/2022, 8:28 AM
    Is there a way to use the system default font in Compose? Seems Samsung users loves to change their font.
    ➕ 1
    c
    • 2
    • 3
  • a

    Alexander Maryanovsky

    06/02/2022, 9:49 AM
    How do I animate a new element entering the composition? Like if I have a
    Column
    with a variable number of items and I want a new item to slide in when it’s added.
    AnimatedVisibility
    doesn’t seem to be the right solution, because the content is not visible/invisible, it just doesn’t exist before it’s added.
    a
    t
    • 3
    • 2
  • m

    Mikael Ohlson

    06/02/2022, 1:42 PM
    Hey there! Does Jetpack Compose require gradle? We are looking at ways to be able to use Compose with a project that uses Soong for one of our shared libraries, but where the Soong version needs to build it from source without gradle.
    j
    • 2
    • 3
  • m

    myanmarking

    06/02/2022, 5:27 PM
    is there any padding equivalent, optimised with graphics layer =?
    a
    • 2
    • 7
  • r

    Remon Shehata

    06/02/2022, 7:10 PM
    I want to use an XML layout for a custom view inside my compose view. the problem is the constructor my custom view takes
    Context
    and
    AttributeSet
    from Compose I can pass only the
    Context
    is there a way to pass the
    AttributeSet
    ?
    a
    • 2
    • 1
  • l

    Luke

    06/02/2022, 7:53 PM
    I have an issue with
    Text
    that I think might be a bug in the framework. Basically, when I put a
    height(x.dp)
    modifier on a
    Text
    , but the text is too long, the last line appears outside the bounds of
    Text
    . More in thread.
    👀 1
    l
    s
    +2
    • 5
    • 14
  • m

    mattinger

    06/02/2022, 8:53 PM
    Other than manually putting in dividers between each element, is there a good way to put a divider between elements of a column? I’m not convinced a vertical arrangment can insert some sort of composable, or force any drawing. It seems to only be able to position items that are already children.
    j
    c
    z
    • 4
    • 4
  • l

    Lilly

    06/03/2022, 12:34 AM
    What is the recommended way to handle these false positive warnings about
    Add permission check
    in composables?:
    Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException
    With Android 12 this shit becomes really confusing. Anything that is not like:
    if (ActivityCompat.checkSelfPermission(
                this,
                Manifest.permission.BLUETOOTH_CONNECT
            ) != PackageManager.PERMISSION_GRANTED
        ) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return
        }
        val deviceName: String? = sharedPresenter.connectedDevice?.name // no warning
    will be reported as if the permission has never been granted, which is technically wrong. But the example above is no real world use case and also verbose and leads to duplicated code. That's why accompanist has its
    rememberPermissionState
    API. But using this API does not prevent the warning.
    j
    c
    • 3
    • 4
  • n

    Nabeel

    06/03/2022, 11:37 AM
    When using
    MaterialSharedAxis
    transition for fragment with
    ComposeView
    getting crash when pressing back button, Full question in Thread
    ➕ 2
    • 1
    • 5
  • l

    lilypuchi

    06/03/2022, 2:05 PM
    What exactly is Mario scrolling :blob-sweat-smile: ? https://android-review.googlesource.com/c/platform/frameworks/support/+/2063892
    🍄 10
    j
    • 2
    • 2
  • j

    Jhonatan Sabadi

    06/03/2022, 2:14 PM
    Someone knows why individual item shows
    Divider
    and
    LazyRow
    hides
    Divider
    ?
    ✅ 1
    l
    • 2
    • 16
  • s

    Slackbot

    06/03/2022, 2:15 PM
    This message was deleted.
    m
    • 2
    • 2
  • f

    FunkyMuse

    06/03/2022, 3:07 PM
    Hey guys, is there a way to measure pressure events on touch, i know it could've been done with gesture detector previously in the view system but I can't seem to find anything in Compose?
    z
    l
    • 3
    • 2
  • l

    Lucas

    06/03/2022, 4:36 PM
    Is this channel exclusive for android compose or is it for compose in general?
    f
    l
    • 3
    • 3
  • a

    Arjan van Wieringen

    06/04/2022, 9:17 AM
    Is there a library function to collect a StateFlow to State without being @Composable? It is, I think, pretty trivial to do myself, but I can imagine it is a pretty common pattern in something like a ViewModel?
    class AppViewModel(val someExternalStateFlow: StateFlow<Something>, val scope: CoroutineScope) {
       private var _state = mutableStateOf(someExternalStateFlow.current)
       val state: Something by _state
    
       init {
         someExternalStateFlow.onEach { _state.value = it }.launchIn(scope)
       }
    }
    Something like this:
    fun <T> StateFlow<T>.collectAsState(scope: CoroutineScope): State<T> {
        val state = mutableStateOf(this.value)
        this.onEach { update -> 
            state.value = update
        }.launchIn(scope)
        return state
    }
    👀 1
    z
    • 2
    • 2
  • j

    juliocbcotta

    06/04/2022, 11:40 AM
    Is there any particular reason why compose does not support method reference in @Composable functions? Is it a design decision or just a current limitation?
    e
    • 2
    • 2
  • n

    Nat Strangerweather

    06/04/2022, 1:20 PM
    I'm trying to understand how to read the Recomposition Counts in Layout Inspector. It looks like there might be a problem with my text. Could someone please have a look at my screenshot in thread?
    s
    a
    s
    • 4
    • 9
  • m

    Marko Novakovic

    06/04/2022, 2:51 PM
    does anyone know and can link sample that has items being swiped in both left and right, swipe left to dismiss (item disappears) and swipe right to complete, select etc. (item remains on the screen)?
    m
    s
    • 3
    • 3
  • m

    Mehdi Haghgoo

    06/04/2022, 3:30 PM
    val multiSelectionEnabled = rememberSaveable{mutableStateOf(selection.isNotEmpty())}.value
    Will changing selection, trigger a recomposition? Can this be used instead of using delegates?
    s
    z
    • 3
    • 3
  • m

    Mateusz Wieczorek

    06/04/2022, 3:50 PM
    Hi there! Is there any way to block scroll to the left in HorizontalPager? I want to allow scroll to the right only
    h
    • 2
    • 1
  • n

    Nikolai Wotton

    06/04/2022, 4:25 PM
    👋 Are the new experimental context receivers usable with Composable functions? I’ve tried playing around with some basic examples but keep running into
    Backend Internal error: Exception during IR lowering
    , wondering if I’m doing it wrong or if it’s just not supported yet
    ➕ 1
    j
    • 2
    • 14
  • l

    Laurence Muller

    06/04/2022, 5:44 PM
    Hi, I'm learning Compose and trying to re-implement a rectangle with a border only on 3 sides. In the old school way, I created a drawable with a negative offset, but in the world of Compose I'm not sure what the equivalent would be. Any ideas what I should try?🧵
    j
    • 2
    • 4
  • n

    Norbi

    06/05/2022, 2:43 PM
    I would like to propose a "new" kind of Compose state management instead of Redux-like solutions.
    a
    c
    +2
    • 5
    • 12
  • s

    Sterling Albury

    06/05/2022, 11:45 PM
    I'm trying to figure out how to pass arguments to the start of my compose nav graph. I haven't worked with composable navigation before and I'm most likely doing things in an unrecommended way a bit, but here's a little more detail with what I'm trying to do. I've got a fragment with a ComposeView, and that composable content contains the composable nav graph...the simplified version is something like this:
    fun SomeComposableContent(startRoute: String) = 
        NavHost(
            route = "outer",
            startDestination = "inner/{userId}"
        ) {
            navigation(startDestination = "inner/start/{userId}", route = "inner/{userId}" {
                composable(route = "inner/start/{userId}") { backEntry ->
                    val userId = backEntry.arguments?.getString("userId")
                    ScreenOne(userId)
                }
            }
    
            composable(route = "next") {
                ScreenTwo()
            }
        }
    If I use the "next" destination as my start and then navigate to the inner graph with passing an arg, things work, but if I want to start at the inner start destination, and I'm not calling navController.navigate(), how can I pass the argument? I'm basically trying to load the graph and pass the argument..is that possible?
    i
    b
    • 3
    • 17
  • s

    Satyam G

    06/06/2022, 4:26 AM
    Hello, After installing the app built with Jetpack Compose. It seems that Text shows different weights on different devices ? How to resolve this to keep this constant ??
    👀 1
    z
    z
    • 3
    • 7
  • f

    fengdai

    06/06/2022, 5:31 AM
    Can I reuse a node in Jetpack Compose? With the View system, I can remove a view from its parent, then add it to another container. How can I achieve this with Compose?
    n
    • 2
    • 2
  • w

    wck

    06/06/2022, 5:53 AM
    Did anyone ever encounter a
    SnackBar
    duration issue where it always shows 10seconds in emulator and works fine(4 seconds)on the real device (with
    duration = SnackbarDuration.Short
    )? really odd. • No developer settings to change animation
    • 1
    • 1
  • s

    Saiedmomen

    06/06/2022, 7:31 AM
    Here is a runnable, generated catalog of compose samples that I've created. With it you can quickly checkout samples while developing. https://github.com/saied89/compose-legos https://play.google.com/store/apps/details?id=home.saied.composesamples Hope you find it useful and Do please hit me with feedback and ideas :)
    💪 3
    x
    • 2
    • 2
Powered by Linen
Title
s

Saiedmomen

06/06/2022, 7:31 AM
Here is a runnable, generated catalog of compose samples that I've created. With it you can quickly checkout samples while developing. https://github.com/saied89/compose-legos https://play.google.com/store/apps/details?id=home.saied.composesamples Hope you find it useful and Do please hit me with feedback and ideas :)
💪 3
x

xxfast

06/06/2022, 8:27 AM
Hmm, the code viewer looks weird in dark mode 🧐
s

Saiedmomen

06/06/2022, 8:32 AM
yes. sorry. It is a work in progress 😅
View count: 3