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

    mertceyhan

    05/15/2021, 8:17 PM
    Hi all! I’m new on the compose and I’m following the pathway. the
    remember
    is a great solution for recomposition but is there any lifecycle aware solution for that? Because, when I rotate the app, and activity recreated I can’t achieve to remembered value. I guess, I should put this data into my model and get with the livedata?
    s
    c
    • 3
    • 4
  • n

    Nthily

    05/15/2021, 8:28 PM
    Hi, im using
    accompanist Pager
    , how i change my interface when i click button?
    c
    • 2
    • 4
  • c

    Colton Idle

    05/16/2021, 5:53 AM
    In the compose state codelab it goes through a trivial example of having a tint color that is calculated via Random and this is done every recomposition. They show that if you wrap it in a remember {} function giving it a key, then it no longer generates a new random when an item is added to the list. BUT at the bottom it says "this makes it idempotent"
    An idempotent composable always produces the same result for the same inputs and has no side-effects on recomposition.
    But since this composable is in a LazyColumn, if you scroll up and down then Random is triggered again after the composable goes off the screen and comes back. Doesn't this go against the whole "same result for the same inputs"? Is the codelab "wrong" in stating that this is idempotent? https://developer.android.com/codelabs/jetpack-compose-state#4
    • 1
    • 1
  • c

    Colton Idle

    05/16/2021, 6:24 AM
    "Report a mistake" in the codelabs brings up this screenshot. Wouldn't it be better to just bring you to github to file an issue? For example, I found a typo that I reported through this pop-up a while back and it's still there. Wouldn't taking you to the repo be a better tracker for this sort of thing?
    c
    • 2
    • 2
  • p

    Prashast Rastogi

    05/16/2021, 7:48 AM
    I don't want to override TextStyles h1, h2, button from Typography and wish to create my own custom TextStyle and set them in custom Typography class. But I can't find a way to set custom TextStyle in Typography. Can anyone help out here?
    ➕ 1
    a
    • 2
    • 1
  • n

    Nat Strangerweather

    05/16/2021, 3:03 PM
    I'm trying to adapt a CodingWithMitch video tutorial to my own needs. Basically, I have a list of boxes and I want each one to animate with a delay of 1 second after the other. I don't understand why my code does not work. The
    delay.value
    does not appear to update. Any ideas? 🧵
    r
    • 2
    • 9
  • c

    curtjrees

    05/16/2021, 3:05 PM
    Is there any way to apply antialiasing (or just clean up the lines) when using
    GenericShape
    ? For example, I’ve drawn a simple Triangle, but if I zoom slightly you can see how messy the lines are
    a
    • 2
    • 3
  • t

    Tudor Luca

    05/16/2021, 3:20 PM
    I'm looking at
    navigation-compose
    , is there an example on how to have a main bottom-nav based navigation that also has some "full-screen" composables? Essentially the
    Jetsnack
    sample but ported to the Navigation library: a shared bottom-nav for some screen and some screens going over the bottom-nav.
    i
    • 2
    • 5
  • f

    Filip Wiesner

    05/16/2021, 4:31 PM
    This channel has exactly 4 000 users now 👀 I hope every last one of you is enjoying your stay 🎉
    🚀 9
    🎉 5
    :jetpack-compose: 10
    👍 3
    :kotlin-intensifies: 13
    n
    • 2
    • 1
  • i

    Ink

    05/16/2021, 4:38 PM
    LazyColumn {
        items(postList) {
            Post(
                onPostClick = { post -> PostDetailsScreen() },
                it
            )
        }
    }
    I display list with post. When I select post I want to open new @Composable view with post's details. Now I get error: @Composable invocations can only happen from the context of a @Composable function. Why?
    f
    i
    • 3
    • 3
  • a

    alexsullivan114

    05/16/2021, 7:49 PM
    Are there any easy ways to animate new items in a
    LazyColumn
    ?
    v
    • 2
    • 2
  • s

    Spikey Sanju

    05/16/2021, 9:07 PM
    Hello all, Is there anyway to add label below each steps in Slider?. Currently I’m using Range slider in Jetpack compose. I want to achieve this behaviour 👇
    n
    r
    • 3
    • 6
  • c

    Colton Idle

    05/17/2021, 12:36 AM
    😅 I'm about to commit my first compose code to my teams codebase. It's really really really simple, but although it's only a few lines long I'm hoping a few people could take a look to "code review" if I'm breaking any fundamental rules. It's just the skeleton of getting a username and password field showing in a fragment. While the state actually lives in the AAC ViewModel which exposes a single state via LiveData. If you know anything about that please take a look! There's still a lot of work to do to make this work, but I'm really just trying to see if I understand how state hoisting works in compose, and how to properly pass observable data down and events up through the AAC VM. Code in thread
    c
    • 2
    • 4
  • j

    Justin Yue

    05/17/2021, 3:49 AM
    At the moment, the current docs recommend state hoisting for state management, but I fear that state hoisting can be difficult if a specific state must be hoisted up multiple levels. Having learned Flutter before Jetpack Compose, I liked the Provider approach, and Jetpack Compose seems to have something similar in the form of
    CompositionLocal
    and
    CompositionLocalProvider
    . My question is, why are these 2 not recommended for state management?
    z
    a
    • 3
    • 5
  • c

    Chachako

    05/17/2021, 6:24 AM
    This is an exciting thing, I look forward to the moment it is completed 🤩 https://android-review.googlesource.com/c/platform/frameworks/support/+/1704159
    👀 6
    d
    s
    m
    • 4
    • 11
  • a

    Alex

    05/17/2021, 6:58 AM
    Hey, I am looking for the
    NestedScrollConnectionSample
    but can't seem to find it anywhere. My usecase is building a collapsing toolbar layout. Would love it someone could point me in the right direction here, cheers!
    f
    • 2
    • 7
  • a

    Alex

    05/17/2021, 9:15 AM
    I am using a
    nestedScroll(...)
    to create a collapsing toolbar (code in thread). However implementing it this way is disabling any flinging on the list. I am not sure why, because I am not consuming the Flings in my nested scroll, or do I? Will I have to reimplement flinging animations when using nested scrolling?
    a
    a
    l
    • 4
    • 8
  • k

    Klaas Kabini

    05/17/2021, 9:49 AM
    @jim In my understanding Jetpack Compose is designed to allow extension to other platforms such as Desktop(Compose Desktop by JetBrains) and iOS. Therefore, are there any plans to change the package name in future to be platform agnostic for example something like com.google.compose instead of androidx.compose. The androidx.compose package gives an impression that Compose is Android specific.
    a
    f
    +5
    • 8
    • 22
  • m

    Marko Novakovic

    05/17/2021, 10:41 AM
    how can I make circle come from the centar of the cloud? like it’s coming from behind but not moving diagonally? code in 🧵
    a
    • 2
    • 4
  • m

    Muhammad Zaryab Rafique

    05/17/2021, 10:46 AM
    how can I make this type of animation in compose : https://codepen.io/MarioDesigns/pen/woJgeo
    f
    j
    • 3
    • 9
  • n

    Nthily

    05/17/2021, 12:22 PM
    How do I collapse the keyboard after typing a TextField?
    • 1
    • 2
  • c

    cuongtd

    05/17/2021, 1:04 PM
    have anyone done navigation transition in compose?
    p
    i
    • 3
    • 4
  • g

    Gaurav Gangwar

    05/17/2021, 1:29 PM
    Curious question, do my Compose Functions finally use View.java to be rendered on the Screen, if not then how does the final rendering happen ? If there is any good resource available on this, please point me to that.
    n
    f
    +2
    • 5
    • 17
  • b

    Billy Newman

    05/17/2021, 2:09 PM
    Hello all. I have a checkbox in a parent view, the parent view is padded on start by 16dp. The checkbox aligns with that padding. However the ripple on click of the checkbox is clipped on the left side. Struggling to figure out how to unbound the checkbox ripple. Any ideas?
    a
    • 2
    • 11
  • i

    Ink

    05/17/2021, 2:26 PM
    How to pass object between @Composable screens?
    @Parcelize
    data class Post(
        val author: String,
        val title: String,
        val description: String,
        val reactionNumber: Int
    ) : Parcelable
    In my `navigationController`;
    composable(
        "PostDetails/{post}",
        arguments = listOf(
            navArgument("post") { type = NavType.ParcelableType(Post::class.java)}
        )
    ) {
        PostDetailsScreen(it.arguments?.get("post") as Post)
    }
    Now I get error: Parcelables don't support default values. Should I pass object using GSON ot this way is corretly? I heard that NavType.ParcelableType didn't work but right now it's implemented and developers can use it (?)
    i
    j
    +2
    • 5
    • 10
  • k

    Kyle Lehman

    05/17/2021, 3:40 PM
    Has anyone encountered issues rendering
    @Preview
    composables in AS (currently Canary 15) with an error similar to this?
    java.lang.NoClassDefFoundError: androidx/lifecycle/runtime/R$id
    	at androidx.lifecycle.ViewTreeLifecycleOwner.set(ViewTreeLifecycleOwner.java:49)
    	at androidx.compose.ui.tooling.preview.ComposeViewAdapter.init(ComposeViewAdapter.kt:612)
    	at androidx.compose.ui.tooling.preview.ComposeViewAdapter.<init>(ComposeViewAdapter.kt:206)
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    This is only happening for some members on our team but once it does its persistent and the only way to get it to compile is add the following dependencies which doesnt seem necessary:
    androidx.savedstate:savedstate-ktx
    androidx.lifecycle:lifecycle-viewmodel-compose
    androidx.lifecycle:lifecycle-runtime-ktx
    androidx-core-ktx
    👀 2
    :thread-please: 2
    👍 1
    c
    e
    +5
    • 8
    • 23
  • s

    Sergey B

    05/17/2021, 4:06 PM
    Hi everyone. I have a quick question about clipping the content by composables. If I'm not mistaken, composables don't clip content by default, but in code bellow it seems it clips content of the inner box. Am I doing something wrong? (code in thread)
    z
    • 2
    • 4
  • s

    Scott Kruse

    05/17/2021, 4:21 PM
    Is there any particular reason there isn't a dedicated keynote for Compose at GoogleIO this year? just not quite ready? i noticed a few workshops but was hoping this IO would be compose heavy
    a
    l
    d
    • 4
    • 5
  • b

    Bradleycorn

    05/17/2021, 8:27 PM
    Given this:
    Row(modifier = Modifier
            .fillMaxWidth()
            .wrapContentHeight()) {
            
            Surface() {
                Text(...)           
            }
            
            Column {
                Text(...)
                Text(...)
                Text(...)
            }
        }
    How do I get the
    Surface
    to be the same height as the
    Column
    ?
    l
    c
    +2
    • 5
    • 8
  • n

    Nthily

    05/17/2021, 9:02 PM
    Does anyone know how I should customize the
    SelectionContainer
    interface?
    s
    • 2
    • 16
