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-desktop
  • s

    Sam Michael

    08/06/2021, 5:16 AM
    Trying to get rid of the spaces where these buttons meet, I made the borderstroke match the background, and made the button rectangleShape, but there is still a little bleedline or some shadow areas in between buttons where they don't perfectly meet, is it possible to remove that?
    ✅ 1
    c
    • 2
    • 6
  • s

    Sam Michael

    08/06/2021, 7:39 AM
    Sorry to spam the channel but having trouble getting my stones on top of the corner now that I am no longer using Material Button. Even if I put the grid in a drawBehind { } scope the stones keep being drawn underneath the grid lines (or all the grid lines are invisible and only the stones can be seen). I tried playing with elevation and zIndex, but the lines and circles are still technically in modifier/canvas of the same Box scope, so i can't seem to get it behind as I would like.
    @Composable
    private fun tileButton(
        isVisible: MutableState<Boolean> = mutableStateOf(false),
        turn: MutableState<Int> = mutableStateOf(0)
    ) = Box(
        modifier = Modifier.background(accentAmber).size(60.dp).padding(0.dp).border(0.dp, accentAmber)
            .clickable(onClick = {
                isVisible.value = true
                turn.value += 1
            }).drawBehind {
                drawVerticalLine()
                drawHorizontalLine()
            }.drawWithContent {
                drawCorrectColorCircle(isVisible, turn)
            }) {
    }
    ✅ 1
    🤔 1
    a
    • 2
    • 11
  • s

    Stefan Oltmann

    08/06/2021, 10:17 AM
    I try to migrate to v1.0.0-alpha3 singleWindowApplication() I have a "Image" that I created from a local "icon.png" that I used for the "icon" field. Now I need to provide a "Painter", but painterResource() can't be used as parameter that is a Composable. Looking at https://github.com/JetBrains/compose-jb/tree/master/tutorials/Image_And_Icons_Manipulations I don't see how I can now set my window icon... Can you please show me an example how to do that?
    i
    • 2
    • 2
  • a

    Alexey Glushkov

    08/06/2021, 1:41 PM
    Hi. I see if I add a java file and try to build an app with compose-jb I get this dreadful error in
    compileJava
    task: https://pastebin.com/ghZLKS21 (Could not resolve all task dependencies for configuration) Is it correct that I can’t build a compose desktop app with java source code? I tried to bring Dagger in my compose-jb target and as it generated java files I got such an error… The changes for ToDo sample app to reproduce the behavior: https://github.com/soniccat/compose-jb/commit/df0dc8a88e8cbb4bb0abd8e88e22f20ac8d676ea Also I had the same problem here for some reasons: https://kotlinlang.slack.com/archives/C01D6HTPATV/p1628078176106900
    • 1
    • 1
  • d

    darkmoon_uk

    08/06/2021, 3:15 PM
    Is anyone able to use Compose Preview for Android with Arctic Fox (Full Release) and the latest Multiplatform Compose Artifact (
    1.0.0-alpha3
    )? It's failing with this in the Preview window:
    The following classes could not be found:
    - androidx.compose.ui.tooling.preview.ComposeViewAdapter
    ...searching this error shows it was notoriously common throughout the Arctic Fox Beta's, but supposedly fixed for release. Does the Multiplatform Compose artifact need to be updated? Desktop Preview's working, but Android doesn't.
    j
    a
    • 3
    • 5
  • d

    darkmoon_uk

    08/06/2021, 3:19 PM
    Also I was mildly disappointed to see that the Desktop Preview and Android Preview are: • Still in separate panels - is it not feasible to integrate Desktop preview with the Android Code / Split / Design system? • Cannot work from
    common
    source set i.e. define a
    @Preview
    from within some
    materialCommon
    (Desktop + Android) source set. When we develop a Multiplatform Project for Desktop + Mobile this is (very happily) where we can define most of our Compose components, so not being able to define
    @Preview
    here as well, sadly makes the Preview feature useless in this scenario. I played with different `expect`/`actual` definitions for the
    Preview
    annotation, but couldn't make anything that improved the experience.
    ➕ 6
    s
    c
    a
    • 4
    • 3
  • t

    theapache64

    08/06/2021, 5:32 PM
    ✅ RESOLVED: I am wondering why there’s no default implementation for
    onCloseRequest
    of the new
    Window
    API? Why
    onCloseRequest: () -> Unit
    and why not
    onCloseRequest: () -> Unit = { exitProcess(0) }
    ? 🤔
    a
    • 2
    • 2
  • t

    theapache64

    08/06/2021, 5:41 PM
    ✅ RESOVED: `Window`*’*s
    icon
    property not working 🧵
    i
    • 2
    • 13
  • d

    dbaelz

    08/06/2021, 7:09 PM
    Shouldn't the
    ContextMenuDataProvider
    work on every Composable and show menu (with custom entries) on right click? Doesn't work for me on Text, but works fine (with defaults) on TextField. Tested with alpha 2 and alpha3. Code in 🧵
    ✅ 1
    a
    • 2
    • 4
  • c

    Colton Idle

    08/07/2021, 1:19 AM
    I see that the multiplatform template was updated to include this
    named("commonMain") {
                dependencies {
                    api(compose.runtime)
                    api(compose.foundation)
                    api(compose.material)
                    // Needed only for preview.
                    implementation(compose.preview)
                }
            }
    Does this mean that preview is available in common code?
    a
    • 2
    • 1
  • a

    Ayfri

    08/07/2021, 3:25 AM
    Compose doesn't work on 32-bits windows ?
    c
    i
    a
    • 4
    • 3
  • f

    Frank

    08/07/2021, 9:33 AM
    Hi! I’m trying to include the Coil-Library in my test project: I’ve added the following line to my build script:
    implementation("io.coil-kt:coil:1.3.2")
    But then I build i I get the following error message(s):
    Could not resolve all files for configuration ‘:compileClasspath’.
    > Could not resolve io.coil-kt:coil:1.3.2. Required by: project : > No matching variant of io.coil-kt:coil:1.3.2 was found. The consumer was configured to find an API of a library compatible with Java 15, Any ideas how to solve this?
    o
    a
    • 3
    • 8
  • k

    Konyaco

    08/07/2021, 2:34 PM
    [Solved✅] Hi, I'm trying to create a multiplatform project with android and jvm targets. But I got
    java.lang.OutOfMemoryError: Java heap space
    on
    :android:mergeExtDexDebug
    task when building android mudule. My compose version is "1.0.0-alpha3". Here is my project structure: common module ---- service (written as
    expect class
    ) ---- compose ui, viewmodel (dependens on service) android module ----
    actual
    service ---- Activity that boots compose ui. jvm module ----
    actual
    service (exactly the same as android) ---- Main function that boots compose ui. If I only build jvm module, all work fine. I try to move the code from common module to android module, and that works fine too. My codes were shared to my github repository, as a branch (https://github.com/Konyaco/CollinsDictionary/tree/multiplatform). And I wonder that is there a best way to reuse code between JVM and Android targets? The apis are same in most occasions.
    a
    • 2
    • 2
  • d

    darkmoon_uk

    08/07/2021, 3:07 PM
    :compose: Is there any plan to have Compose Desktop
    @Preview
    support 'Interactive mode' like Android? One of the very best things about Preview in Android is the ability to run Views with real ViewModels behind them; just with mocked services/data plugged in.
    c
    a
    • 3
    • 2
  • c

    Christian Babsek

    08/07/2021, 4:34 PM
    Hello, I have a question concerning the new
    mouseClickable
    on the Modifier. Is it possible, to register it multiple times? It currently consumes the event and just the last "registration" takes effect. I tried to create some convenient extensions, but just the last of it seems to be called:
    @Composable
    fun Modifier.onLeftClickOnly(action: () -> Unit) = mouseClickable {
        println("left")
        if (buttons.isPrimaryPressed && !buttons.isSecondaryPressed && !buttons.isTertiaryPressed) {
            action()
        }
    }
    
    @Composable
    fun Modifier.onMiddleClickOnly(action: () -> Unit) = mouseClickable {
        if (!buttons.isPrimaryPressed && !buttons.isSecondaryPressed && buttons.isTertiaryPressed) {
            action()
        }
    }
    
    @Composable
    fun Modifier.onRightClickOnly(action: () -> Unit) = mouseClickable {
        println("right")
        if (!buttons.isPrimaryPressed && buttons.isSecondaryPressed && !buttons.isTertiaryPressed) {
            action()
        }
    }
    d
    a
    • 3
    • 8
  • p

    PHondogo

    08/08/2021, 5:44 PM
    Does Compose Desktop has paging composer like in https://developer.android.com/jetpack/androidx/releases/paging ?
    👀 2
    ✅ 1
    a
    • 2
    • 3
  • c

    Colton Idle

    08/09/2021, 4:24 PM
    My team officially merged in Compose Multiplatform support! So excited to start making all of our composables usable between desktop and android! 😛arty-parrot: Edit: My PR to merge it in was there for about 3 months. Thank you @Igor Demin for all the information I needed to convince my team to merge!
    🎉 4
    :kotlin-intensifies: 19
    a
    • 2
    • 6
  • c

    Colton Idle

    08/09/2021, 4:35 PM
    One thing that seems a little bit off is that our Desktop sample app compiles and runs just fine but has red lines all over. We're using Android Studio bumblebee canary 6. Using JDK14 as my JAVA_HOME. Using Android Gradle Plugin 7.1.0-alpha06 as well. Edit: Used Android Studio Arctic fox and downgraded to AGP 7.0.0 and I get the same issue. /shruggie
    👀 2
    a
    • 2
    • 19
  • r

    Ruckus

    08/09/2021, 9:37 PM
    Is there a known issue where resizing windows is just plain broken?
    broken-resize.mkv
    s
    • 2
    • 5
  • l

    louiscad

    08/09/2021, 10:31 PM
    Hello, is there a way to get a reference to the main thread (
    java.lang.Thread
    ) of a Compose for Desktop app? My use case is checking whether some code is running on the main thread or not, to disallow running some blocking code where it could affect the UI.
    d
    c
    +3
    • 6
    • 11
  • a

    Abe Sol

    08/10/2021, 8:53 AM
    Hi, trying the first example at https://github.com/JetBrains/compose-jb/tree/master/tutorials/Image_And_Icons_Manipulations
    painterResource
    can't be found (on Desktop). Is there an alternative?
    i
    • 2
    • 1
  • m

    Mak Ho-Cheung

    08/11/2021, 1:39 AM
    Ring UI is beautiful which is used in ToolBox App. I think it is a good idea to provide the UI design in Compose Desktop.
    👍 8
    f
    • 2
    • 1
  • k

    Konyaco

    08/11/2021, 9:12 AM
    Cannot render svg file correctly, but can android xml file. The xml was converted from svg by Android Studio. Is this a bug?
    val WordNotFoundLRes = painterResource("wordnotfound_l.svg")
    
    Image(
        painter = WordNotFoundLRes,
        contentDescription = "Word Not Found",
        colorFilter = null
    )
    wordnotfound_l.xml
    wordnotfound_l.svg
    ✅ 1
    i
    • 2
    • 3
  • d

    dbaelz

    08/11/2021, 1:02 PM
    How can I test the visibility of an (alert) dialog and its content with a Unit test? I'm using the new Dialog/Window API and wrote successfully some Unit tests with the test rule. When the dialog is displayed it doesn't work. The matchers (e.g.
    onNodeWithText
    ) can't find the text and I assume it's because it's in a different window and the rule can't access it? Did look into the
    DesktopComposeTestRule
    and saw that it creates a window for the test and so on, but can't figure out a way to test the visibility of the dialog texts.
    i
    • 2
    • 3
  • c

    Colton Idle

    08/11/2021, 3:34 PM
    Just wondering if anyone had a few minutes to spare today to see if they can repro my issue here: https://github.com/JetBrains/compose-jb/issues/1038 All you need is the multiplatform template and the code I attached in the issue to repro (don't forget to invalidate and restart). I'm trying to figure out if this is a local env issue or if everyone can repro.
    a
    • 2
    • 2
  • k

    kevindmoore

    08/11/2021, 3:44 PM
    I'm having a hard time using desktop compose in Android Studio. AS can't seem to find many classes even though I have the libraries as dependencies
    i
    c
    a
    • 4
    • 15
  • s

    spierce7

    08/11/2021, 8:29 PM
    What are the chances that the compose team will support auto-update functionality? I’m trying to navigate creating an auto-updating app, but it seems that I’d have to abandon the benefit I’d get from compose doing the packing for me and packing everything myself, which obviously isn’t desirable.
    a
    • 2
    • 2
  • y

    yeungkc

    08/13/2021, 4:33 PM
    Hi, I was recently investigating whether compose desktop meets the company’s needs, and one of the goals was to support GIF and animation performance. However, I found that compose desktop does not provide GIF support, and I found two code snippets in the related issue[0], but the performance difference between them is huge. The first one [1], written by @Dominaezzz, is very easy to understand and intuitive, but the CPU usage hovers around 100%. The second one [2], written by @olonho, is a bit more complex, but has better performance, with a CPU usage of around 25%. But I would say that either solution is not really acceptable. And I would like to know how we should write high performance animations? I actually tried to use java swing ImageIcon and it hardly uses any CPU usage. I believe compose desktop should be able to do the same, but how should I do it? [0]: https://github.com/JetBrains/compose-jb/issues/153 [1]: https://github.com/JetBrains/compose-jb/issues/153#issuecomment-864608382 [2]: https://github.com/JetBrains/compose-jb/issues/153#issuecomment-822439430
    d
    i
    • 3
    • 14
  • k

    kevindmoore

    08/14/2021, 7:46 PM
    Has anyone seen this error? (I am not using Android Compose):
    You are using an outdated version of Compose Runtime that is not compatible with the version of the Compose Compiler plugin you have installed. The compose compiler plugin you are using (version 1.1.0-alpha01) expects a minimum runtime version of 1.1.0-alpha01
    ✅ 1
    d
    i
    • 3
    • 10
  • a

    Ayfri

    08/14/2021, 9:40 PM
    Hi, is there any conventions for naming packages and where to put stuff, how to organize everything etc ?
    i
    • 2
    • 1
Powered by Linen
Title
a

Ayfri

08/14/2021, 9:40 PM
Hi, is there any conventions for naming packages and where to put stuff, how to organize everything etc ?
i

Igor Demin

08/14/2021, 11:42 PM
There is no Compose convention for naming packages (there is only conventions for naming functions). The package naming conventions would be the same as in any other UI application. You can look at a very popular package by feature approach (see, for example, codeviewer).
View count: 3