diff --git a/examples/widgets-gallery/android/build.gradle.kts b/examples/widgets-gallery/android/build.gradle.kts index 0bec349e9e..d5866b2b34 100644 --- a/examples/widgets-gallery/android/build.gradle.kts +++ b/examples/widgets-gallery/android/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } android { - compileSdk = 30 + compileSdk = 31 defaultConfig { minSdk = 26 diff --git a/examples/widgets-gallery/build.gradle.kts b/examples/widgets-gallery/build.gradle.kts index 23253c1fd2..39074124ac 100644 --- a/examples/widgets-gallery/build.gradle.kts +++ b/examples/widgets-gallery/build.gradle.kts @@ -8,10 +8,10 @@ buildscript { dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha1") - classpath("com.android.tools.build:gradle:7.0.0") + classpath("org.jetbrains.compose:compose-gradle-plugin:0.0.0-master-build413") + classpath("com.android.tools.build:gradle:4.2.0") // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.5.21")) + classpath(kotlin("gradle-plugin", version = "1.5.31")) } } diff --git a/examples/widgets-gallery/common/src/androidMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt b/examples/widgets-gallery/common/src/androidMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt index d0225f3588..4771e40e0f 100644 --- a/examples/widgets-gallery/common/src/androidMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt +++ b/examples/widgets-gallery/common/src/androidMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt @@ -2,21 +2,23 @@ package org.jetbrains.compose.demo.widgets.platform import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.imageResource +import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.vectorResource import org.jetbrains.compose.demo.widgets.platform.R @Composable -actual fun imageResource(res: String): ImageBitmap { +actual fun imageResource(res: String): Painter { val id = drawableId(res) - return ImageBitmap.imageResource(id) + return painterResource(id) } @Composable -actual fun vectorResource(res: String): ImageVector { +actual fun vectorResource(res: String): Painter { val id = drawableId(res) - return ImageVector.vectorResource(id) + return painterResource(id) } // TODO: improve resource loading diff --git a/examples/widgets-gallery/common/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt b/examples/widgets-gallery/common/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt index f9ecf511b0..6c51380fc3 100644 --- a/examples/widgets-gallery/common/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt +++ b/examples/widgets-gallery/common/src/commonMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt @@ -1,12 +1,11 @@ package org.jetbrains.compose.demo.widgets.platform import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.ImageBitmap -import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.painter.Painter @Composable -expect fun imageResource(res: String): ImageBitmap +expect fun imageResource(res: String): Painter @Composable -expect fun vectorResource(res: String): ImageVector +expect fun vectorResource(res: String): Painter diff --git a/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Mouse.kt b/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Mouse.kt index 1ad6cb3067..fdb54cfdd7 100644 --- a/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Mouse.kt +++ b/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Mouse.kt @@ -4,10 +4,11 @@ import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.input.pointer.PointerIcon -import androidx.compose.ui.input.pointer.pointerIcon +import androidx.compose.ui.input.pointer.pointerHoverIcon import androidx.compose.ui.input.pointer.pointerMoveFilter import java.awt.Cursor +@OptIn(ExperimentalComposeUiApi::class) actual fun Modifier.pointerMoveFilter( onEnter: () -> Boolean, onExit: () -> Boolean, @@ -16,4 +17,4 @@ actual fun Modifier.pointerMoveFilter( @OptIn(ExperimentalComposeUiApi::class) actual fun Modifier.cursorForHorizontalResize(): Modifier = - pointerIcon(PointerIcon(Cursor(Cursor.E_RESIZE_CURSOR))) + Modifier.pointerHoverIcon(PointerIcon.Crosshair) diff --git a/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt b/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt index 7f1c30a862..5f0f22f4d5 100644 --- a/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt +++ b/examples/widgets-gallery/common/src/desktopMain/kotlin/org/jetbrains/compose/demo/widgets/platform/Resources.kt @@ -1,14 +1,13 @@ package org.jetbrains.compose.demo.widgets.platform import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorXmlResource -import androidx.compose.ui.res.imageResource as bitmapImage +import androidx.compose.ui.res.loadXmlImageVector +import androidx.compose.ui.res.painterResource @Composable -actual fun imageResource(res: String) = - bitmapImage(res) +actual fun imageResource(res: String): Painter = painterResource(res) @Composable -actual fun vectorResource(res: String): ImageVector = - vectorXmlResource(res) \ No newline at end of file +actual fun vectorResource(res: String): Painter = painterResource(res) \ No newline at end of file diff --git a/examples/widgets-gallery/desktop/src/jvmMain/kotlin/org/jetbrains/compose/demo/widgets/main.kt b/examples/widgets-gallery/desktop/src/jvmMain/kotlin/org/jetbrains/compose/demo/widgets/main.kt index fe892927b2..5497905568 100644 --- a/examples/widgets-gallery/desktop/src/jvmMain/kotlin/org/jetbrains/compose/demo/widgets/main.kt +++ b/examples/widgets-gallery/desktop/src/jvmMain/kotlin/org/jetbrains/compose/demo/widgets/main.kt @@ -1,18 +1,13 @@ package org.jetbrains.compose.demo.widgets +import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp -import androidx.compose.ui.window.Window -import androidx.compose.ui.window.WindowSize import androidx.compose.ui.window.WindowState -import androidx.compose.ui.window.application +import androidx.compose.ui.window.singleWindowApplication import org.jetbrains.compose.demo.widgets.ui.MainView -fun main() = application { - Window( - onCloseRequest = ::exitApplication, - title = "Widgets Gallery", - state = WindowState(size = WindowSize(800.dp, 600.dp)) - ) { - MainView() - } +fun main() = singleWindowApplication( + title = "Widgets Gallery", state = WindowState(size = DpSize(800.dp, 800.dp)) +) { + MainView() } \ No newline at end of file