https://kotlinlang.org logo
Docs
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
  • t

    Tash

    11/29/2021, 9:24 PM
    Experimenting with using SnapshotState APIs in Android View-only rendering world (just including the compose runtime artifact). Using
    snapshotFlow
    to observe `mutableStateOf<T>`s in `Fragment`s. Noticing that
    withMutableSnapshot
    is required when updating the state (from Android View callbacks for example) in order to propagate updates, but I don’t understand why it’s required in this case… 🤔
    a
    • 2
    • 3
  • z

    zsperske

    11/29/2021, 9:38 PM
    How do I make the decision on where to navigate outside of my composable? Say I have some card:
    Card(onClick = { viewModel.postEvent(EventListUIEvent.EventSelected(eventState.event)) } )
    I want to make a decision on where to go next without my composable knowing about its potential destinations.
    i
    • 2
    • 5
  • j

    jeff

    11/29/2021, 10:41 PM
    is
    Modifier.alpha(0f)
    the Compose equivalent of
    View.INVISIBLE
    ? In regards both to performance and things like screen readers? Is there something better I should be doing?
    c
    t
    • 3
    • 3
  • a

    Arsen

    11/29/2021, 11:16 PM
    What would happen, if Snapshot#*nextSnapshotId* reach max value? Next increment resets it to zero due to overflow, so "monotonically increasing" rule will break?
    c
    k
    • 3
    • 3
  • b

    brabo-hi

    11/30/2021, 12:16 AM
    Hi all, when using compose material3, how could we launch snackbar since the ScaffoldState doesnt have
    scaffoldState.snackbarHostState
    it only has
    drawerState
    ?
    👀 1
    a
    r
    • 3
    • 3
  • a

    amiracam

    11/30/2021, 3:57 AM
    I'm interested in Jetpack Compose multi platform but the objective is from one code base to deploy both a desktop and web app, is that currently possible ? much thanks
    d
    • 2
    • 4
  • k

    K Merle

    11/30/2021, 7:38 AM
    Anyone know how to do a chat bubble shape with an arrow on a side in Compose?
    d
    • 2
    • 1
  • j

    Johan Reitan

    11/30/2021, 10:24 AM
    I’d like to handle a navigation result in a
    ViewModel
    . I expected that I could use the
    SavedStateHandle
    injected in my
    ViewModel
    to listen to the navigation result, but I see that this
    SavedStateHandle
    is not the same as the one from the
    NavBackStackEntry
    that holds the result. Details in thread 🧵
    i
    • 2
    • 9
  • e

    Erlan Amanatov

    11/30/2021, 11:10 AM
    Hi everyone. Just finished working on this little project with some cool animations, it was a joy to work with jetpack compose. I'm pretty pleased with the result. Original idea and design . Link to my repository . :kotlin-intensifies::jetpack-compose:
    rateIt60.mp4
    😂 10
    🙌 3
    👍🏻 1
    😁 8
    :kotlin-intensifies: 6
    😱 6
    👍 17
    👍🏼 1
    🙌🏻 1
    🙌🏾 1
    z
    • 2
    • 2
  • s

    Samir Basnet

    11/30/2021, 12:21 PM
    val scrollState = rememberLazyListState()
    val lazyInsuranceItems = pager.collectAsLazyPagingItems()
    LazyColumn(state = scrollState) {
        itemsIndexed(lazyInsuranceItems) { index,insurance ->
            InsuranceCell(insurance!!) {
                navController.navigate("InsuranceDetail/${insurance.id}")
            }
        } }
    Trying to create list and detail screens as above but on returing to list the scroll position is lost and returns to top. Can anyone guide me on how to maintain scroll position?
    z
    • 2
    • 1
  • t

    Tim Malseed

    11/30/2021, 12:27 PM
    Hi all, I’ve got a bug in testing Compose navigation that I’ve been trying to solve over the course of the past week. I suspect there’s a bug in the testing framework. If someone could help confirm that, I’d be happy to file a bug report. I’m getting a crash when one of my tests runs after another test. It seems that there’s some lingering state or something going on. Both tests can be run in isolation and pass. But one test fails if run after the other. Code in thread
    z
    • 2
    • 7
  • p

    Paul

    11/30/2021, 1:08 PM
    Hey everyone. I'm trying to achieve a simple animation with text expanding and collapsing. However, I've stumbled across the problem I'm not sure how to solve. Thread 👇
    d
    • 2
    • 5
  • a

    Arsen

    11/30/2021, 1:23 PM
    According to comment, it doesn't clear, that calling "dispose" is mandatory at the end of Snapshot's lifecycle, it seems more like optional which is not.
    z
    • 2
    • 1
  • i

    iamthevoid

    11/30/2021, 1:32 PM
    I have a problems with snap behavior in accompanist view pager. Sometimes when i swipe pager with finger it doesn’t scroll until page bound and remains at same position where i leave it whn scroll with finger. Is there something special about finger scrolling? when i use
    state.animateScrollToPage
    all works correct
    s
    • 2
    • 2
  • b

    Brian G

    11/30/2021, 1:39 PM
    How can we call WebView.destroy() within Compose? When using AndroidView+WebView. Does it even matter?
    z
    • 2
    • 2
  • a

    Archie

    11/30/2021, 2:03 PM
    Hi Guys, Whats the best approach for NavGraph where a combination of Persistent TopAppBar and/or BottomNavigationBar but you also need a Full Screen that provide its own TopAppBar/BottomNaivgationBar?
    i
    • 2
    • 8
  • k

    Kiprop Victor

    11/30/2021, 2:06 PM
    Hi, I have a list of items that I want to iterate through one at a time via clicks and display its content in a composable:
    🧵 2
    m
    • 2
    • 3
  • c

    Colton Idle

    11/30/2021, 3:04 PM
    Is there any chance to write this
    style = MaterialTheme.typography.h1,
    but have the "h1" be a variable. like val myStyle = "h1" then have
    style = MaterialTheme.typography.+myStyle
    a
    c
    • 3
    • 8
  • s

    Slackbot

    11/30/2021, 5:46 PM
    This message was deleted.
    c
    k
    +3
    • 6
    • 22
  • b

    brabo-hi

    11/30/2021, 6:20 PM
    When using Scaffold on compose material 3, how could we dock floating action button ?
    c
    • 2
    • 9
  • t

    theapache64

    11/30/2021, 7:04 PM
    Navigation Compose + Hilt: 💉 How can I do
    @AssistedInject
    with Navigation Compose’s
    hiltViewModel
    method? More Info ➡️ 😒tackoverflow: https://stackoverflow.com/questions/70174711/how-to-do-assisted-injection-with-navigation-compose
    z
    i
    • 3
    • 2
  • j

    jeff

    11/30/2021, 8:41 PM
    Can anyone recommend some reading about what parts of a composable will recompose when, and why, and how to avoid recomposition, that sort of thing?
    d
    c
    +2
    • 5
    • 6
  • j

    Joseph Hawkes-Cates

    11/30/2021, 10:50 PM
    Good evening, compose friends. I’m running into a discrepancy with a Box where it lays out differently on device than in preview or interactive mode. See thread for more info…
    c
    • 2
    • 8
  • c

    Chris Fillmore

    11/30/2021, 11:09 PM
    Is it possible to position an element on a bottom sheet so that it always sits on the bottom of the screen, regardless of whether the sheet is in
    HalfExpanded
    or
    Expanded
    state? In particular, what I observe is that when the bottom sheet content is more than 50% of the screen height, and the bottom sheet is
    HalfExpanded
    , then the element is positioned below the bottom of the screen (not visible). If I drag it to
    Expanded
    state, then the positioned element becomes visible. For example:
    // I'm using bottom sheet navigation
    bottomSheet(...) {
      Box {
        Column {
          // Some content here
        }
        Row(
          // Alignment from BoxScope
          modifier = Modifier.align(Alignment.BottomCenter)
        ) {
          // I have some buttons I want to put here that will remain at the bottom of the screen while the bottom sheet is open
        }
      }
    }
    • 1
    • 1
  • u

    ursus

    12/01/2021, 12:38 AM
    How to make this UI performant? Naively ofcourse its trivial, its a Column of N Cards, where each Card is a Column of M Items Making it LazyColumn of N Cards helps, however, each Card can be unboundedly big (i.e. number of Items is not fixed) Is there a way to make the each item within Card recycleable? Or try to fake it via flattening it into List<ListItem> and adding horizontal ui to each item to make it appear its nested in a parent, when its not?
    c
    • 2
    • 13
  • c

    Colton Idle

    12/01/2021, 4:22 AM
    I'm looking at ways to specify a modifier conditionally. I found two samples in this slack. 1.
    inline fun Modifier.modifyIf(condition: Boolean, then: Modifier.() -> Modifier): Modifier =
        if (condition) then() else this
    2.
    inline fun Modifier.thenIf(condition: Boolean, block: () -> Modifier) =
        this.then(if (condition) block() else Modifier)
    Number 1 does not work for me (it actually messed up my modifier), while number 2 works exactly as expected. I'm not sure why. Any ideas?
    i
    b
    s
    • 4
    • 9
  • f

    Filip Wiesner

    12/01/2021, 8:18 AM
    Is there a way to use only enter (or only exit) animation in
    AnimatedVisibility
    ? I tried
    fade
    with
    tween(duration = 0)
    but there is still small delay before the view disappears.
    a
    z
    +2
    • 5
    • 12
  • s

    Slackbot

    12/01/2021, 9:11 AM
    This message was deleted.
    z
    z
    • 3
    • 4
  • m

    Marcello Galhardo

    12/01/2021, 1:55 PM
    If I have a single (complex) state in a VM and I observe it from my Composable: all the views that observes any property of this state will always be recomposed on any emission or compose somehow is capable to discover that only a single piece of that state changed (with some sort of diff)? I'm not sure how to debug a recomposition, tips are welcomed! 🤔
    m
    s
    +2
    • 5
    • 5
  • m

    Michal Klimczak

    12/01/2021, 2:14 PM
    I have a feeling that the change that made accompanist Pager based on LazyRow / LazyColumn introduced a lot of issues. And it's a bit difficult to understand what is the team's current stand on this, the issues on github didn't receive any attention lately. Downgrading is painful, as the compatibility with compose (and therefore the kotlin version) usually needs to be pretty strict. I started wondering if I should maybe get the
    0.18.x
    version and try to make it compatible with new compose. Anyone knows what is the roadmap here?
    c
    s
    a
    • 4
    • 6
