From 1786de28a77ada1fff87d7bde36939df129874e7 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Sat, 31 Jul 2021 00:38:25 +0300 Subject: [PATCH] Sync/2021 07 30 (#961) --- ci/compose-uber-jar/build.gradle.kts | 1 + compose/build.gradle.kts | 2 +- compose/frameworks/support | 2 +- compose/prebuilts/androidx/internal | 2 +- .../misc/jvmPreview/build.gradle | 1 + .../simple-preview-example/build.gradle.kts | 3 ++- templates/desktop-template/build.gradle.kts | 3 ++- .../multiplatform-template/build.gradle.kts | 4 ++-- templates/web-template/build.gradle.kts | 1 + tutorials/Desktop_Components/README.md | 9 +------- tutorials/Getting_Started/README.md | 9 ++++---- .../Image_And_Icons_Manipulations/README.md | 6 ----- tutorials/Mouse_Events/README.md | 9 +------- .../README.md | 2 -- tutorials/Navigation/README.md | 2 -- tutorials/Swing_Integration/README.md | 2 -- .../Tray_Notifications_MenuBar_new/README.md | 2 +- tutorials/Web/Getting_Started/README.md | 1 + tutorials/Window_API_new/README.md | 22 +++++++++++++------ 19 files changed, 35 insertions(+), 48 deletions(-) diff --git a/ci/compose-uber-jar/build.gradle.kts b/ci/compose-uber-jar/build.gradle.kts index 8c5158334b..8067278563 100644 --- a/ci/compose-uber-jar/build.gradle.kts +++ b/ci/compose-uber-jar/build.gradle.kts @@ -11,6 +11,7 @@ val properties = ComposeUberJarProperties() repositories { mavenCentral() maven(properties.composeRepoUrl) + google() } val composeVersion: String by lazy { diff --git a/compose/build.gradle.kts b/compose/build.gradle.kts index 240659fd7c..48e236193e 100644 --- a/compose/build.gradle.kts +++ b/compose/build.gradle.kts @@ -11,7 +11,6 @@ tasks.register("publishComposeJb") { dependsOnComposeTask(":compose:compiler:compiler:publishMavenPublicationToMavenRepository") dependsOnComposeTask(":compose:compiler:compiler-hosted:publishMavenPublicationToMavenRepository") dependsOnComposeTask(":compose:ui:ui-tooling-data:publishMavenPublicationToMavenRepository") - dependsOnComposeTask(":compose:ui:ui-tooling-preview:publishMavenPublicationToMavenRepository") dependsOnComposeTask(":compose:desktop:desktop:publishKotlinMultiplatformPublicationToMavenRepository") dependsOnComposeTask(":compose:desktop:desktop:publishJvmPublicationToMavenRepository") @@ -38,6 +37,7 @@ tasks.register("publishComposeJb") { ":compose:ui:ui-test-junit4", ":compose:ui:ui-text", ":compose:ui:ui-tooling", + ":compose:ui:ui-tooling-preview", ":compose:ui:ui-unit", ":compose:ui:ui-util", ).forEach { diff --git a/compose/frameworks/support b/compose/frameworks/support index 9b5ede8dc4..86510c65f5 160000 --- a/compose/frameworks/support +++ b/compose/frameworks/support @@ -1 +1 @@ -Subproject commit 9b5ede8dc435293ac09419421528921b8fed27fb +Subproject commit 86510c65f5a333c9a2e2553b0c59764a055cfba0 diff --git a/compose/prebuilts/androidx/internal b/compose/prebuilts/androidx/internal index f37dc6b42f..818a882ba7 160000 --- a/compose/prebuilts/androidx/internal +++ b/compose/prebuilts/androidx/internal @@ -1 +1 @@ -Subproject commit f37dc6b42fe7838e9e37fbe8a9eb063a1550acd8 +Subproject commit 818a882ba70e8603d6a22b17d421c9049926da4c diff --git a/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle b/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle index dccfb9664d..e5a360f3a0 100644 --- a/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle +++ b/gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle @@ -5,5 +5,6 @@ subprojects { maven { url 'https://maven.pkg.jetbrains.space/public/p/compose/dev' } + google() } } \ No newline at end of file diff --git a/idea-plugin/examples/simple-preview-example/build.gradle.kts b/idea-plugin/examples/simple-preview-example/build.gradle.kts index 7b2e0a3b0d..a619d247c0 100644 --- a/idea-plugin/examples/simple-preview-example/build.gradle.kts +++ b/idea-plugin/examples/simple-preview-example/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { } dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:0.5.0-build262") + classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha1-rc1") // __KOTLIN_COMPOSE_VERSION__ classpath(kotlin("gradle-plugin", version = "1.5.21")) } @@ -17,5 +17,6 @@ subprojects { mavenLocal() mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() } } \ No newline at end of file diff --git a/templates/desktop-template/build.gradle.kts b/templates/desktop-template/build.gradle.kts index e69a475ad5..10f1f249c2 100644 --- a/templates/desktop-template/build.gradle.kts +++ b/templates/desktop-template/build.gradle.kts @@ -5,12 +5,13 @@ plugins { // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.5.21" // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.5.0-build270") + id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-alpha1-rc1") } repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() } dependencies { diff --git a/templates/multiplatform-template/build.gradle.kts b/templates/multiplatform-template/build.gradle.kts index 74bd14a6ef..319ca7abd5 100644 --- a/templates/multiplatform-template/build.gradle.kts +++ b/templates/multiplatform-template/build.gradle.kts @@ -1,11 +1,11 @@ buildscript { // __LATEST_COMPOSE_RELEASE_VERSION__ - val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.5.0-build270" + val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-alpha1-rc1" repositories { - google() mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() } dependencies { diff --git a/templates/web-template/build.gradle.kts b/templates/web-template/build.gradle.kts index 4cd02ceb0f..f296956603 100644 --- a/templates/web-template/build.gradle.kts +++ b/templates/web-template/build.gradle.kts @@ -11,6 +11,7 @@ plugins { repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() } kotlin { diff --git a/tutorials/Desktop_Components/README.md b/tutorials/Desktop_Components/README.md index 5ace8770fc..11a902f3d2 100644 --- a/tutorials/Desktop_Components/README.md +++ b/tutorials/Desktop_Components/README.md @@ -28,14 +28,12 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.window.WindowState import androidx.compose.ui.window.singleWindowApplication -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication( title = "Scrollbars", state = WindowState(width = 250.dp, height = 400.dp) @@ -114,7 +112,6 @@ import androidx.compose.foundation.rememberScrollbarAdapter import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp @@ -122,7 +119,6 @@ import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState -@OptIn(ExperimentalComposeUiApi::class) fun main() = application { Window( onCloseRequest = ::exitApplication, @@ -197,7 +193,6 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.graphics.Color import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp @@ -205,7 +200,6 @@ import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState -@OptIn(ExperimentalComposeUiApi::class) fun main() = application { Window( onCloseRequest = ::exitApplication, @@ -319,8 +313,7 @@ fun main() = application { } }, delay = 600, // in milliseconds - tooltipPlacement = TooltipPlacement( - anchor = TooltipPlacement.Anchor.Pointer, + tooltipPlacement = TooltipPlacement.CursorPoint( alignment = Alignment.BottomEnd, offset = if (index % 2 == 0) DpOffset(-16.dp, 0.dp) else DpOffset.Zero // tooltip offset ) diff --git a/tutorials/Getting_Started/README.md b/tutorials/Getting_Started/README.md index 201f067c86..03473f1317 100644 --- a/tutorials/Getting_Started/README.md +++ b/tutorials/Getting_Started/README.md @@ -32,11 +32,11 @@ packaging JDK 15 or later must be used. ### Update the wizard plugin -The Сompose plugin version used in the wizard above may be not the last. Update the version of the plugin to the latest available by editing the `build.gradle.kts` file, finding and updating the version information as shown below. In this example the latest version of the plugin was 0.5.0-build270 and a compatible version of kotlin was 1.5.21. For the latest versions, see the [latest versions](https://github.com/JetBrains/compose-jb/releases) site and the [Kotlin](https://kotlinlang.org/) site. +The Сompose plugin version used in the wizard above may be not the last. Update the version of the plugin to the latest available by editing the `build.gradle.kts` file, finding and updating the version information as shown below. In this example the latest version of the plugin was 1.0.0-alpha1-rc1 and a compatible version of kotlin was 1.5.21. For the latest versions, see the [latest versions](https://github.com/JetBrains/compose-jb/releases) site and the [Kotlin](https://kotlinlang.org/) site. ``` plugins { kotlin("jvm") version "1.5.21" - id("org.jetbrains.compose") version "0.5.0-build270" + id("org.jetbrains.compose") version "1.0.0-alpha1-rc1" } ``` @@ -72,12 +72,13 @@ import org.jetbrains.compose.compose plugins { kotlin("jvm") version "1.5.21" - id("org.jetbrains.compose") version "0.5.0-build270" + id("org.jetbrains.compose") version "1.0.0-alpha1-rc1" } repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() } dependencies { @@ -101,14 +102,12 @@ import androidx.compose.material.Text import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState -@OptIn(ExperimentalComposeUiApi::class) fun main() = application { Window( onCloseRequest = ::exitApplication, diff --git a/tutorials/Image_And_Icons_Manipulations/README.md b/tutorials/Image_And_Icons_Manipulations/README.md index c2e242fad6..0d57c706c0 100755 --- a/tutorials/Image_And_Icons_Manipulations/README.md +++ b/tutorials/Image_And_Icons_Manipulations/README.md @@ -13,12 +13,10 @@ Using images from application resources is very simple. Suppose we have a PNG im ```kotlin import androidx.compose.foundation.Image import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.window.singleWindowApplication -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { Image( painter = painterResource("sample.png"), // ImageBitmap @@ -44,7 +42,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.produceState import androidx.compose.runtime.remember -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.painter.BitmapPainter @@ -65,7 +62,6 @@ import org.xml.sax.InputSource import java.io.File import java.io.IOException -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { val density = LocalDensity.current Column { @@ -147,7 +143,6 @@ You may want to draw raw image data, in which case you can use `Canvas` and` dra import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.remember -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.ImageBitmap @@ -163,7 +158,6 @@ import org.jetbrains.skija.ImageInfo private val sample = useResource("sample.png", ::loadImageBitmap) -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { val bitmap = remember { bitmapFromByteArray(sample.getBytes(), sample.width, sample.height) } Canvas( diff --git a/tutorials/Mouse_Events/README.md b/tutorials/Mouse_Events/README.md index 26a4b00b85..c48385d9ab 100644 --- a/tutorials/Mouse_Events/README.md +++ b/tutorials/Mouse_Events/README.md @@ -26,13 +26,11 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.sp import androidx.compose.ui.window.singleWindowApplication -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { var count by remember { mutableStateOf(0) } Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxWidth()) { @@ -80,13 +78,11 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerMoveFilter import androidx.compose.ui.window.singleWindowApplication -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { var color by remember { mutableStateOf(Color(0, 0, 0)) } Box( @@ -119,7 +115,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerMoveFilter @@ -128,7 +123,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.window.singleWindowApplication -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { Column( Modifier.background(Color.White), @@ -172,11 +166,10 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.window.singleWindowApplication -@OptIn(ExperimentalComposeUiApi::class, ExperimentalDesktopApi::class) +@OptIn(ExperimentalDesktopApi::class) fun main() = singleWindowApplication { var clickableText by remember { mutableStateOf("Click me!") } diff --git a/tutorials/Native_distributions_and_local_execution/README.md b/tutorials/Native_distributions_and_local_execution/README.md index c2cffcac71..c09febaa6a 100755 --- a/tutorials/Native_distributions_and_local_execution/README.md +++ b/tutorials/Native_distributions_and_local_execution/README.md @@ -464,11 +464,9 @@ import androidx.compose.material.Text import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.window.singleWindowApplication import java.awt.Desktop -@OptIn(ExperimentalComposeUiApi::class) fun main() { var text by mutableStateOf("Hello, World!") diff --git a/tutorials/Navigation/README.md b/tutorials/Navigation/README.md index ea5b3239d8..336a696c9f 100644 --- a/tutorials/Navigation/README.md +++ b/tutorials/Navigation/README.md @@ -293,12 +293,10 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import androidx.compose.runtime.Composable -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.window.singleWindowApplication import com.arkivanov.decompose.extensions.compose.jetbrains.rememberRootComponent -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication( title = "Navigation tutorial" ) { diff --git a/tutorials/Swing_Integration/README.md b/tutorials/Swing_Integration/README.md index ea6bafb25e..0f9acde0f0 100644 --- a/tutorials/Swing_Integration/README.md +++ b/tutorials/Swing_Integration/README.md @@ -147,7 +147,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.awt.SwingPanel import androidx.compose.ui.graphics.Color @@ -158,7 +157,6 @@ import javax.swing.BoxLayout import javax.swing.JButton import javax.swing.JPanel -@OptIn(ExperimentalComposeUiApi::class) fun main() = singleWindowApplication { val counter = remember { mutableStateOf(0) } diff --git a/tutorials/Tray_Notifications_MenuBar_new/README.md b/tutorials/Tray_Notifications_MenuBar_new/README.md index e1efc1e83f..b6b02d6d71 100644 --- a/tutorials/Tray_Notifications_MenuBar_new/README.md +++ b/tutorials/Tray_Notifications_MenuBar_new/README.md @@ -1,4 +1,4 @@ -# Menu, tray, notifications (new Composable API, experimental) +# Menu, tray, notifications ## What is covered diff --git a/tutorials/Web/Getting_Started/README.md b/tutorials/Web/Getting_Started/README.md index df77d7010d..e496d31086 100644 --- a/tutorials/Web/Getting_Started/README.md +++ b/tutorials/Web/Getting_Started/README.md @@ -50,6 +50,7 @@ plugins { repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() } // Enable JS(IR) target and add dependencies diff --git a/tutorials/Window_API_new/README.md b/tutorials/Window_API_new/README.md index 6659ac8541..c7050df194 100644 --- a/tutorials/Window_API_new/README.md +++ b/tutorials/Window_API_new/README.md @@ -1,4 +1,4 @@ -# Top level windows management (new Composable API, experimental) +# Top level windows management ## What is covered @@ -185,7 +185,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.remember -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.window.ApplicationScope import androidx.compose.ui.window.MenuBar import androidx.compose.ui.window.Window @@ -201,7 +200,6 @@ fun main() = application { } } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun ApplicationScope.MyWindow( state: MyWindowState @@ -440,16 +438,26 @@ fun main() = SwingUtilities.invokeLater { You can also access ComposeWindow in the Composable `Window` scope: ```kotlin import androidx.compose.runtime.LaunchedEffect -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.window.Window import androidx.compose.ui.window.application -import java.awt.Cursor +import java.awt.datatransfer.DataFlavor +import java.awt.dnd.DnDConstants +import java.awt.dnd.DropTarget +import java.awt.dnd.DropTargetAdapter +import java.awt.dnd.DropTargetDropEvent -@OptIn(ExperimentalComposeUiApi::class) fun main() = application { Window(onCloseRequest = ::exitApplication) { LaunchedEffect(Unit) { - window.cursor = Cursor(Cursor.CROSSHAIR_CURSOR) + window.dropTarget = DropTarget().apply { + addDropTargetListener(object : DropTargetAdapter() { + override fun drop(event: DropTargetDropEvent) { + event.acceptDrop(DnDConstants.ACTION_COPY); + val fileName = event.transferable.getTransferData(DataFlavor.javaFileListFlavor) + println(fileName) + } + }) + } } } }