Browse Source

Move to 0.2.0-build128

pull/145/head 0.2.0-build129
Nikolay Igotti 4 years ago
parent
commit
18afa24fe0
  1. 8
      benchmarks/build.gradle.kts
  2. 5
      examples/imageviewer/build.gradle.kts
  3. 3
      examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt
  4. 23
      examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/style/Decoration.kt
  5. 16
      examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt
  6. 11
      examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt
  7. 3
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt
  8. 23
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/style/Decoration.kt
  9. 19
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/FullImageScreen.kt
  10. 13
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt
  11. 7
      examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Toast.kt
  12. 6
      examples/issues/build.gradle.kts
  13. 2
      examples/issues/common/src/desktopMain/kotlin/androidx/ui/examples/jetissues/common/Platform.kt
  14. 2
      examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt
  15. 28
      examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt
  16. 5
      examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt
  17. 2
      examples/todoapp/gradle/wrapper/gradle-wrapper.properties
  18. 3
      gradle-plugins/build.gradle.kts
  19. 4
      gradle-plugins/gradle.properties
  20. 5
      templates/desktop-template/build.gradle.kts
  21. 8
      templates/desktop-template/build_and_run_from_cli_example.sh
  22. 2
      templates/desktop-template/gradle/wrapper/gradle-wrapper.properties
  23. 5
      templates/multiplatform-template/build.gradle.kts
  24. 2
      templates/multiplatform-template/gradle/wrapper/gradle-wrapper.properties

8
benchmarks/build.gradle.kts

@ -3,10 +3,12 @@ import kotlinx.benchmark.gradle.*
import org.jetbrains.kotlin.allopen.gradle.* import org.jetbrains.kotlin.allopen.gradle.*
plugins { plugins {
kotlin("jvm") version "1.4.0" // __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.4.20"
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "0.1.0-build113" id("org.jetbrains.compose") version "0.2.0-build128"
kotlin("plugin.allopen") version "1.4.0" // __KOTLIN_COMPOSE_VERSION__
kotlin("plugin.allopen") version "1.4.20"
id("kotlinx.benchmark") version "0.2.0-dev-20" id("kotlinx.benchmark") version "0.2.0-dev-20"
} }

5
examples/imageviewer/build.gradle.kts

@ -11,9 +11,10 @@ buildscript {
dependencies { dependencies {
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:0.1.0-build113") classpath("org.jetbrains.compose:compose-gradle-plugin:0.2.0-build128")
classpath("com.android.tools.build:gradle:4.0.1") classpath("com.android.tools.build:gradle:4.0.1")
classpath(kotlin("gradle-plugin", version = "1.4.0")) // __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.4.20"))
} }
} }

3
examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt

@ -50,8 +50,5 @@ private fun getFilter(type: FilterType, context: Context): BitmapFilter {
FilterType.GrayScale -> GrayScaleFilter() FilterType.GrayScale -> GrayScaleFilter()
FilterType.Pixel -> PixelFilter() FilterType.Pixel -> PixelFilter()
FilterType.Blur -> BlurFilter(context) FilterType.Blur -> BlurFilter(context)
else -> {
EmptyFilter()
}
} }
} }

23
examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/style/Decoration.kt

