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

    Michal Klimczak

    06/11/2021, 9:41 AM
    I've run some more tests on Pager performance and if I haven't messed up the test itself, it seems that original ViewPager is still quite a bit ahead when it comes to performance (which is understandable given how young it is, but still, good to know). More details in thread.
    💪 2
    n
    c
    • 3
    • 11
  • a

    Akram Bensalem

    06/11/2021, 10:34 AM
    What is the best approach to apply transition animation when switching between screens ?!
    m
    s
    • 3
    • 5
  • m

    Marcin Mazurek

    06/11/2021, 11:31 AM
    Hello during our implementation we notice a bug on
    Scaffold(
        bottomBar = ...
    When one of BottomNavigationItem's Layout contains NavHost it's crash when you select this BottomNavigationItem once and then the same item second time
    j
    • 2
    • 3
  • j

    Joey

    06/11/2021, 11:55 AM
    I've got a HorizontalPager from Accompanist and 2 pages both with an ExoPlayer view. When I set the ExoPlayer to resizeMode=RESIZE_MODE_ZOOM, the video zooms correctly, but somehow the surfaces of the video overlap. What would be the correct way to fix this? Somehow clipping it? (Modifier.clipToBounds didn't work) Change from SurfaceView to TextureView?
    c
    n
    j
    • 4
    • 5
  • s

    ste

    06/11/2021, 11:57 AM
    Hi guys! Silly question here 🙋‍♂️ I want to make my lineal icons line thickness customizable. There are two possibilities: 1. Craft the icons "by code" using
    Canvas
    : compose-like approach, very customizable solution but it will be a pain for complex icons (this is what I'm currently doing) 2. Ship N drawables with different line thickness: not very customizable, increases app size, feels like a waste 3. ???
    c
    n
    • 3
    • 6
  • a

    Artur Schwarz

    06/11/2021, 12:03 PM
    Hi everyone! Can anyone explain why this is happening? This doesn’t happen when using views only. Could this be a bug in compose? Code in 🧵
    Screen Recording 2021-06-11 at 13.58.09.mov
    p
    n
    • 3
    • 4
  • r

    Rodri Represa

    06/11/2021, 12:54 PM
    Hello guys, i'm using
    mutableListOf<Int>
    to track my calendar days which are selected in a period of time and then fill the square Grey. When I select a new period of time, I first empty the mutableListOf and later I save on it my new days in order to react and show the Grey square animation. The problem is that when I empty the mutableListOf and quickly select a new period of time, as you see in the beginning of the video, it seems that the mutableList has my old dates on cache? and then only the new days added to the period of time react to the change (the old dates animation doesn't trigger, you just see the square filled). However if I select a new date, and wait some seconds to select the endDay, my animation is triggered in all the days, because the mutableListOf doesn't have any data saved.
    21-06-11-14-42-58.mp4
    l
    z
    • 3
    • 3
  • d

    Danish Ansari

    06/11/2021, 2:25 PM
    I am trying to use
    paging-compose
    for creating a grid and I found out that there is no
    items
    function for
    LazyGridScope
    that accepts
    lazyPagingItems: LazyPagingItems<T>
    as there is one for
    LazyListScope
    Basically I'm not able to use pagination for creating a grid view. Is there any workaround for it?
    z
    a
    • 3
    • 5
  • i

    itnoles

    06/11/2021, 2:49 PM
    How I can add the Up button on Navigation Compose in the Detail View?
    i
    • 2
    • 3
  • s

    Se7eN

    06/11/2021, 3:37 PM
    Is it acceptable to add like 50-100 (and possibly even more) destinations to a
    NavGraph
    ? I can pass the
    id
    in a route but it would be great if I could do something like this:
    SampleCategory.Buttons.samples.forEach { sample ->
        composable(sample.id) {
            sample.content()
        }
    }
    z
    t
    • 3
    • 5
  • z

    Zun

    06/11/2021, 4:11 PM
    I want to have a list in my ViewModel that tracks what checkboxes the user selected. I saw this post which shows my approach is wrong https://github.com/Kotlin/kotlinx.coroutines/issues/2516, but what would be the correct approach? See thread for more info
    s
    • 2
    • 3
  • j

    Jesse Hill

    06/11/2021, 7:42 PM
    So I asked a question on SO here about why the
    composable
    for a route was being recomposed whenever the state inside my HiltViewModel changed. After thinking through it a bit I think I know the answer but wanted some confirmation before updating the post. I’ll put what I think is going on in the thread.
    m
    • 2
    • 6
  • t

    tad

    06/11/2021, 8:23 PM
    I would like to apply a draw transform to a wrapped
    IndicationInstance
    , but
    ContentDrawScope
    doesn't allow for that.
    n
    • 2
    • 5
  • a

    Adib Faramarzi

    06/11/2021, 8:58 PM
    https://adibfara.medium.com/the-story-of-my-first-a-ha-moment-with-jetpack-compose-c739bceb6b0b
    a
    • 2
    • 4
  • s

    spencer

    06/11/2021, 11:05 PM
    I’ve been trying for a long time to get exoplayer working in a LazyColumn, but I can’t get it to work without a lot of jankiness. I’ve created a minimum sample on github, link in thread.
    👍 1
    • 1
    • 2
  • i

    Indu

    06/12/2021, 1:32 AM
    The y position of the composable changes when the state that is used for changing the shape or color of the composable gets updated.
    z
    • 2
    • 7
  • m

    ms

    06/12/2021, 5:15 AM
    @cb can we expect a drag n drop or reorder feature in
    flowlayout
    anytime soon?
    c
    • 2
    • 1
  • a

    Adib Faramarzi

    06/12/2021, 5:51 AM
    has anyone tried compose (beta-08) with kotlin 1.5.20-RC?
    j
    • 2
    • 2
  • m

    Mayank Saini

    06/12/2021, 7:20 AM
    I am trying to setup an animation for the search view here. The behavior should be, as soon as the user hit the search bar it should collapse and move to the top right next to the back button*(Screen 2)* and if I hit the back button it should return to the previous position in expanded form*(Screen 1)*.
    s
    c
    c
    • 4
    • 5
  • c

    Colton Idle

    06/12/2021, 12:39 PM
    There's no text "linkify" in compose right? I have a
    Text
    that contains an email and I want to just make it clickable. Do I have to basically just set up something like this or is there something simpler that I'm missing?
    ➕ 1
    b
    m
    +2
    • 5
    • 11
  • s

    Shakil Karim

    06/12/2021, 2:00 PM
    Is there any easy way to hide bottom sheet completely not just half collapse?
    r
    a
    m
    • 4
    • 12
  • c

    Colton Idle

    06/12/2021, 4:01 PM
    Has anyone implemented a tinder-like interface? Essentially a stack of cards thats swipeable? Going to attempt to build something myself, but curious if there is some kind of good starting off point.
    r
    d
    • 3
    • 5
  • z

    Zun

    06/12/2021, 4:29 PM
    What would be the correct way of passing a default value to a ViewModel inside a composable, one that can be accessed inside its
    init
    function? Context in thread
    b
    • 2
    • 5
  • a

    Akram Bensalem

    06/12/2021, 4:55 PM
    How to make step by step wizard in compose ? Is there any example code ?
    n
    • 2
    • 3
  • d

    Daniele B

    06/12/2021, 4:56 PM
    I verified a different recomposition behavior between
    1.0.0-beta07
    and
    1.0.0-beta08
    This is the code:
    LazyColumn {
        stickyHeader {
            CountriesListHeader()
        }
        items(items = countriesListState.countriesListItems, itemContent = { item ->
            CountriesListRow(
                item = item,
                favorite = countriesListState.favoriteCountries.containsKey(item.name)
        })
    }
    In case
    countriesListItems
    hasn’t changed but
    favoriteCountries
    has changed: • in beta07,
    items
    recompose (and that’s what I would expect, as in
    CountriesListRow
    the
    favorite
    parameter depends on
    favoriteCountries
    ) • in beta08,
    items
    don’t recompose, as it seems Compose is just monitoring changes of
    countriesListItems
    and not
    favoriteCountries
    Is this a bug, or I should structure my code differently?
    s
    v
    r
    • 4
    • 5
  • p

    Paul Woitaschek

    06/12/2021, 7:19 PM
    Is it somehow possible to interact with the child composables of Scaffold? I find it very unflexible. For example on scroll I want change the elevation of the appbar. (so that it has 0dp and the default elevation on scroll)
    r
    • 2
    • 2
  • p

    Paul Woitaschek

    06/12/2021, 7:58 PM
    I'm a bit confused with the magic of compose regarding LocalContentAlpha. Generally our development workflow is that the designers build screens and define colors for each text. But now lots of prebuild composables change the LocalContentAlpha which leads to the situation that text colors are always different from what our designers intended. This usually leads to QA reviews like: "Can you check the text color of component a, b and c? It's different from what's in the ardboard". The only way around that I found so far is to always wrap everything in another
    CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high)
    . But that's a lot of overhead and it feels like working against the system.
    l
    • 2
    • 5
  • c

    chris-horner

    06/13/2021, 8:33 AM
    Has anyone noticed gradients not quite working correctly on older API levels? Here's a gradient that uses
    Color.Transparent
    on API 23 and API 27
    ➕ 2
    :kotlin-intensifies: 3
    😞 5
    a
    s
    • 3
    • 5
  • t

    theapache64

    06/13/2021, 8:46 AM
    Just another compose thing 😉 🎉 https://twitter.com/theapache64/status/1403995465113169923
    ❤️ 22
    c
    • 2
    • 1
  • f

    frankelot

    06/13/2021, 3:08 PM
    👋 qq: Is there a way to display a repeating background in compose? Something similar to “tileMode=repeat”
    ➕ 1
    r
    n
    • 3
    • 7
Powered by Linen
Title
f

frankelot

06/13/2021, 3:08 PM
👋 qq: Is there a way to display a repeating background in compose? Something similar to “tileMode=repeat”
➕ 1
r

Rafs

06/13/2021, 4:08 PM
If it's an image, you can draw it on the composable's background in anyway you want using
Modifier.drawBehind
f

frankelot

06/13/2021, 4:17 PM
Thanks, didn’t know about
drawBehind
I’m still not sure how to set the
canvas
to repeat the image 🤔
Okay, your solution kinda worked for me in the end 🙂 (since I only wanted a dotted background)…
for (x in 0..this.size.width.roundToInt() step 80) {
                for (y in 0..this.size.height.roundToInt() step 80) {
                    drawCircle(
                        color = Color.Black,
                        center = Offset(x.toFloat(), y.toFloat()),
                        radius = 8f,
                        alpha = .1f
                    )
                }
            }
r

Rafs

06/13/2021, 5:02 PM
A quick example of a horizontal repeat
💯 1
f

frankelot

06/13/2021, 5:03 PM
nice, yes, this works, not sure how expensive it is (in terms of performance) but is good enough for me right now
n

Nader Jawad

06/15/2021, 6:47 AM
The tile mode APIs are available as part of the ImageShader API. You can create a brush from that and draw a rectangle with the desired pattern
View count: 2