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

    Jason Ankers

    06/18/2021, 4:16 AM
    Is it possible to animate decay to a target value? Trying to implement lazy(column/row) snapping
    d
    • 2
    • 4
  • a

    Abhishek Dewan

    06/18/2021, 5:02 AM
    I'm running into a weird bug with the TextField composable. I've noticed that if you press back instead of the action button when they keyboard is open it doesn't loose focus and you need to press the back button an additional time to remove focus. I've tried to demonstrate that with the video I've attached. In the video I'm trying out two different scenarios. One where I open the keyboard and press back instead of the done button. Second where I press the done button. As you can see it takes 3 back presses in the original scenario vs one to back out of the app. Is there a known bug where the focus won't be cleared if you press back when the keyboard is open ?
    a1a4fade-a587-4c38-804d-9e6ebd941eef.MP4
    z
    • 2
    • 4
  • r

    Ravi

    06/18/2021, 9:22 AM
    I’m trying out server-driven UI where JSON sends modifiers array to apply on view in particular order. How to combine multiple modifiers while iterating list? 🧵
    a
    a
    e
    • 4
    • 14
  • f

    fuhao

    06/18/2021, 10:01 AM
    I want to make a new user guidance for my application, so I need to find some element's position and size. In view, I can find them by id. In compose, I don't know how to get these information. I want to do something like this:https://github.com/KeepSafe/TapTargetView
    a
    • 2
    • 1
  • a

    alorma

    06/18/2021, 11:52 AM
    Hellos community! I've created this demo code to showcase how
    AlertDialog
    can be shown up in the same way as
    Snackbars
    , using state host and etc... https://github.com/alorma/ComposeDialogs Any feedback? Do you belive it could be a good library?
    n
    • 2
    • 4
  • j

    jannis

    06/18/2021, 12:42 PM
    I tried to migrate from compose beta 06 to 09. However I always get the following error:
    This version (1.0.0-beta09) of the Compose Compiler requires Kotlin version 1.5.10 but you appear to be using Kotlin version 1.4.31 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
    I saw some people had the same problem with previous compose versions. But it seems they had no success in solving this problem. Anyone has an idea? I tried to include the
    kotlinCompilerVersion
    . No success with or without it. I’m using Kotlin Gradle Scripts.
    l
    t
    +2
    • 5
    • 8
  • c

    cb

    06/18/2021, 2:54 PM
    Compose hasn't reached binary compatability yet so you'll need to update. 0.6.2 is nearly 3 months old.
    n
    • 2
    • 8
  • d

    dimsuz

    06/18/2021, 3:03 PM
    I can see that I can create a custom
    Outline
    , can I create any shape, even non-convex one and it will cast a shadow? Can I do something like this? (this is a space between two `Surface`s) Or do the pre-compose limitations to outlines still hold?
    a
    • 2
    • 2
  • c

    Ciprian Grigor

    06/18/2021, 3:19 PM
    I’m trying to upgrade to beta09 & kotlin 1.5.10 and android gradle 7.1.0-alpha02 but I get this error have anyone encounter this:
    Unable to find method ''java.lang.String com.android.utils.FileUtils.relativePossiblyNonExistingPath(java.io.File, java.io.File)'' 
    ...
    Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
    • 1
    • 1
  • t

    Tolriq

    06/18/2021, 4:04 PM
    Just tested to create a sample default app from AS to see the defaults and I see that
    vectorDrawables { useSupportLibrary = true }
    is set. Is this necessary? Since compose does not use the appcompat layout inflater I would have supposed this have no effect.
    n
    c
    • 3
    • 8
  • n

    natario1

    06/18/2021, 5:15 PM
    Hi 👋 I have a screen with a
    BasicTextField
    and I want to use a
    BackHandler
    to go out of it. However, if the text field has focus, the first "back" press is caught by the field to unfocus itself. Only the second one will invoke the back handler. Is there any way around this?
    a
    i
    +5
    • 8
    • 18
  • s

    Slackbot

    06/18/2021, 8:28 PM
    This message was deleted.
    s
    • 2
    • 1
  • c

    Colton Idle

    06/18/2021, 9:16 PM
    Question about lambda arguments for events. If I have `
    @Composable
    fun MyComposable(changed: () -> Unit)`
    and I want to invoke the lambda passed in during a click would I do? 1. Modifier.clickable { changed() } 2. Modifier.clickable { changed } 3. Modifier.clickable { changed.invoke() } Number 1 and 3 seem to work, but I feel like I can never remember what to use and when to use it. Any tips?
    h
    a
    d
    • 4
    • 9
  • t

    tad

    06/19/2021, 12:32 AM
    Has anyone requested Enter/ExitTransitions to scale content?
    d
    • 2
    • 7
  • a

    Aditya Thakar

    06/19/2021, 6:57 AM
    Hello, I need to scroll to bottom of the LazyColumn when a new item is added. Please check the code in thread, I feel my code is bit hacky and I’m keen to know if there is a better approach.
    ➕ 2
    z
    r
    • 3
    • 4
  • p

    Paul Woitaschek

    06/19/2021, 8:00 AM
    We are trying to get compose work with conductor and am starting to implement some hackish code to get that done. Could someone from the compose team (or someone else with the knowledge) take a look at the PR and tell me if the route we are taking is correct? (on integrating compose with something that is not fragments) https://github.com/bluelinelabs/Conductor/pull/646/commits/0a5ef950ac0d3d996b73f663b2e8baf6d5643165#diff-9d709bb6c46785d6cb46d61cabccc6d33c2134c6b78d306ba3b8bb56d702bdc4R60
    • 1
    • 1
  • s

    Slackbot

    06/19/2021, 3:09 PM
    This message was deleted.
    :thread-please: 8
    c
    • 2
    • 1
  • s

    Slackbot

    06/19/2021, 3:09 PM
    This message was deleted.
    :thread-please: 5
    z
    • 2
    • 1
  • s

    Slackbot

    06/19/2021, 8:34 PM
    This message was deleted.
    d
    n
    a
    • 4
    • 12
  • a

    Abdalla Hassanin

    06/20/2021, 3:12 AM
    After update compose: beta09,hilt: 2.37, gradle:7.0.0-beta04 ,this issue appears
    i
    j
    • 3
    • 3
  • a

    Adib Faramarzi

    06/20/2021, 4:03 AM
    Are there any plans for compose (maybe in the stable versino) to not require an exact version of Kotlin library?
    a
    e
    v
    • 4
    • 4
  • k

    Kunal Raghav

    06/20/2021, 9:46 AM
    Is there a way I can get the latest fixes in compose ahead of the next beta release? It is blocking me from developing the app I'm currently writing.
    h
    a
    • 3
    • 3
  • g

    gitai

    06/20/2021, 11:01 AM
    Given a user can press the home button at any given moment (in which case the app can get terminated / completely recomposed upon return) what is the use-case where you would choose to call 
    remember()
    over
    rememberSaveable()
    ?  and … is it really required to explicitly call
    remember()
    in such use-case? For example, here (see code in reply) the compiler will presumably add code to the
    Button
    composable content lambda to implicitly "remember" the captured
    MutableState<Boolean>
    instance referenced by
    hidden
    and restore it when the
    Button
    is clicked - that is when executing the content lambda again during recomposition. Since this lambda in the only composable to run upon such event I don't see why you would explicitly remember
    hidden
    at it’s declaration point, which kind of leads to a more basic question: Should we use
    remember()
    /
    rememberSaveable()
    "defensibly" to guard against recompositions at higher levels which may happen "out of the blue" ?
    a
    t
    • 3
    • 31
  • s

    Shakil Karim

    06/20/2021, 12:28 PM
    Hi, what is the difference between these two function definition, in terms of when the backing MutableState changes? fun Demo (coin: State<Int>) vs fun Demo(coin: Int)
    a
    n
    • 3
    • 3
  • m

    Mjahangiry75

    06/20/2021, 1:23 PM
    I got error when I call the
    registerForActivityResult(ActivityResultContracts.StartActivityForResult())
    error in thread
    s
    i
    l
    • 4
    • 7
  • s

    Se7eN

    06/20/2021, 1:29 PM
    Is it fine to nest Scaffolds? For example, to show a common bottom nav but different top bars for each screen? 🧵
    j
    t
    • 3
    • 8
  • d

    Daniel

    06/21/2021, 3:14 AM
    How can I exactly match the activity/fragment lifecycle callbacks? I'm normally having a great time with DisposableEffect and friends, but for integrating with mapbox sdk I need to call their code on onStart, onStop, onLowMemory, and onDestroy. I've already made a
    LocalActivity
    to use with some legacy stuff, so I'm thinking of making it a
    LocalMySpecificActivity
    and adding methods like
    registerOnDestroy
    to it. Is there a better solution?
    i
    • 2
    • 2
  • a

    Attila Blenesi

    06/21/2021, 6:57 AM
    How to load
    TextUnit
    from Android XML resources?
    dimensionResource(...)
    works great for
    dp
    is there an equivalent for
    sp
    ? 🤔
    ✅ 1
    a
    • 2
    • 2
  • p

    pavi2410

    06/21/2021, 7:44 AM
    BottomNavigation
    doesn't cast a shadow upwards, although I've set
    elevation = 16.dp
    to it.
    a
    j
    • 3
    • 8
  • a

    Alex

    06/21/2021, 8:48 AM
    What's the best way to contribute to the Material Components for Jetpack Compose?
    a
    l
    l
    • 4
    • 10
