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

    Emil Lahtinen

    06/08/2021, 1:21 PM
    I stumbled upon this weird LazyColumn+scrolling problem which leads to ANR, details in thread
    m
    h
    +2
    • 5
    • 7
  • r

    Richard Z

    06/08/2021, 1:38 PM
    Question about AndroidView + LayoutParams… Should AndroidView give it views a MATCH_PARENT LayoutParams by default? That’s technically how its view will be measured/layout anyways, right? I’ve seen it mentioned that the LayoutParams for the view generated by the factory shouldn’t matter since it’s measured by AndroidView’s measurement rules… But for WebView I think it’s a different story. A WRAP_CONTENT height actually affects the rendering of a WebView. In the docs for WebView, you’re also recommended to use a specific height or MATCH_PARENT height. I’ve seen this in practice, rendering of my WebView in Compose isn’t good unless I set a LayoutParams with MATCH_PARENT.
    a
    h
    • 3
    • 14
  • c

    cuongtd

    06/08/2021, 1:44 PM
    is it possible to create app widget in jetpack compose project now?
    🇳🇴 1
    a
    • 2
    • 5
  • v

    Vsevolod Ganin

    06/08/2021, 2:27 PM
    I’m trying new
    AnimatedContent
    in a dev branch and I have a question: what if I can’t map
    targetState
    to actual content statically? Seems like I need to store map of states to content to be able to map any
    targetState
    to some content at any time, but that’s not always possible. Let’s say I have a screen backstack (a list, basically). Then my
    targetState
    would be the last index in that list. And let’s say I’m popping the front screen from backstack. Then the index to that screen is no longer valid and I can’t display exit animation for it. How to approach this?
    d
    • 2
    • 9
  • a

    alorma

    06/08/2021, 2:41 PM
    Hi! I have a bottom sheet that have a button on the bottom, I want to show that button as sticky to the bottom, independent if the bottom sheet is full expanded or half expanded..., code in thread
    👀 1
    a
    • 2
    • 4
  • d

    dimsuz

    06/08/2021, 2:41 PM
    Is there a way to calculate BottomSheetScaffold's
    sheetPeekHeight
    based on a parent layout? For example if I have a column with a few composables and I want the BottomSheet in collapsed state to be just below the last one of them, how would I go about this? I thought about a custom
    Layout
    modifier to measure children height, but how do I then pass this into
    sheetPeekHeight
    ?
    n
    • 2
    • 2
  • a

    Akram Bensalem

    06/08/2021, 3:04 PM
    Is that true ?! According to this website Jetpack compose is for iOS also !!!! 🤔🤔
    received_969711387191760.webp
    b
    i
    +2
    • 5
    • 4
  • b

    Bradleycorn

    06/08/2021, 4:11 PM
    with
    BottomSheetScaffold
    , it appears that the
    PaddingValues
    that get passed to the main content composable always match the value of the
    peekHeight
    that is set on the scaffold. Using that, we can setup our screen so that we can scroll the main content area enough to see all of the content when the sheet is
    collapsed
    . But in my case, I’d like to also be able to scroll to see all of the main content even when the sheet is
    expanded
    . Is there some way I can accomplish that?
    a
    m
    • 3
    • 7
  • a

    aniruddha dhamal

    06/08/2021, 4:39 PM
    I'm trying out animation-codelab. In last chapter Gesture Animation. Swipe behavior doesn't work when Modifier is applied on Surface but works when it's applied on the Row itself. What could be the issue?
    t
    • 2
    • 6
  • e

    Eric Ampire [MOD]

    06/08/2021, 5:29 PM
    Hello, I'm trying to use
    TabRow
    in my app and I have noticed that when there's more than 5
    Tabs
    , the
    TabRow
    isn't scrollable, so how can I do in order to have a scrollable TabRow as in playstore I tried to use
    LazyRow
    inside the
    TabRow
    but it doesn't work as expected
    s
    • 2
    • 2
  • s

    Slackbot

    06/08/2021, 7:03 PM
    This message was deleted.
    i
    c
    • 3
    • 2
  • c

    Cicero

    06/08/2021, 8:19 PM
    While using lazyColumn and composables containing remember/rememberSaveable, how to go about this? I feel like I knew how to handle this kind of situation before in RecyclerViews and I’m failing to intuitively use this correctly. This should happen with any example of a composable with remember inside of lazyColumn. For example I was trying to have this edit text inside of my row items, consequentially I needed a remember and I noted that the wrong items where being deleted, just to realize that I was being fooled by cell reusability. Another way I solved this was with limited items where I would go with Item{ ItemWithRememberHere() } Item{ ItemWithRememberHere() } But some times you will need to present an X amount of items and this will not work. What am I missing?
    d
    • 2
    • 2
  • h

    Hatice Sarp

    06/08/2021, 8:22 PM
    Hi! I have datas with lazypagingItems in a composable. I am accessing this composable through a fragment. The screen should refresh when one of the paginated data shown in the UI is deleted. But I can't do pagination refresh. What do you think is the problem?
    • 1
    • 3
  • d

    Dominaezzz

    06/08/2021, 8:50 PM
    Anyone mind running this on Android Studio? (I'm using Compose Desktop and don't have Android setup)
    val text = buildAnnotatedString {
        appendInlineContent("image")
        append(" is a person.")
    }
    val person = InlineTextContent(
        placeholder = Placeholder(1.em, 1.em, PlaceholderVerticalAlign.Center),
        children = {
            Image(Icons.Filled.Person)
        }
    )
    Text(text, inlineContent = mapOf("image" to person))
    I think
    InlineTextContext
    alignment is broken and want to see if it's desktop only.
    a
    • 2
    • 2
  • b

    brandonmcansh

    06/09/2021, 12:24 AM
    If anyone is in need of a LazyGrid that supports staggered layout here is the implementation that I've been working on: https://twitter.com/brandonmcansh/status/1402327080352862208?s=21
    🙌🏻 2
    🙌🏼 1
    🙌 2
    🙌🏽 1
    z
    a
    c
    • 4
    • 6
  • n

    Nipun Rajput

    06/09/2021, 3:42 AM
    Is there any way to hide
    ModalBottomSheet
    when dragging down without collapse at half?
    s
    • 2
    • 2
  • j

    james

    06/09/2021, 4:01 AM
    I currently have a flat compose navigation hierarchy, and when navigating from the 'home' screen to another screen, any hot flows tied to the viewModelScope of the 'home' screen will continue to operate as expected. I want the viewModel to stay alive, but I want the flows paused while not inside that composable, so I load/dispose them inside the 'home' composable via a DisposableEffect with job cancellation. Is there a more sensible way to handle this?
    i
    c
    • 3
    • 4
  • h

    Hatice Sarp

    06/09/2021, 8:44 AM
    Hi! When we load pagination items in compose view, some items are not rendered correctly. It occurs some blank space in the view. When we scroll up and down, it renders correctly
    d
    t
    a
    • 4
    • 5
  • e

    Equilat

    06/09/2021, 8:44 AM
    Hi everybody ! I’m currently discovering themes in Jetpack Compose for Android. I would like to have the opinion of people who worked a bit on the topic. I feel themes are especially made to implement material design. Obviously, I now you can add custom colors to your theme to implement your own design system but what do I gain compared to just putting my ressources in data classes and calling them without using themes ?
    p
    z
    • 3
    • 7
  • d

    Dougie

    06/09/2021, 9:22 AM
    Hi~ when i add
    accompanist-coil
    into my project, then i get the error as below. when i remove
    accompanist-coil
    it be normal. https://github.com/google/accompanist/blob/main/coil/src/main/java/com/google/accompanist/coil/Coil.kt source code not impact material.Icon. any help?
    java.lang.NoSuchMethodError: No static method tint-DxMtmZc$default(Landroidx/compose/ui/graphics/ColorFilter$Companion;JLandroidx/compose/ui/graphics/BlendMode;ILjava/lang/Object;)Landroidx/compose/ui/graphics/ColorFilter; in class Landroidx/compose/ui/graphics/ColorFilter$Companion; or its super classes (declaration of 'androidx.compose.ui.graphics.ColorFilter$Companion' appears in /data/app/~~rC5M8DLnJ6EY6tCg5iwZHA==/-5G-RVV84VHN6mftce6JYCQ==/base.apk) at androidx.compose.material.IconKt.Icon-ww6aTOc(Icon.kt:119)
    c
    • 2
    • 1
  • p

    Piotr Prus

    06/09/2021, 9:25 AM
    Hi. After upgrading to compose beta08 I have a
    measure strategy
    loop in my logs and the view is never shown. Unfortunately, the log is not pointing to anything, so I do not know which part has an issue with measuring. Any idea? I will try to turn off component by component to find the one that cause this loop.
    a
    • 2
    • 4
  • e

    Eric Ampire [MOD]

    06/09/2021, 10:40 AM
    Hello, I'm trying to use the
    LazyVerticalGrid
    inside the
    HorizontalPager
    provided by accompanist like this
    HorizontalPager(state = pagerState) {
      LazyVerticalGrid(
         state = scrollState,
         contentPadding = PaddingValues(10.dp),
         cells = GridCells.Fixed(2),
         content = {
           items(TestData.Product.data) { product ->
             ProductView(product = product)
           }
         }
      )
    }
    After doing this, the list scrolls with difficulty
    s
    • 2
    • 3
  • s

    Shakil Karim

    06/09/2021, 10:49 AM
    Is there any way I Can fetch the older value which was computed by derivedStateOf? I want to return older value which was computed by derivedStateOf When there is a certain condition is true otherwise new value,
    a
    • 2
    • 4
  • m

    mmaillot

    06/09/2021, 11:46 AM
    I’m trying to make a simple animation when user clicks on a ImageButton. I want to animate the image size. It works with
    pointerInteropFilter
    but the
    onClick
    method is not called anymore 😞 I tried with
    pointerInput
    but the image is not resized, it’s only a circle (ripple effect?) which is resized... Do you have simple code sample to do an animation on user click ? (code in thread)
    a
    • 2
    • 4
  • m

    Michal Klimczak

    06/09/2021, 2:17 PM
    1. Is there any roadmap for dealing with performance issues? I have just tried to run my compose app on an older phone and it lags bad. Specifically scrolling through LazyColumn and Pager is very laggy. 2. Does it make sense to use RecyclerView / old ViewPager - insert them into a composition and fill them with composables? Is it gonna make it faster or slower? 3. Is there anything I can do to maybe trace the performance issues (more things like this) or any specific modifiers or composables which should rather be avoided? [Edit] my specific issue is more or less solved, some explanation in thread.
    ➕ 5
    a
    a
    +4
    • 7
    • 31
  • m

    miqbaldc

    06/09/2021, 2:41 PM
    Searching this channel with keyword: overlap, hdpi looks like I’m unable to find similar situtation Any advice for a workaround of smaller devices resolutions (actual: left image); (expected: right image) Do we really needs to use
    ConstraintLayout
    integration with Jetpack Compose? or should we use something like FlowLayout?
    z
    a
    • 3
    • 19
  • m

    ms

    06/09/2021, 3:12 PM
    Getting this error when building, I was unable to find the root cause Compose beta08 AS Bumblebee 2021.1.1 Canary 2
    i
    m
    • 3
    • 3
  • j

    juliocbcotta

    06/09/2021, 3:23 PM
    Hey, it seems I can’t have this construction..
    Text(
        text = text,
        modifier = Modifier.padding(top = 12.dp),
        textStyle = style,
    )
    I get the error
    None of the following functions can be called with the arguments supplied: 
    public fun Text(text: AnnotatedString, modifier: Modifier = ..., color: Color = ..., fontSize: TextUnit = ..., fontStyle: FontStyle? = ..., fontWeight: FontWeight? = ..., fontFamily: FontFamily? = ..., letterSpacing: TextUnit = ..., textDecoration: TextDecoration? = ..., textAlign: TextAlign? = ..., lineHeight: TextUnit = ..., overflow: TextOverflow = ..., softWrap: Boolean = ..., maxLines: Int = ..., inlineContent: Map<String, InlineTextContent> = ..., onTextLayout: (TextLayoutResult) -> Unit = ..., style: TextStyle = ...): Unit defined in androidx.compose.material
    public fun Text(text: String, modifier: Modifier = ..., color: Color = ..., fontSize: TextUnit = ..., fontStyle: FontStyle? = ..., fontWeight: FontWei
    Any way to fix it ?
    z
    c
    • 3
    • 6
  • d

    dimsuz

    06/09/2021, 3:56 PM
    I'm enjoying how good is Compose API. For example I needed 3-state BottomSheetScaffold. When I understood I can't do what I want with the default one, I've just copied it, added 3rd state. And wow, `Swipeable`'s
    progress
    just switches between 3 states exactly how I'd expect it to switch. Please, Compose devs, keep this up, looks like you have a great team there!
    💜 8
    • 1
    • 1
  • d

    Daniel Candeias

    06/09/2021, 4:22 PM
    How can i center my items inside a
    LazyVerticalGrid
    ?
    LazyVerticalGrid(
        cells = GridCells.Fixed(4)
    ) {
        itemsIndexed(data) { row, dataItem ->
              CustomComposedView(dataItem)
        }
    }
    Expected behavior for 6 elements: x x x x x x
    r
    a
    • 3
    • 3
Powered by Linen
Title
d

Daniel Candeias

06/09/2021, 4:22 PM
How can i center my items inside a
LazyVerticalGrid
?
LazyVerticalGrid(
    cells = GridCells.Fixed(4)
) {
    itemsIndexed(data) { row, dataItem ->
          CustomComposedView(dataItem)
    }
}
Expected behavior for 6 elements: x x x x x x
r

Ravi

06/09/2021, 8:14 PM
what will be the expected behavior for 7 elements?
a

Albert Chang

06/09/2021, 10:51 PM
You can't do this with
LazyVerticalGrid
. Consider using
LazyColumn
.
👍 1
r

Ravi

06/09/2021, 11:16 PM
@Daniel Candeias you can tweak this logic as per your use case
View count: 5