@ -1,39 +1,38 @@
package example.imageviewer.style package example.imageviewer.style
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.ImageAsset
import androidx.compose.ui.res.imageResource import androidx.compose.ui.res.imageResource
import example.imageviewer.common.R import example.imageviewer.common.R
@Composable @Composable
fun icEmpty(): ImageAsset = imageResource(R.raw.empty) fun icEmpty() = imageResource(R.raw.empty)
@Composable @Composable
fun icBack(): ImageAsset = imageResource(R.raw.back) fun icBack() = imageResource(R.raw.back)
@Composable @Composable
fun icRefresh(): ImageAsset = imageResource(R.raw.refresh) fun icRefresh() = imageResource(R.raw.refresh)
@Composable @Composable
fun icDots(): ImageAsset = imageResource(R.raw.dots) fun icDots() = imageResource(R.raw.dots)
@Composable @Composable
fun icFilterGrayscaleOn(): ImageAsset = imageResource(R.raw.grayscale_on) fun icFilterGrayscaleOn() = imageResource(R.raw.grayscale_on)
@Composable @Composable
fun icFilterGrayscaleOff(): ImageAsset = imageResource(R.raw.grayscale_off) fun icFilterGrayscaleOff() = imageResource(R.raw.grayscale_off)
@Composable @Composable
fun icFilterPixelOn(): ImageAsset = imageResource(R.raw.pixel_on) fun icFilterPixelOn() = imageResource(R.raw.pixel_on)
@Composable @Composable
fun icFilterPixelOff(): ImageAsset = imageResource(R.raw.pixel_off) fun icFilterPixelOff() = imageResource(R.raw.pixel_off)
@Composable @Composable
fun icFilterBlurOn(): ImageAsset = imageResource(R.raw.blur_on) fun icFilterBlurOn() = imageResource(R.raw.blur_on)
@Composable @Composable
fun icFilterBlurOff(): ImageAsset = imageResource(R.raw.blur_off) fun icFilterBlurOff() = imageResource(R.raw.blur_off)
@Composable @Composable
fun icFilterUnknown(): ImageAsset = imageResource(R.raw.filter_unknown) fun icFilterUnknown() = imageResource(R.raw.filter_unknown)

16
examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt

@ -1,6 +1,5 @@
package example.imageviewer.view package example.imageviewer.view
import android.content.res.Configuration
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Rect import android.graphics.Rect
import androidx.compose.foundation.background import androidx.compose.foundation.background
@ -8,27 +7,25 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.foundation.clickable
import androidx.compose.foundation.ScrollableRow import androidx.compose.foundation.ScrollableRow
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.Text
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageAsset import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.asImageAsset
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.Stack
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.foundation.layout.preferredSize import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import example.imageviewer.core.FilterType import example.imageviewer.core.FilterType
import example.imageviewer.model.AppState import example.imageviewer.model.AppState
@ -161,15 +158,12 @@ fun FilterButton(
} }
@Composable @Composable
fun getFilterImage(type: FilterType, content: ContentState): ImageAsset { fun getFilterImage(type: FilterType, content: ContentState): ImageBitmap {
return when (type) { return when (type) {
FilterType.GrayScale -> if (content.isFilterEnabled(type)) icFilterGrayscaleOn() else icFilterGrayscaleOff() FilterType.GrayScale -> if (content.isFilterEnabled(type)) icFilterGrayscaleOn() else icFilterGrayscaleOff()
FilterType.Pixel -> if (content.isFilterEnabled(type)) icFilterPixelOn() else icFilterPixelOff() FilterType.Pixel -> if (content.isFilterEnabled(type)) icFilterPixelOn() else icFilterPixelOff()
FilterType.Blur -> if (content.isFilterEnabled(type)) icFilterBlurOn() else icFilterBlurOff() FilterType.Blur -> if (content.isFilterEnabled(type)) icFilterBlurOn() else icFilterBlurOff()
else -> {
icFilterUnknown()
}
} }
} }
@ -187,7 +181,7 @@ fun setImage(content: ContentState) {
Scalable(onScale = scale, modifier = Modifier.fillMaxSize()) { Scalable(onScale = scale, modifier = Modifier.fillMaxSize()) {
val bitmap = imageByGesture(content, scale, drag) val bitmap = imageByGesture(content, scale, drag)
Image( Image(
asset = bitmap.asImageAsset(), bitmap = bitmap.asImageBitmap(),
contentScale = adjustImageScale(bitmap) contentScale = adjustImageScale(bitmap)
) )
} }

11
examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt

@ -4,7 +4,6 @@ import android.content.res.Configuration
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.ScrollableColumn import androidx.compose.foundation.ScrollableColumn
import androidx.compose.foundation.Text
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@ -17,17 +16,19 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.offset
import androidx.compose.material.Card
import androidx.compose.material.Divider
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar import androidx.compose.material.TopAppBar
import androidx.compose.material.Card
import androidx.compose.material.Divider
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.asImageAsset import androidx.compose.ui.graphics.asImageAsset
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import example.imageviewer.common.R import example.imageviewer.common.R
@ -146,7 +147,7 @@ fun setPreviewImageUI(content: ContentState) {
icEmpty() icEmpty()
} }
else { else {
content.getSelectedImage().asImageAsset() content.getSelectedImage().asImageBitmap()
}, },
modifier = Modifier modifier = Modifier
.fillMaxWidth().padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 5.dp), .fillMaxWidth().padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 5.dp),
@ -179,7 +180,7 @@ fun setMiniatureUI(
} }
) { ) {
Image( Image(
picture.image.asImageAsset(), picture.image.asImageBitmap(),
modifier = Modifier.preferredHeight(70.dp) modifier = Modifier.preferredHeight(70.dp)
.preferredWidth(90.dp) .preferredWidth(90.dp)
.padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 1.dp), .padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 1.dp),

3
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt

@ -49,8 +49,5 @@ private fun getFilter(type: FilterType): BitmapFilter {
FilterType.GrayScale -> GrayScaleFilter() FilterType.GrayScale -> GrayScaleFilter()
FilterType.Pixel -> PixelFilter() FilterType.Pixel -> PixelFilter()
FilterType.Blur -> BlurFilter() FilterType.Blur -> BlurFilter()
else -> {
EmptyFilter()
}
} }
} }