Powered by Linen
Title
a

Alex

06/21/2021, 8:48 AM
What's the best way to contribute to the Material Components for Jetpack Compose?
a

Adam Powell

06/21/2021, 1:59 PM
Starting the discussion here is probably a good start. 🙂 What are you looking to contribute?
a

Alex

06/24/2021, 5:55 PM
Right now the OutlinedTextField does not allow changing the border-width in any way (its hardcoded in private vals). In the old xml material components changing the border width this was possible through styling (and our design system uses a different border width). I would like to just create a PR and fix that so that the material team doesn't need to bother. And also I fear that if I don't do it, the fix will probably take a couple of months before it hits any release due to it being a rather obscure thing 😄
a

Adam Powell

06/24/2021, 6:55 PM
Some of the team working on the material library would be better equipped to comment on the design intent of the OutlinedTextField in particular here, but I think the answer is likely to be, "build your own starting from BasicTextField" - we largely consider the broad proliferation of design tweak parameters for Views to have been a mistake, as opposed to layering the system such that these components are easy to fork, tweak, and move on. cc @matvei @Louis Pullen-Freilich [G]
to the extent that such forks pull along a lot of other internal dependencies that also must be forked to accomplish it though, we're definitely open to more discussion on how to make that process easier
or what would need to be opened/structured differently to make it easy
l