Powered by Linen
Title
n

Nthily

05/17/2021, 9:02 PM
Does anyone know how I should customize the
SelectionContainer
interface?
s

Siyamed

05/17/2021, 9:03 PM
Can you elaborate on customize?
n

Nthily

05/17/2021, 9:04 PM
There is a simple example like this:
BTW,I also found a problem, if a Text on the interface has a text value of "", there is an error when you long press
s

Siyamed

05/17/2021, 9:06 PM
If it is about updating the selected text menu, afaik it is not doable right now
n

Nthily

05/17/2021, 9:06 PM
ok! thanks
s

Siyamed

05/17/2021, 9:08 PM
For the error you mentioned (empty text) is it possible for you to create a bug? I know a recently fixed issue where it would crash.
(it was in a public ticket)
n

Nthily

05/17/2021, 9:13 PM
like this
2021-05-17 23-12-47.mp4
@Siyamed
Surface(
    color = Color.White,
    elevation = 5.dp,
    modifier = Modifier
        .fillMaxSize()
        .height(100.dp)
) {
    SelectionContainer{
        Text(
            text = "",
        )
    }
}
When I long touch a "" Text, this error occurs
s

Siyamed

05/17/2021, 9:19 PM
Thanks. Empty text long click was very recently (within a week or so) fixed.
👍 1
n

Nthily

05/17/2021, 9:21 PM
will it be updated with the beta-07 version when it comes out?
s

Siyamed

05/17/2021, 9:22 PM
https://issuetracker.google.com/issues/187437299
Apparently it is not merged yet
View count: 1