23
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/style/Decoration.kt

@ -1,43 +1,42 @@
package example.imageviewer.style package example.imageviewer.style
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.ImageAsset
import androidx.compose.ui.res.imageResource import androidx.compose.ui.res.imageResource
import java.awt.image.BufferedImage import java.awt.image.BufferedImage
import javax.imageio.ImageIO import javax.imageio.ImageIO
@Composable @Composable
fun icEmpty(): ImageAsset = imageResource("images/empty.png") fun icEmpty() = imageResource("images/empty.png")
@Composable @Composable
fun icBack(): ImageAsset = imageResource("images/back.png") fun icBack() = imageResource("images/back.png")
@Composable @Composable
fun icRefresh(): ImageAsset = imageResource("images/refresh.png") fun icRefresh() = imageResource("images/refresh.png")
@Composable @Composable
fun icDots(): ImageAsset = imageResource("images/dots.png") fun icDots() = imageResource("images/dots.png")
@Composable @Composable
fun icFilterGrayscaleOn(): ImageAsset = imageResource("images/grayscale_on.png") fun icFilterGrayscaleOn() = imageResource("images/grayscale_on.png")
@Composable @Composable
fun icFilterGrayscaleOff(): ImageAsset = imageResource("images/grayscale_off.png") fun icFilterGrayscaleOff() = imageResource("images/grayscale_off.png")
@Composable @Composable
fun icFilterPixelOn(): ImageAsset = imageResource("images/pixel_on.png") fun icFilterPixelOn() = imageResource("images/pixel_on.png")
@Composable @Composable
fun icFilterPixelOff(): ImageAsset = imageResource("images/pixel_off.png") fun icFilterPixelOff() = imageResource("images/pixel_off.png")
@Composable @Composable
fun icFilterBlurOn(): ImageAsset = imageResource("images/blur_on.png") fun icFilterBlurOn() = imageResource("images/blur_on.png")
@Composable @Composable
fun icFilterBlurOff(): ImageAsset = imageResource("images/blur_off.png") fun icFilterBlurOff() = imageResource("images/blur_off.png")
@Composable @Composable
fun icFilterUnknown(): ImageAsset = imageResource("images/filter_unknown.png") fun icFilterUnknown() = imageResource("images/filter_unknown.png")
private var icon: BufferedImage? = null private var icon: BufferedImage? = null
fun icAppRounded(): BufferedImage { fun icAppRounded(): BufferedImage {

19
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/FullImageScreen.kt

@ -2,10 +2,8 @@ package example.imageviewer.view
import java.awt.image.BufferedImage import java.awt.image.BufferedImage
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.ScrollableRow import androidx.compose.foundation.ScrollableRow
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.Text
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
@ -19,14 +17,15 @@ import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.foundation.layout.preferredSize import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ImageAsset import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageAsset import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -57,7 +56,6 @@ import example.imageviewer.utils.cropImage
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.pow import kotlin.math.pow
import kotlin.math.roundToInt import kotlin.math.roundToInt
import org.jetbrains.skija.Image
import org.jetbrains.skija.IRect import org.jetbrains.skija.IRect
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
import java.awt.Rectangle import java.awt.Rectangle
@ -193,15 +191,12 @@ fun FilterButton(
} }
@Composable @Composable
fun getFilterImage(type: FilterType, content: ContentState): ImageAsset { fun getFilterImage(type: FilterType, content: ContentState): ImageBitmap {
return when (type) { return when (type) {
FilterType.GrayScale -> if (content.isFilterEnabled(type)) icFilterGrayscaleOn() else icFilterGrayscaleOff() FilterType.GrayScale -> if (content.isFilterEnabled(type)) icFilterGrayscaleOn() else icFilterGrayscaleOff()
FilterType.Pixel -> if (content.isFilterEnabled(type)) icFilterPixelOn() else icFilterPixelOff() FilterType.Pixel -> if (content.isFilterEnabled(type)) icFilterPixelOn() else icFilterPixelOff()
FilterType.Blur -> if (content.isFilterEnabled(type)) icFilterBlurOn() else icFilterBlurOff() FilterType.Blur -> if (content.isFilterEnabled(type)) icFilterBlurOn() else icFilterBlurOff()
else -> {
icFilterUnknown()
}
} }
} }
@ -232,7 +227,7 @@ fun setImage(content: ContentState) {
) { ) {
val bitmap = imageByGesture(content, scale, drag) val bitmap = imageByGesture(content, scale, drag)
Image( Image(
asset = bitmap.asImageAsset(), bitmap = bitmap,
contentScale = ContentScale.Fit contentScale = ContentScale.Fit
) )
} }
@ -245,9 +240,9 @@ fun imageByGesture(
content: ContentState, content: ContentState,
scale: ScaleHandler, scale: ScaleHandler,
drag: DragHandler drag: DragHandler
): Image { ): ImageBitmap {
val bitmap = cropBitmapByScale(content.getSelectedImage(), scale.factor.value, drag) val bitmap = cropBitmapByScale(content.getSelectedImage(), scale.factor.value, drag)
return Image.makeFromEncoded(toByteArray(bitmap)) return org.jetbrains.skija.Image.makeFromEncoded(toByteArray(bitmap)).asImageBitmap()
} }
private fun cropBitmapByScale(bitmap: BufferedImage, scale: Float, drag: DragHandler): BufferedImage { private fun cropBitmapByScale(bitmap: BufferedImage, scale: Float, drag: DragHandler): BufferedImage {

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

@ -2,7 +2,6 @@ package example.imageviewer.view
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.Text
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.ScrollableColumn import androidx.compose.foundation.ScrollableColumn
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -26,13 +25,14 @@ import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.CircularProgressIndicator
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar import androidx.compose.material.TopAppBar
import androidx.compose.material.Card import androidx.compose.material.Card
import androidx.compose.material.Divider import androidx.compose.material.Divider
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.graphics.asImageAsset import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
@ -76,7 +76,6 @@ fun setMainScreen(content: ContentState) {
@Composable @Composable
private fun setLoadingScreen(content: ContentState) { private fun setLoadingScreen(content: ContentState) {
Box { Box {
Column { Column {
setTopContent(content) setTopContent(content)
@ -170,9 +169,9 @@ fun setPreviewImageUI(content: ContentState) {
Image( Image(
if (content.isMainImageEmpty()) if (content.isMainImageEmpty())
icEmpty() icEmpty()
else Image.makeFromEncoded( else org.jetbrains.skija.Image.makeFromEncoded(
toByteArray(content.getSelectedImage()) toByteArray(content.getSelectedImage())
).asImageAsset(), ).asImageBitmap(),
modifier = Modifier modifier = Modifier
.fillMaxWidth().padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 5.dp), .fillMaxWidth().padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 5.dp),
contentScale = ContentScale.Fit contentScale = ContentScale.Fit
@ -212,9 +211,9 @@ fun setMiniatureUI(
} }
) { ) {
Image( Image(
Image.makeFromEncoded( org.jetbrains.skija.Image.makeFromEncoded(
toByteArray(picture.image) toByteArray(picture.image)
).asImageAsset(), ).asImageBitmap(),
modifier = Modifier.preferredHeight(70.dp) modifier = Modifier.preferredHeight(70.dp)
.preferredWidth(90.dp) .preferredWidth(90.dp)
.padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 1.dp), .padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 1.dp),

7
examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Toast.kt

@ -1,11 +1,9 @@
package example.imageviewer.view package example.imageviewer.view
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.preferredSize import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.Text
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.onActive import androidx.compose.runtime.onActive
@ -22,6 +20,7 @@ import kotlinx.coroutines.GlobalScope
import example.imageviewer.style.ToastBackground import example.imageviewer.style.ToastBackground
import example.imageviewer.style.Foreground import example.imageviewer.style.Foreground
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.material.Text
enum class ToastDuration(val value: Int) { enum class ToastDuration(val value: Int) {
Short(1000), Long(3000) Short(1000), Long(3000)
@ -43,14 +42,14 @@ fun Toast(
isShown = true isShown = true
Box( Box(
modifier = Modifier.fillMaxSize().padding(bottom = 20.dp), modifier = Modifier.fillMaxSize().padding(bottom = 20.dp),
alignment = Alignment.BottomCenter contentAlignment = Alignment.BottomCenter
) { ) {
Surface( Surface(
modifier = Modifier.preferredSize(300.dp, 70.dp), modifier = Modifier.preferredSize(300.dp, 70.dp),
color = ToastBackground, color = ToastBackground,
shape = RoundedCornerShape(4.dp) shape = RoundedCornerShape(4.dp)
) { ) {
Box(alignment = Alignment.Center) { Box(contentAlignment = Alignment.Center) {
Text( Text(
text = text, text = text,
color = Foreground color = Foreground

6
examples/issues/build.gradle.kts

@ -8,9 +8,11 @@ buildscript {
} }
dependencies { dependencies {
classpath("org.jetbrains.compose:compose-gradle-plugin:0.1.0-m1-build62") // __LATEST_COMPOSE_RELEASE_VERSION__
classpath("org.jetbrains.compose:compose-gradle-plugin:0.2.0-build128")
classpath("com.android.tools.build:gradle:4.0.1") classpath("com.android.tools.build:gradle:4.0.1")
classpath(kotlin("gradle-plugin", version = "1.4.0")) // __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.4.20"))
} }
} }

2
examples/issues/common/src/desktopMain/kotlin/androidx/ui/examples/jetissues/common/Platform.kt

@ -12,6 +12,6 @@ actual fun SelectionContainer(children: @Composable () -> Unit) {
DesktopSelectionContainer( DesktopSelectionContainer(
selection = selection.value, selection = selection.value,
onSelectionChange = { selection.value = it }, onSelectionChange = { selection.value = it },
children = children content = children
) )
} }

2
examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt

@ -138,7 +138,7 @@ class IssuesRepositoryImpl(
} }
override fun onResponse(response: Response<IssueQuery.Data>) { override fun onResponse(response: Response<IssueQuery.Data>) {
val issue = response.data()?.repository?.issue val issue = response.data?.repository?.issue
if (issue == null) { if (issue == null) {
callback(Result.Error(UnknownIssue())) callback(Result.Error(UnknownIssue()))
} else { } else {

28
examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt

@ -14,19 +14,15 @@
package androidx.ui.examples.jetissues.view package androidx.ui.examples.jetissues.view
import androidx.compose.foundation.Box import androidx.compose.foundation.*
import androidx.compose.foundation.ContentGravity
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.ScrollableColumn
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.luminance import androidx.compose.ui.graphics.luminance
import androidx.compose.ui.layout.WithConstraints import androidx.compose.ui.layout.WithConstraints
@ -109,7 +105,7 @@ fun SingleColumnLayout(currentIssue: MutableState<IssuesQuery.Node?>) {
@Composable @Composable
fun TwoColumnsLayout(currentIssue: MutableState<IssuesQuery.Node?>) { fun TwoColumnsLayout(currentIssue: MutableState<IssuesQuery.Node?>) {
Row(Modifier.fillMaxSize()) { Row(Modifier.fillMaxSize()) {
Box(modifier = Modifier.fillMaxWidth(0.4f), alignment = Alignment.Center) { Box(modifier = Modifier.fillMaxWidth(0.4f), contentAlignment = Alignment.Center) {
IssuesList(currentIssue) IssuesList(currentIssue)
} }
CurrentIssue(currentIssue.value) CurrentIssue(currentIssue.value)
@ -138,7 +134,7 @@ fun CurrentIssue(
@Composable @Composable
fun CurrentIssueStatus(content: @Composable () -> Unit) { fun CurrentIssueStatus(content: @Composable () -> Unit) {
Box(modifier = Modifier.fillMaxSize(), gravity = ContentGravity.Center) { Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
content() content()
} }
} }
@ -218,6 +214,7 @@ fun OrderButton(order: MutableState<OrderDirection>, scroll: ScrollState) {
}) { }) {
Text("DESC") Text("DESC")
} }
else -> Error("Unknown direction")
} }
} }
@ -257,7 +254,7 @@ fun ListBody(
for (iss in it.data.nodes) { for (iss in it.data.nodes) {
Box(modifier = Modifier.clickable { Box(modifier = Modifier.clickable {
currentIssue.value = iss currentIssue.value = iss
}, alignment = Alignment.CenterStart) { }, contentAlignment = Alignment.CenterStart) {
ListItem(iss) ListItem(iss)
} }
} }
@ -342,7 +339,7 @@ fun MoreButton(issues: MutableState<UiState<Issues>>) {
var loading by remember { mutableStateOf(false) } var loading by remember { mutableStateOf(false) }
Box( Box(
gravity = ContentGravity.Center, contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxWidth().padding(10.dp) modifier = Modifier.fillMaxWidth().padding(10.dp)
) { ) {
if (loading) { if (loading) {
@ -373,9 +370,10 @@ fun Labels(labels: IssuesQuery.Labels?) {
val color = parseColor(it.color) val color = parseColor(it.color)
val textColor = if (color.luminance() > 0.5) Color.Black else Color.White val textColor = if (color.luminance() > 0.5) Color.Black else Color.White
Box( Box(
shape = RoundedCornerShape(3.dp), modifier = Modifier
modifier = Modifier.padding(3.dp), .padding(3.dp)
backgroundColor = color .background(color = color)
.clip(shape = RoundedCornerShape(3.dp))
) { ) {
Text( Text(
text = it.name, text = it.name,
@ -390,7 +388,7 @@ fun Labels(labels: IssuesQuery.Labels?) {
@Composable @Composable
fun Loader() { fun Loader() {
Box( Box(
gravity = ContentGravity.Center, contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxWidth().padding(20.dp) modifier = Modifier.fillMaxWidth().padding(20.dp)
) { ) {
CircularProgressIndicator() CircularProgressIndicator()
@ -400,7 +398,7 @@ fun Loader() {
@Composable @Composable
fun Error(err: String) { fun Error(err: String) {
Box( Box(
gravity = ContentGravity.Center, contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxWidth().padding(20.dp) modifier = Modifier.fillMaxWidth().padding(20.dp)
) { ) {
Text(text = err, style = TextStyle(color = MaterialTheme.colors.error, fontWeight = FontWeight.Bold)) Text(text = err, style = TextStyle(color = MaterialTheme.colors.error, fontWeight = FontWeight.Bold))

5
examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt

@ -2,7 +2,8 @@ object Deps {
object JetBrains { object JetBrains {
object Kotlin { object Kotlin {
private const val VERSION = "1.4.0" // __KOTLIN_COMPOSE_VERSION__
private const val VERSION = "1.4.20"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION" const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION"
const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION"
const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION"
@ -11,7 +12,7 @@ object Deps {
object Compose { object Compose {
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
private const val VERSION = "0.1.0-build113" private const val VERSION = "0.2.0-build128"
const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
} }
} }

2
examples/todoapp/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

3
gradle-plugins/build.gradle.kts

@ -1,7 +1,8 @@
import com.gradle.publish.PluginBundleExtension import com.gradle.publish.PluginBundleExtension
plugins { plugins {
kotlin("jvm") version "1.4.0" apply false // __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.4.20" apply false
id("com.gradle.plugin-publish") version "0.10.1" apply false id("com.gradle.plugin-publish") version "0.10.1" apply false
id("de.fuerstenau.buildconfig") version "1.1.8" apply false id("de.fuerstenau.buildconfig") version "1.1.8" apply false
} }

4
gradle-plugins/gradle.properties

@ -6,8 +6,8 @@ kotlin.code.style=official
# unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var. # unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var.
# #
# __LATEST_COMPOSE_RELEASE_VERSION__ # __LATEST_COMPOSE_RELEASE_VERSION__
compose.version=0.1.0-build113 compose.version=0.2.0-build128
# A version of Gradle plugin, that will be published, # A version of Gradle plugin, that will be published,
# unless overridden by COMPOSE_GRADLE_PLUGIN_VERSION env var. # unless overridden by COMPOSE_GRADLE_PLUGIN_VERSION env var.
deploy.version=0.1.0-SNAPSHOT deploy.version=0.1.0-SNAPSHOT

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

@ -2,9 +2,10 @@ import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { plugins {
kotlin("jvm") version "1.4.0" // __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.4.20"
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.1.0-build113") id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.2.0-build128")
} }
repositories { repositories {

8
templates/desktop-template/build_and_run_from_cli_example.sh

@ -19,9 +19,11 @@ function mavenDep {
} }
PLATFORM=macos PLATFORM=macos
SKIKO_VERSION=0.1.10 SKIKO_VERSION=0.1.16
KOTLIN_VERSION=1.4.0 # __KOTLIN_COMPOSE_VERSION__
COMPOSE_VERSION=0.1.0-m1-build57 KOTLIN_VERSION=1.4.20
# __LATEST_COMPOSE_RELEASE_VERSION__
COMPOSE_VERSION=0.2.0-build128
COROUTINES_VERSION=1.3.6 COROUTINES_VERSION=1.3.6
COLLECTIONS_VERSION=0.3 COLLECTIONS_VERSION=0.3
SPACE_REPO="https://packages.jetbrains.team/maven/p/ui/dev" SPACE_REPO="https://packages.jetbrains.team/maven/p/ui/dev"

2
templates/desktop-template/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

5
templates/multiplatform-template/build.gradle.kts

@ -1,6 +1,6 @@
buildscript { buildscript {
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.1.0-build113" val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.2.0-build128"
repositories { repositories {
// TODO: remove after new build is published // TODO: remove after new build is published
@ -13,7 +13,8 @@ buildscript {
dependencies { dependencies {
classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion") classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion")
classpath("com.android.tools.build:gradle:4.0.1") classpath("com.android.tools.build:gradle:4.0.1")
classpath(kotlin("gradle-plugin", version = "1.4.0")) // __KOTLIN_COMPOSE_VERSION__
classpath(kotlin("gradle-plugin", version = "1.4.20"))
} }
} }

2
templates/multiplatform-template/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

Loading…
Cancel
Save