Louis Pullen-Freilich [G]

06/24/2021, 7:03 PM
Exactly the above - we expose parameters for customization based on the Material design specification, it is an explicit non-goal to support the customization of every internal design element of a component. As for any other component, the intended pattern is instead to just fork the component, and make the necessary changes. with that said, text fields are a unique example of a component that are so complicated in nature that forking is uniquely challenging, compared to creating your own Button for example. For text fields specifically, we have future plans to expose a middle layer of building blocks that make it easier to build your own Material-esque text field, without adding more and more parameters to the high level APIs.
a

Alex

06/25/2021, 8:47 AM
What I am kind of missing though is, that this customization was possible via a style when using the xml based implementation of the OutlinedTextField and now it's gone in the compose version. Adding the ability to change the border width would be as simple as adding another constructor parameter with a default value, in the same way as TextFieldColors are provided already. I completely understand your point about not wanting to bloat textfields, but completely reimplementing a TextField just to change the border size seems pretty strange to me? Changing the outline shape was added recently, adding the border width parameter would be the last 5% to have feature parity with the xml based variant. Heck, it seems like CompositionLocal was meant to be the solution to this.
l

Louis Pullen-Freilich [G]

06/25/2021, 1:56 PM
that this customization was possible via a style when using the xml based implementation of the OutlinedTextField and now it’s gone in the compose version.
Parity between XML / Compose is a non-goal: we aim to implement the Material specification, and customization provided by the spec. Adding customization for things not in the spec makes it hard to reconcile our APIs with spec updates, and it makes it hard for us to define what our components actually support.
I completely understand your point about not wanting to bloat textfields, but completely reimplementing a TextField just to change the border size seems pretty strange to me?
It’s not really about how large the change is - if there is a change from the component we have provided, it is natural to need to build your own. This very quickly devolves into a slippery slope of customization too - if you can change the border width in the public API, then maybe that will work for a while, but what if you then want to also change the border to be dashed, and add a separate internal divider between an icon and the text. At some point you will need to build your own, and if we don’t have the clear line of ‘we support the specification’, then it becomes very hard for developers to reason about what they can expect to do, and also very hard for us to manage feature requests and decide what is reasonable to add. The text field APIs are already some of if not the most complicated Material APIs due to their size, so ensuring they are easy to use and understand for the default cases is also important. On a side note we have received many requests to customize the internal padding, but I believe this is the first request for border width, so this would appear to be lower priority for most developers. Also as I mentioned previously, we would like for ‘reimplementing a text field’ to be a few lines of intermediary API (similar to other components like if you wanted to build your own Button or Tab), not the large amount of copy and pasting you would need currently. In that case, there really isn’t much cost to building your own version with a different border, most of the challenge here is because of how complicated text fields are, with all their different states and moving internal components.
Changing the outline shape was added recently
This is something explicitly mentioned in the spec - outlined text fields should use a shape from the theme by default, so naturally this should be customized locally too. Border width is fixed and not something that should be customized - it is intrinsic to the component itself.
a

Alex

07/05/2021, 5:30 PM
Thanks for the explanation behind your reasoning! I get your point, although of course this does suck for our company 😬 The easiest solution here for us was to convince the designers to work with a border width of 1dp, which worked in the end. It really seems like you guys are between a rock and a hard place here. Text Fields are hard (with all the requirements like screen readers and accessibility). To make my point a little here though: I think adding values that exist internally already to the constructor would make sense, the change is very different from adding different or supporting new features. When using the API it does feel a bit like the API is hiding this value that should be very easy to pass via constructor on purpose and it's hard to see the reason why without your detailed explanation above. In any case, thank you for working on Jetpack Compose, everyone that I get to try it just loves it. It feels like going from Java to Kotlin but for UI.
l

louiscad

07/05/2021, 5:33 PM
Considering most folks there came from xml to Compose, it's even bigger of a jump!
View count: 1