Browse Source

Mostly move to 1.0.0-alpha4-build361

pull/1205/head
Nikolay Igotti 3 years ago
parent
commit
929b28787d
  1. 4
      examples/codeviewer/build.gradle.kts
  2. 2
      examples/codeviewer/common/src/desktopMain/kotlin/org/jetbrains/codeviewer/platform/Scrollbar.kt
  3. 4
      examples/falling-balls/build.gradle.kts
  4. 6
      examples/imageviewer/build.gradle.kts
  5. 6
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/DesktopContentState.kt
  6. 2
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt
  7. 3
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Tooltip.kt
  8. 4
      examples/intellij-plugin/build.gradle.kts
  9. 4
      examples/issues/build.gradle.kts
  10. 4
      templates/desktop-template/build.gradle.kts
  11. 47
      tutorials/Context_Menu/README.md
  12. 11
      tutorials/Desktop_Components/README.md
  13. 4
      tutorials/Mouse_Events/README.md

4
examples/codeviewer/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("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build361")
classpath("com.android.tools.build:gradle:4.0.1")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.21"))
classpath(kotlin("gradle-plugin", version = "1.5.31"))
}
}

2
examples/codeviewer/common/src/desktopMain/kotlin/org/jetbrains/codeviewer/platform/Scrollbar.kt

@ -25,6 +25,6 @@ actual fun VerticalScrollbar(
itemCount: Int,
averageItemSize: Dp
) = androidx.compose.foundation.VerticalScrollbar(
rememberScrollbarAdapter(scrollState, itemCount, averageItemSize),
rememberScrollbarAdapter(scrollState),
modifier
)

4
examples/falling-balls/build.gradle.kts

@ -4,9 +4,9 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.21"
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0-alpha1"
id("org.jetbrains.compose") version "1.0.0-alpha4-build361"
}
group = "me.user"

6
examples/imageviewer/build.gradle.kts

@ -7,9 +7,9 @@ buildscript {
dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha1")
classpath("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build361")
classpath("com.android.tools.build:gradle:4.1.0")
classpath(kotlin("gradle-plugin", version = "1.5.21"))
classpath(kotlin("gradle-plugin", version = "1.5.31"))
}
}
@ -19,4 +19,4 @@ allprojects {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
}

6
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/DesktopContentState.kt

