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

    Devesh Sanghvi

    07/07/2021, 11:23 PM
    I am trying to create a custom arc progress bar (Semi circle). I am able to create one but I am not able to figure out how can I crop/ clip the Red box (whitespace) as shown in the screenshot. If I reduce the box height then the semi circle gets spoiled (shown in other screenshot). My code is in the thread.
    c
    n
    • 3
    • 7
  • c

    Colton Idle

    07/08/2021, 5:13 AM
    Am I using Crossfade incorrectly? Not sure why adding crossfade causes my progress bar to glitch like this. Code in thread.
    a
    z
    • 3
    • 18
  • h

    harry248

    07/08/2021, 7:45 AM
    Conditionally showing or hiding the bottomBar of a Scaffold, the available height for the Scaffold content seems to be stuck at the one that was first determined. Is there a way to force measuring again or a better solution to show/hide the bottomBar?
    c
    z
    • 3
    • 12
  • k

    ken_kentan

    07/08/2021, 8:42 AM
    Hello, I want to block all tap(click) inside a composable. How can I implement it?
    t
    • 2
    • 5
  • d

    Daniele Segato

    07/08/2021, 9:37 AM
    Why the
    Modifier.onSizeChange()
    doesn't work in Preview?
    var cardSize by remember { mutableStateOf<IntSize?>(null) }
        Box(
            modifier = Modifier
                .background(Color.White)
                .aspectRatio(1f)
                .fillMaxSize()
                .onSizeChanged { cardSize = it }
        ) {
            Text(text = "Size is = $cardSize")
        }
    the preview always show "Size is null" while if I run it I get the size as I expect? Is there a way to fix the preview?
    m
    a
    z
    • 4
    • 10
  • d

    Daniele Segato

    07/08/2021, 10:29 AM
    Is there a way to provide some
    @Preview
    placeholder feature? For instance if I'm creating a custom
    Painter
    and I want to provide a preview for that? Example: I've a QRCode to be generated and I want to provide a preview that look like a QRCode without actually running the code to generate it
    z
    • 2
    • 4
  • p

    Prashast Rastogi

    07/08/2021, 10:35 AM
    I'm trying to round corners of CircularProgressIndicator using jetpack compose. But I don't see any member variables to do so. Following is the source code, but it doesn't take Stroke as a parameter. If it can then we'll be able to create our custom Stroke with a round cap.
    @Composable
        fun CircularProgressIndicator(
            /@FloatRange(from = 0.0, to = 1.0)/
            progress: Float,
            modifier: Modifier = Modifier,
            color: Color = MaterialTheme.colors.primary,
            strokeWidth: Dp = ProgressIndicatorDefaults.StrokeWidth
        ) {
            val stroke = with(LocalDensity.current) {
                Stroke(width = strokeWidth.toPx(), cap = StrokeCap.Butt)
            }
            Canvas(
                modifier
                    .progressSemantics(progress)
                    .size(CircularIndicatorDiameter)
                    .focusable()
            ) {
                // Start at 12 O'clock
                val startAngle = 270f
                val sweep = progress * 360f
                drawDeterminateCircularIndicator(startAngle, sweep, color, stroke)
            }
        }
    f
    c
    • 3
    • 2
  • c

    Chris Miller

    07/08/2021, 10:37 AM
    Is there Compose support for androidx.preference?
    🇳🇴 2
    👍 1
    w
    a
    • 3
    • 3
  • a

    Artur Schwarz

    07/08/2021, 12:02 PM
    I’ve got a Column, inside this Column are 2 other Columns. The first inner Column is Scrollable and the content height is higher than the screen height. How can i achieve that both inner Columns are still visible? Current situtation: first inner scrollable Column is visible, other Column is drawn outside the visible Area.
    t
    a
    z
    • 4
    • 12
  • m

    Marek Hlava

    07/08/2021, 12:15 PM
    Anybody uses accessibility ids on buttons? I updated to compose material 1.0.0-rc01 and the following doesn't seem to work anymore:
    Button(
        modifier = Modifier.semantics {
            contentDescription = "my-button"
        },
        onClick = {},
    ) {
        Text("Click me")
    }
    What works is moving the modifier to the Text instead but I can't find this behavior change mentioned in release notes. Update: cannot put contentDescription on TextFields either.
    z
    • 2
    • 3
  • g

    Gaurav Tyagi

    07/08/2021, 12:54 PM
    android:digits="0,1,2,3,4,5,6,7,8,9,*,qwertzuiopasdfghjklyxcvbnm"
    how can implement "android:digits" functionality with BasicTextField in compose
    c
    • 2
    • 1
  • d

    Daniele Segato

    07/08/2021, 1:10 PM
    Is there a way to customize the TextField selection color / handles in Jetpack Compose (other than globally)?
    a
    • 2
    • 2
  • i

    iamthevoid

    07/08/2021, 1:36 PM
    What about
    remember
    function? What happens with remembered value when composable leave the composition? For exapmle
    if (loading) {
        Loading()
    } else {
        View(someLogic::calculateParam) // here inside remember 'someLogic::calculateParam' result has called 
    }
    For example on next composition composition
    loading
    is true, on next one false. In log i see that calculateResult changes, but what happens with previous? Is anywhere strong reference to it?
    p
    z
    i
    • 4
    • 20
  • i

    iamthevoid

    07/08/2021, 3:55 PM
    I got exception [thread] when move function from app module to multiplatform module. When it was in app all compiles and build, but after moving i can not compile project
    • 1
    • 5
  • m

    Marcin Mazurek

    07/08/2021, 4:08 PM
    Hi how to change Checkbox rounded corner for Box, after check the code i think it is impossible. Radius should be changeable from the outside
    @Composable
    private fun CheckboxImpl(
        enabled: Boolean,
        value: ToggleableState,
        modifier: Modifier,
        colors: CheckboxColors
    ) {
    ....
            drawBox(
                boxColor = boxColor,
                borderColor = borderColor,
                radius = RadiusSize.toPx(),
                strokeWidth = strokeWidthPx
            )
    ➕ 1
    k
    c
    l
    • 4
    • 10
  • c

    Chris Johnson

    07/08/2021, 4:24 PM
    Is there an equivalent to
    view.getLocalVisibleRect(rect)
    in compose? Also, is there another way to get the rect of a compose view without using
    onGloballyPositioned
    from the modifier?
    t
    • 2
    • 17
  • g

    Gaurav Tyagi

    07/08/2021, 4:45 PM
    is there an equivalent to android:digits in compose?
    t
    • 2
    • 4
  • y

    Yuri Drigin

    07/08/2021, 5:26 PM
    Hi guru. I figured out a few nice way work with focus: set order, go next and so on. But no one to free focus by tap outside TextFiled. Is there a truly compose way to free focus and hide keyboard? Thanks
    c
    • 2
    • 3
  • j

    Jan

    07/08/2021, 5:30 PM
    If my TextField is too small, the text in it won't show up. How can I fix this?
    z
    • 2
    • 10
  • b

    brandonmcansh

    07/08/2021, 5:52 PM
    Has anyone been able to use Composables within a TextField? Looking to replace our Chips InputView edittext with compose
    👍 1
    c
    z
    +2
    • 5
    • 33
  • p

    Peter Mandeljc

    07/08/2021, 7:54 PM
    How does one make
    ModalBottomSheetLayout
    fully expand? Calling
    state.show()
    only half expands it.
    t
    • 2
    • 2
  • t

    therealbluepandabear

    07/08/2021, 9:42 PM
    Hey, I'm having some trouble in compose - I would like someone to DM me so we can talk further.
    ☝️🏽 1
    z
    h
    +2
    • 5
    • 21
  • t

    tad

    07/08/2021, 11:25 PM
    Is
    SnapshotStateList
    thread-safe? e.g. can two threads append and prepend to the list simultaneously?
    d
    • 2
    • 2
  • a

    Andy Yang

    07/09/2021, 4:59 AM
    Is
    LazyColumn
    ->
    ContentPadding
    last item padding not working? e.g.
    LazyColumn(
                modifier = Modifier.fillMaxSize(),
                contentPadding = PaddingValues(vertical = 30.dp),
            ) {
       // ... items
       // but last item doesn't with bottom padding
    }
    z
    • 2
    • 1
  • s

    Shakil Karim

    07/09/2021, 5:31 AM
    Hi, i using a model class like this SomeClass( var badge: MutableState<Badge?> ...... ) But when i trying to update the badge property it Recompose even if the Badge Object is same.
    t
    z
    • 3
    • 5
  • n

    Nikola Milovic

    07/09/2021, 7:07 AM
    Any update on the @Preview for Kotlinmultiplatform shared module?
    c
    • 2
    • 2
  • m

    Marcin Mazurek

    07/09/2021, 8:06 AM
    Hello i want to update page(open by navigation) on every click on BottomBar, but i don't want to reload whole page, only data in it. what is best way to do it. For now i find a way to create some mutablestate, update it and check it on Navigation destination
    i
    • 2
    • 3
  • a

    alorma

    07/09/2021, 8:16 AM
    Hi. On the layout codelab it shows this to create a new custom layout:
    Layout(
            modifier = modifier,
            content = content
        ) { measurables, constraints ->
    
            // Don't constrain child views further, measure them with given constraints
            // List of measured children
            val placeables = measurables.map { measurable ->
                // Measure each child
                measurable.measure(constraints)
            }
        }
    But, with RC01, whenever I try to import and create one,
    Layout
    has a new parameter called
    measurePolicy: MeasurePolicy
    ... what should we do with this one?
    a
    m
    • 3
    • 5
  • d

    Daniel Burnhan

    07/09/2021, 8:44 AM
    I’m sure this gets asked a ton, but what is everyone using for navigation routing? I have taken a look at both compose router and the navigation component. My biggest problem with navigation component is that it seems harder to break up the subsections of the application. For instance the forgot password and one time verification code for the screen have the be added to the nav host. Is it really best convention to have entire structure of app in one place like this?
    i
    • 2
    • 1
  • m

    Magnus Gudmandsen

    07/09/2021, 10:04 AM
    Hey! I’ve tried searching for an answer in here and elsewhere but I can’t find any questions about it: When fetching a string from stringResources in compose, it gives me the string for the wrong language. It seems to use the device language always, rather than Locale.getDefault(). See more details in 🧵
    a
    • 2
    • 3
Powered by Linen
Title
m

Magnus Gudmandsen

07/09/2021, 10:04 AM
Hey! I’ve tried searching for an answer in here and elsewhere but I can’t find any questions about it: When fetching a string from stringResources in compose, it gives me the string for the wrong language. It seems to use the device language always, rather than Locale.getDefault(). See more details in 🧵
So our app has a language chooser. To make this work, we override
attachBaseContext
in activity, and wrap the context. This works as expected everywhere else: Locale.getDefault() returns the overriden language. Calling getString in
Fragment.onStart
(or outside onStart) returns the overriden language string However: Calling getString inside of a
Composable
block gives me the string from the device language. Doesn’t matter how I call it:
fragment.getString
,
activity.getString
, or using the Compose
stringResources
function.
a

Albert Chang

07/09/2021, 10:19 AM
See this thread. I think the method there still works.
m

Magnus Gudmandsen

07/09/2021, 12:06 PM
Hey Albert, thanks for the response! So it turns out just doing the
attachBaseContext
part actually works, and my issue was 100% unrelated to Compose. It was all due to missing an important step in generating translations in our translation library that we’re using 😅 Thanks for the help anyway 🙂
View count: 2