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

    Abhishek Kumar

    01/03/2022, 7:24 AM
    @channel I have implemented 
    HorizontalPager
     with 
    TabRow
     in my project. My HorizontalPager uses default fling behaviour from 
    PagerDefaults.flingBehavior(state)
    . I have not overridden the fling behavior. This is how the code looks like:
    val pagerState = rememberPagerState()
        HorizontalPager(
                    count = profileState.tabs.size,
                    state = pagerState
                ) {..grid item..}
    I have to scroll very hard to scroll between the pager items. I want the pager to scroll to next/previous screen on even slight scroll. After debugging and logging, I found that 
    initialVelocity
     in 
    performFling
     method is coming out to be 
    -0.0
     (same for left and right fling) all the time for some reason. Can anyone help with this?
    a
    • 2
    • 2
  • m

    MRSasko

    01/03/2022, 9:04 AM
    Hello, is there anybody who can help me out with compose animations? I need to disable the default AnimatedNavHost animations, but nothing seems to work. I have tried following: I am using:
    implementation "com.google.accompanist:accompanist-navigation-animation:0.22.0-rc"
    AnimatedNavHost(navController, startDestination = Routes.Main.route,
            popEnterTransition = { EnterTransition.None },
            popExitTransition = { ExitTransition.None },
            enterTransition = { EnterTransition.None },
            exitTransition = { ExitTransition.None }
           ) {
            bottomNavGraph(navController = navController)
            userNavGraph(navController = navController)
        }
    m
    k
    • 3
    • 5
  • v

    Vivek Sharma

    01/03/2022, 6:16 PM
    I am implementing PinchToZoom in my app, I am able to reach somewhere taking some help from @Albert Chang Now I am using that in
    LazyColumn
    and having
    Zoomable - my custom composable having pinch to zoom
    as each item in
    items{}
    So when I zoom the first item, it is showing behind others , I think they are being stacked inside
    Box
    , so how can I overcome this thing? See this 👇
    pinchtozoom.mp4
    s
    a
    • 3
    • 10
  • f

    farmerbb

    01/03/2022, 6:23 PM
    Forgive me if this has already been discussed, but is it safe to use version 1.1.0-rc02 of the Compose compiler with 1.1.0-rc01 of all the other Compose artifacts? Needing to use 1.1.0-rc02 for the Kotlin 1.6.10 compatibility
    👍 1
    b
    • 2
    • 1
  • m

    Mehdi Haghgoo

    01/03/2022, 6:44 PM
    Can this animation be created with Compose animations and drawing capabilities? It's supposed to start drawing from one point and draw to finish.
    screen-20220103-215642~2.mp4
    c
    s
    • 3
    • 2
  • m

    mattinger

    01/03/2022, 6:57 PM
    So i’m trying to animate through a range of different colors represented as a list. I am able to use animateColor to animate between two different colors, but i’m having a hard time finding a way to animate through a list. in the xml world, i’d simply use
    ValueAnimator.ofArgb
    function. I’m not finding an equivalent in compose (at least not easily)
    b
    • 2
    • 7
  • r

    Rick Regan

    01/03/2022, 9:04 PM
    In Android 12, swiping back from your app's home screen no longer "kills" the app. If the user wants to exit the app and start fresh, is the recommended way to do it to drag the app to Recents and then swipe it away? I was considering adding an "Exit" menu option to my app, which I have not seen in many apps, but which seems like a more direct way to restore the old back behavior. To implement that, what would be the right way in Compose? Specifically, I was wondering if it could be done with Navigation Compose.
    b
    c
    • 3
    • 6
  • f

    FunkyMuse

    01/03/2022, 9:34 PM
    Hey guys, does anyone know if LazyColumn supoorts fast scrolling?
    d
    • 2
    • 1
  • c

    Colton Idle

    01/03/2022, 9:53 PM
    Is there a way to have a Material Button with a gradient? I found this sample which works until I try to apply a CircleShape to it so that it becomes a "pill" shaped button. https://stackoverflow.com/questions/65542068/jetpack-compose-button-with-gradient-background Is there no way to define a single color as a gradient?
    c
    c
    • 3
    • 5
  • f

    FunkyMuse

    01/03/2022, 10:33 PM
    does anyone have the same problem when using https://google.github.io/accompanist/navigation-material/ with
    BottomSheet
    as destination with an AnimatedNavHost, after using navigateUp the sheet scrim is still visible but the bottom sheet is dismissed, it works fine if you click on the scrim (both are dismissed)
    c
    • 2
    • 3
  • r

    Rafs

    01/03/2022, 10:34 PM
    Does anyone have any idea which
    TextField
    property is responsible for drawing the thin horizontal line when in unfocused mode? It disappears when the textfield is focused. Right image is focused, left is unfocused
    c
    t
    • 3
    • 4
  • c

    Colton Idle

    01/04/2022, 12:10 AM
    Has anyone created a "legacy" material text input field on github somewhere? i.e. Pre 2019 material text input? https://medium.com/google-design/the-evolution-of-material-designs-text-fields-603688b3fe03
    j
    • 2
    • 2
  • m

    myanmarking

    01/04/2022, 12:13 PM
    can any1 recommend a library for html text strings ?
    b
    c
    +2
    • 5
    • 19
  • s

    Stylianos Gakis

    01/04/2022, 1:46 PM
    There’s one tooling “problem” (might just be me) with compose that I haven’t seen people discuss yet. When we do “Search usages” (Cmd/Ctrl + B) on a composable function, we get both references to it inside @Preview composable functions and in production code. I kind of wish there was a way to filter out the usages inside the previews because like 99% of the time it is not what I am looking for, and it only makes it so much slower to go into the production versions of them. It’s especially annoying that by default the pre-selected option that comes when clicking the shortcut is sometimes the preview one, and sometimes the production one. So it’s not consistent, making every time I click it a mini-game of me trying to figure read which one has the “Preview” suffix (picture attached). Does anyone else feel the same way? Any ideas to make this mild annoyance nicer?
    ➕ 5
    l
    b
    a
    • 4
    • 7
  • l

    loloof64

    01/04/2022, 2:35 PM
    Hi ! Maybe an easy question, but is it possible to get the context from a ViewModel subclass ?
    a
    c
    l
    • 4
    • 6
  • m

    mattinger

    01/04/2022, 3:17 PM
    Has anyone else had issues with double button taps using the animated navigation controller? I’ve noticed that because of the animation aspect, the button can be tapped a second time while it’s moving off screen, and this can cause issues. Does anyone have a good, non intrusive, suggestion for how to prevent that?
    s
    • 2
    • 2
  • a

    Ankit Shah

    01/04/2022, 4:36 PM
    Hello Everyone, I am implementing a bottom navigation bar and inside I have many Composable pages. I am trying to open a ModalBottomSheetLayout in one of the page, and the modal opens above the bottom navigation bar. How can I show the bottom sheet on top of the bottom navigation bar.
    o
    • 2
    • 4
  • j

    jeff

    01/04/2022, 5:52 PM
    Anyone have recommendations for getting sample JSON usable by a Compose
    @Preview
    ? We normally use Moshi to deserialize but that doesn't seem to work in previews because codegen hasn't run. I could construct the resulting (post-deserialization) object manually, but the JSON has enough nesting that it's very cumbersome.
    m
    b
    • 3
    • 3
  • s

    ste

    01/04/2022, 10:30 PM
    I'm getting a
    Compose Runtime internal error
    with this basic snippet, only on release builds. Would you confirm there's nothing I'm missing so I can open an issue?
    @Composable
    fun Main() {
        Bug(items = listOf(1, 2, 3)) {
            BasicText(text = it.toString())
        }
    }
    
    @Composable
    inline fun <T> Bug(items: List<T>, crossinline content: @Composable (item: T) -> Unit) {
        for (item in items) content(item)
    }
    • 1
    • 1
  • m

    mattinger

    01/05/2022, 12:10 AM
    Has anyone been able to draw an arc on a cvanas and keep it entirely within the canvas? I’m having trouble with this. For whatever reason, part of the ring being drawn is always outside the Box that i’m using. Code and screencap in the thread. I’ve even tried adding a padding to the BoxWithConstraints, but it doesn’t seem to affect anything.
    k
    t
    • 3
    • 7
  • b

    brabo-hi

    01/05/2022, 12:17 AM
    Hi all, how can we animate keyboard hide/show
    val keyboardController = LocalSoftwareKeyboardController.current
    
    keyboardController?.hide()
    v
    • 2
    • 1
  • a

    allan.conda

    01/05/2022, 3:44 AM
    Is there a length limit for navigation routes? Saw an old thread but seems to be about a different issue. We’re sending a form input as query input which can take up to 1000 characters. The destination cannot be found if the argument is too long it seems.
    i
    r
    • 3
    • 13
  • a

    Andy Himberger

    01/05/2022, 5:24 AM
    Upgrading our compose version from 1.1.beta03 to current and one of our unit tests for a Popup started hanging. I can see in the history in beta04 a change was made adding a loop in popup I'm not sure how to workaround.
    • 1
    • 2
  • d

    Dominaezzz

    01/05/2022, 9:23 AM
    Has anyone tried using the new Ktor locations (https://ktor.io/docs/eap/type-safe-request.html#resource_url) to make navigation routes type safe?
    h
    • 2
    • 2
  • a

    Abhishek Kumar

    01/05/2022, 10:24 AM
    I'm using Paging-3 library, I'm facing this issue where
    collectAsLazyPagingItems().itemCount
    returns 0 for sometime even after updating the
    Flow<PagingData<Item>
    . After sometime only itemCount returns the actual value. any lead on this?
    👍 1
    a
    • 2
    • 1
  • a

    Ankit Shah

    01/05/2022, 11:06 AM
    Can I pass composable function in navController.navigate(“routeName”)? If yes how can I pass it?
    y
    i
    • 3
    • 2
  • l

    Lilly

    01/05/2022, 1:24 PM
    I would like to have the
    TextFieldColors
    to apply the color for
    onSecondary
    instead of
    onPrimary
    . I tried with
    TextStyle.color
    or wrapping it in a Surface and setting contentColor but nothing works. The text/label/indicator color is always black. My
    onSecodary
    color is white.
    Column(modifier = Modifier.padding(8.dp)) {
                TextField(
                    modifier = Modifier.fillMaxWidth(),
                    value = password,
                    onValueChange = { password = it },
                    label = { Text("Password") },
                    visualTransformation = PasswordVisualTransformation(),
                    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
               )
    }
    Any ideas?
    b
    c
    • 3
    • 16
  • m

    myanmarking

    01/05/2022, 1:37 PM
    is there any way to query the modifier for a specific attribute, like contentDescription. In a child composable, i want to be able to extract the parent contentDescription so i can append to child contentDescription name. What would be the best approach of doing this ? I have access to parent modifier
    z
    • 2
    • 5
  • y

    Yev Kanivets

    01/05/2022, 2:16 PM
    Hey, composers! I have a question about composable items reusability in
    LazyColumn
    /
    LazyRow
    . Basically, are underlying views in view hierarchy are ever reused for new views while scrolling? Or do they always created from scratch?
    RecyclerView
    created (
    onCreateViewHolder
    ) views only for those which are on the first screen and reused them (
    onBindViewHolder
    ) when scrolling.
    b
    a
    c
    • 4
    • 6
  • h

    hfhbd

    01/05/2022, 2:27 PM
    Compose Compiler can compare a tree of nodes. But can it compare different nodes with built-in lists of other nodes too? Usecase:
    data class Foo(val bar: List<Bar>) { data class Bar(val i: Int) }
    Can Compose generate the difference of
    Foo(emptyList())
    and
    Foo(listOf(Bar(1))
    and
    Foo(listOf(Bar(42))
    ? At the end, I would like to use Compose as a general tree diff tool with my own tree implementation by using difference instances of my tree.
    z
    • 2
    • 3
Powered by Linen
Title
h

hfhbd

01/05/2022, 2:27 PM
Compose Compiler can compare a tree of nodes. But can it compare different nodes with built-in lists of other nodes too? Usecase:
data class Foo(val bar: List<Bar>) { data class Bar(val i: Int) }
Can Compose generate the difference of
Foo(emptyList())
and
Foo(listOf(Bar(1))
and
Foo(listOf(Bar(42))
? At the end, I would like to use Compose as a general tree diff tool with my own tree implementation by using difference instances of my tree.
z

Zach Klippenstein (he/him) [MOD]

01/07/2022, 5:33 PM
Compose doesn't compare trees of nodes. It generates effectively change lists by performing composition, then applies those changes to the tree. So to answer your question, nope. Compose is not a diff tool.
h

hfhbd

01/08/2022, 10:03 AM
Ah, okay. But would you able do use it as a diff tool too, iff the data is not given, but generated during compositions? With a custom compose applier, you could store the changes and return it later?
z

Zach Klippenstein (he/him) [MOD]

01/10/2022, 8:07 PM
Compose generates and updates a tree data structure from an execution of composable functions. Trying to use it for something else might work, but will probably be pretty hacky and more complex than it's worth
View count: 7