@ -20,12 +20,12 @@ import java.awt.image.BufferedImage
import java.io.File
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import org.jetbrains.skija.Image.makeFromEncoded
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import org.jetbrains.skia.Image
object ContentState {
val drag = DragHandler()
@ -241,7 +241,7 @@ object ContentState {
}
fun updateMainImage() {
MainImageWrapper.mainImageAsImageBitmap.value = makeFromEncoded(
MainImageWrapper.mainImageAsImageBitmap.value = Image.makeFromEncoded(
toByteArray(
cropBitmapByScale(
mainImage.value,
@ -363,4 +363,4 @@ private object MainImageWrapper {
graphics.drawImage(bitmap, 0, 0, result.width, result.height, null)
return result
}
}
}

2
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt

@ -186,7 +186,7 @@ fun Miniature(
}
) {
Image(
org.jetbrains.skija.Image.makeFromEncoded(
org.jetbrains.skia.Image.makeFromEncoded(
toByteArray(picture.image)
).asImageBitmap(),
contentDescription = null,

3
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Tooltip.kt

@ -1,6 +1,7 @@
package example.imageviewer.view
import androidx.compose.foundation.BoxWithTooltip
import androidx.compose.foundation.TooltipArea
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
@ -16,7 +17,7 @@ fun Tooltip(
text: String = "Tooltip",
content: @Composable () -> Unit
) {
BoxWithTooltip(
TooltipArea(
tooltip = {
Surface(
color = Color(210, 210, 210),

4
examples/intellij-plugin/build.gradle.kts

@ -3,9 +3,9 @@ import org.jetbrains.compose.compose
plugins {
id("org.jetbrains.intellij") version "1.1.4"
java
kotlin("jvm") version "1.5.21"
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0-alpha1"
id("org.jetbrains.compose") version "1.0.0-alpha4-build361"
id("idea")
}

4
examples/issues/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("org.jetbrains.compose:compose-gradle-plugin:1.0.0-alpha4-build361")
classpath("com.android.tools.build:gradle:4.1.0")
// __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.5.21"))
classpath(kotlin("gradle-plugin", version = "1.5.31"))
}
}

4
templates/desktop-template/build.gradle.kts

@ -3,9 +3,9 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins {
// __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.30"
kotlin("jvm") version "1.5.31"
// __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-alpha4-build328")
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "1.0.0-alpha4-build361")
}
repositories {

47
tutorials/Context_Menu/README.md

@ -109,32 +109,49 @@ In this example Text/TextField context menus will be extended with two additiona
There is a possibility to create a context menu for an arbitrary application window area. This is implemented using ContextMenuArea API that is
similar to ContextMenuDataProvider.
```kotlin
import androidx.compose.desktop.DesktopMaterialTheme
import androidx.compose.foundation.ContextMenuArea
import androidx.compose.foundation.ContextMenuDataProvider
import androidx.compose.foundation.ContextMenuItem
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
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.singleWindowApplication
@OptIn(ExperimentalComposeUiApi::class, androidx.compose.foundation.ExperimentalFoundationApi::class)
fun main() = singleWindowApplication(title = "Context menu") {
DesktopMaterialTheme { //it is mandatory for Context Menu
ContextMenuArea(items = {
listOf(
ContextMenuItem("User-defined Action") {/*do something here*/},
ContextMenuItem("Another user-defined action") {/*do something else*/}
)
}) {
Box(modifier = Modifier.background(Color.Blue).height(100.dp).width(100.dp)) {
MaterialTheme { //it is mandatory for Context Menu
val text = remember {mutableStateOf("Hello!")}
Column {
ContextMenuDataProvider(
items = {
listOf(
ContextMenuItem("User-defined Action") {/*do something here*/},
ContextMenuItem("Another user-defined action") {/*do something else*/}
)
}
) {
TextField(
value = text.value,
onValueChange = { text.value = it },
label = { Text(text = "Input") }
)
Spacer(Modifier.height(16.dp))
SelectionContainer {
Text("Hello World!")
}
}
}
}
}
}
```
Right click on the Blue Square will show a context menu with two items

11
tutorials/Desktop_Components/README.md

@ -264,7 +264,8 @@ The main arguments of the `BoxWithTooltip` function:
- delay - time delay in milliseconds after which the tooltip will be shown (default is 500 ms)
```kotlin
import androidx.compose.foundation.BoxWithTooltip
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.TooltipArea
import androidx.compose.foundation.TooltipPlacement
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@ -285,7 +286,7 @@ import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
@OptIn(ExperimentalComposeUiApi::class)
@OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class)
fun main() = application {
Window(
onCloseRequest = ::exitApplication,
@ -296,8 +297,7 @@ fun main() = application {
Column(Modifier.fillMaxSize(), Arrangement.spacedBy(5.dp)) {
buttons.forEachIndexed { index, name ->
// wrap button in BoxWithTooltip
BoxWithTooltip(
modifier = Modifier.padding(start = 40.dp),
TooltipArea(
tooltip = {
// composable tooltip content
Surface(
@ -311,7 +311,8 @@ fun main() = application {
)
}
},
delay = 600, // in milliseconds
modifier = Modifier.padding(start = 40.dp),
delayMillis = 600, // in milliseconds
tooltipPlacement = TooltipPlacement.CursorPoint(
alignment = Alignment.BottomEnd,
offset = if (index % 2 == 0) DpOffset(-16.dp, 0.dp) else DpOffset.Zero // tooltip offset

4
tutorials/Mouse_Events/README.md

@ -159,7 +159,7 @@ fun main() = singleWindowApplication {
Compose for Desktop contains desktop-only `Modifier.mouseClickable`, where data about pressed mouse buttons and keyboard modifiers is available. This is an experimental API, which means that it's likely to be changed before release.
```kotlin
import androidx.compose.foundation.ExperimentalDesktopApi
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.mouseClickable
import androidx.compose.material.Text
import androidx.compose.runtime.getValue
@ -176,7 +176,7 @@ import androidx.compose.ui.input.pointer.isShiftPressed
import androidx.compose.ui.input.pointer.isTertiaryPressed
import androidx.compose.ui.window.singleWindowApplication
@OptIn(ExperimentalDesktopApi::class)
@OptIn(ExperimentalFoundationApi::class)
fun main() = singleWindowApplication {
var clickableText by remember { mutableStateOf("Click me!") }

Loading…
Cancel
Save