Powered by Linen
Title
m

Michal Klimczak

12/01/2021, 2:14 PM
I have a feeling that the change that made accompanist Pager based on LazyRow / LazyColumn introduced a lot of issues. And it's a bit difficult to understand what is the team's current stand on this, the issues on github didn't receive any attention lately. Downgrading is painful, as the compatibility with compose (and therefore the kotlin version) usually needs to be pretty strict. I started wondering if I should maybe get the
0.18.x
version and try to make it compatible with new compose. Anyone knows what is the roadmap here?
c

cb

12/01/2021, 2:19 PM
What issues are you referring to? Some of them are probably working as intended
m

Michal Klimczak

12/01/2021, 2:21 PM
this one is mine: https://github.com/google/accompanist/issues/876 but I skimmed over issues list and there's lots of recent pager-related ones
"older" pager had the same issue, which you fixed, but switching to LazyRow reintroduced it
s

Stylianos Gakis

12/01/2021, 2:26 PM
This one as well, we actually downgraded to 0.18.0 because of it.
a

Andrey Kulikov

12/01/2021, 2:45 PM
I am going to triage those bugs soon. lets discuss each issue individually in the corresponding bugs. but if you think the new implementation absolutely doesn’t work for you you can just copy the implementation from 0.18 into your project. for example I am not yet sure how to implement the page skipping described here https://github.com/google/accompanist/issues/876
👍🏽 1
:thank-you: 1
m

Michal Klimczak

12/01/2021, 2:47 PM
yeah, I thought it might be tricky for LazyRow... I can actually wait a week or two, if nothing interesting comes up, will copy, thanks for letting me know :)
View count: 2