diff --git a/templates/desktop-template/build.gradle.kts b/templates/desktop-template/build.gradle.kts index cc675b8199..632c9303e8 100644 --- a/templates/desktop-template/build.gradle.kts +++ b/templates/desktop-template/build.gradle.kts @@ -5,7 +5,7 @@ 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") ?: "0.0.0-sync-2021-07-28-build290") } repositories { 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 461cf2fbd8..3e0ebfe1d8 100644 --- a/tutorials/Getting_Started/README.md +++ b/tutorials/Getting_Started/README.md @@ -102,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/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) + } + }) + } } } }