Browse Source

Sync/2021 07 30 (#961)

pull/966/head
Igor Demin 3 years ago committed by GitHub
parent
commit
1786de28a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      ci/compose-uber-jar/build.gradle.kts
  2. 2
      compose/build.gradle.kts
  3. 2
      compose/frameworks/support
  4. 2
      compose/prebuilts/androidx/internal
  5. 1
      gradle-plugins/compose/src/test/test-projects/misc/jvmPreview/build.gradle
  6. 3
      idea-plugin/examples/simple-preview-example/build.gradle.kts
  7. 3
      templates/desktop-template/build.gradle.kts
  8. 4
      templates/multiplatform-template/build.gradle.kts
  9. 1
      templates/web-template/build.gradle.kts
  10. 9
      tutorials/Desktop_Components/README.md
  11. 9
      tutorials/Getting_Started/README.md
  12. 6
      tutorials/Image_And_Icons_Manipulations/README.md
  13. 9
      tutorials/Mouse_Events/README.md
  14. 2
      tutorials/Native_distributions_and_local_execution/README.md
  15. 2
      tutorials/Navigation/README.md
  16. 2
      tutorials/Swing_Integration/README.md
  17. 2
      tutorials/Tray_Notifications_MenuBar_new/README.md
  18. 1
      tutorials/Web/Getting_Started/README.md
  19. 22
      tutorials/Window_API_new/README.md

1
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 {

2
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 {

2
compose/frameworks/support

@ -1 +1 @@
Subproject commit 9b5ede8dc435293ac09419421528921b8fed27fb
Subproject commit 86510c65f5a333c9a2e2553b0c59764a055cfba0

2
compose/prebuilts/androidx/internal

@ -1 +1 @@
Subproject commit f37dc6b42fe7838e9e37fbe8a9eb063a1550acd8
Subproject commit 818a882ba70e8603d6a22b17d421c9049926da4c

1
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()
}
}

3
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()
}
}

3
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 {

4
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 {

1
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 {

9
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
)

9
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,

6
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(

9
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!") }

2
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!")

2
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"
) {

2
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) }

2
tutorials/Tray_Notifications_MenuBar_new/README.md

@ -1,4 +1,4 @@
# Menu, tray, notifications (new Composable API, experimental)
# Menu, tray, notifications
## What is covered

1
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

22
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)
}
})
}
}
}
}

Loading…
Cancel
Save