diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts index a3c2c288d1..22382d8490 100644 --- a/benchmarks/build.gradle.kts +++ b/benchmarks/build.gradle.kts @@ -3,10 +3,12 @@ import kotlinx.benchmark.gradle.* import org.jetbrains.kotlin.allopen.gradle.* plugins { - kotlin("jvm") version "1.4.0" + // __KOTLIN_COMPOSE_VERSION__ + kotlin("jvm") version "1.4.20" // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version "0.1.0-build113" - kotlin("plugin.allopen") version "1.4.0" + id("org.jetbrains.compose") version "0.2.0-build128" + // __KOTLIN_COMPOSE_VERSION__ + kotlin("plugin.allopen") version "1.4.20" id("kotlinx.benchmark") version "0.2.0-dev-20" } diff --git a/examples/imageviewer/build.gradle.kts b/examples/imageviewer/build.gradle.kts index a17a5db3d9..10ed616db4 100755 --- a/examples/imageviewer/build.gradle.kts +++ b/examples/imageviewer/build.gradle.kts @@ -11,9 +11,10 @@ buildscript { dependencies { // __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(kotlin("gradle-plugin", version = "1.4.0")) + // __KOTLIN_COMPOSE_VERSION__ + classpath(kotlin("gradle-plugin", version = "1.4.20")) } } diff --git a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt index 5427c63a0d..1ada647d21 100755 --- a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt +++ b/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.Pixel -> PixelFilter() FilterType.Blur -> BlurFilter(context) - else -> { - EmptyFilter() - } } } \ No newline at end of file diff --git a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/style/Decoration.kt b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/style/Decoration.kt index cea4f364b6..841fac5596 100755 --- a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/style/Decoration.kt +++ b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/style/Decoration.kt @@ -1,39 +1,38 @@ package example.imageviewer.style import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.ImageAsset import androidx.compose.ui.res.imageResource import example.imageviewer.common.R @Composable -fun icEmpty(): ImageAsset = imageResource(R.raw.empty) +fun icEmpty() = imageResource(R.raw.empty) @Composable -fun icBack(): ImageAsset = imageResource(R.raw.back) +fun icBack() = imageResource(R.raw.back) @Composable -fun icRefresh(): ImageAsset = imageResource(R.raw.refresh) +fun icRefresh() = imageResource(R.raw.refresh) @Composable -fun icDots(): ImageAsset = imageResource(R.raw.dots) +fun icDots() = imageResource(R.raw.dots) @Composable -fun icFilterGrayscaleOn(): ImageAsset = imageResource(R.raw.grayscale_on) +fun icFilterGrayscaleOn() = imageResource(R.raw.grayscale_on) @Composable -fun icFilterGrayscaleOff(): ImageAsset = imageResource(R.raw.grayscale_off) +fun icFilterGrayscaleOff() = imageResource(R.raw.grayscale_off) @Composable -fun icFilterPixelOn(): ImageAsset = imageResource(R.raw.pixel_on) +fun icFilterPixelOn() = imageResource(R.raw.pixel_on) @Composable -fun icFilterPixelOff(): ImageAsset = imageResource(R.raw.pixel_off) +fun icFilterPixelOff() = imageResource(R.raw.pixel_off) @Composable -fun icFilterBlurOn(): ImageAsset = imageResource(R.raw.blur_on) +fun icFilterBlurOn() = imageResource(R.raw.blur_on) @Composable -fun icFilterBlurOff(): ImageAsset = imageResource(R.raw.blur_off) +fun icFilterBlurOff() = imageResource(R.raw.blur_off) @Composable -fun icFilterUnknown(): ImageAsset = imageResource(R.raw.filter_unknown) +fun icFilterUnknown() = imageResource(R.raw.filter_unknown) diff --git a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt index 69641bcd97..39688107e1 100755 --- a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt +++ b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/FullImageScreen.kt @@ -1,6 +1,5 @@ package example.imageviewer.view -import android.content.res.Configuration import android.graphics.Bitmap import android.graphics.Rect import androidx.compose.foundation.background @@ -8,27 +7,25 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.draw.clip import androidx.compose.ui.Modifier -import androidx.compose.foundation.clickable import androidx.compose.foundation.ScrollableRow import androidx.compose.foundation.Image -import androidx.compose.foundation.Text import androidx.compose.foundation.shape.CircleShape import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.ImageAsset -import androidx.compose.ui.graphics.asImageAsset +import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.MaterialTheme import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.Stack import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.layout.preferredSize import androidx.compose.foundation.layout.padding import androidx.compose.material.Surface +import androidx.compose.material.Text +import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.unit.dp import example.imageviewer.core.FilterType import example.imageviewer.model.AppState @@ -161,15 +158,12 @@ fun FilterButton( } @Composable -fun getFilterImage(type: FilterType, content: ContentState): ImageAsset { +fun getFilterImage(type: FilterType, content: ContentState): ImageBitmap { return when (type) { FilterType.GrayScale -> if (content.isFilterEnabled(type)) icFilterGrayscaleOn() else icFilterGrayscaleOff() FilterType.Pixel -> if (content.isFilterEnabled(type)) icFilterPixelOn() else icFilterPixelOff() 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()) { val bitmap = imageByGesture(content, scale, drag) Image( - asset = bitmap.asImageAsset(), + bitmap = bitmap.asImageBitmap(), contentScale = adjustImageScale(bitmap) ) } diff --git a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt b/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt index c2b4cb005b..05194155fd 100755 --- a/examples/imageviewer/common/src/androidMain/kotlin/example/imageviewer/view/MainScreen.kt +++ b/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.shape.CircleShape import androidx.compose.foundation.ScrollableColumn -import androidx.compose.foundation.Text import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box 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.fillMaxWidth 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.CircularProgressIndicator import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text import androidx.compose.material.TopAppBar -import androidx.compose.material.Card -import androidx.compose.material.Divider import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.asImageAsset +import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.unit.dp import example.imageviewer.common.R @@ -146,7 +147,7 @@ fun setPreviewImageUI(content: ContentState) { icEmpty() } else { - content.getSelectedImage().asImageAsset() + content.getSelectedImage().asImageBitmap() }, modifier = Modifier .fillMaxWidth().padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 5.dp), @@ -179,7 +180,7 @@ fun setMiniatureUI( } ) { Image( - picture.image.asImageAsset(), + picture.image.asImageBitmap(), modifier = Modifier.preferredHeight(70.dp) .preferredWidth(90.dp) .padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 1.dp), diff --git a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt index dfa930497c..37fc441888 100755 --- a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/model/filtration/FiltersManager.kt +++ b/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.Pixel -> PixelFilter() FilterType.Blur -> BlurFilter() - else -> { - EmptyFilter() - } } } \ No newline at end of file diff --git a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/style/Decoration.kt b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/style/Decoration.kt index 338498ac1b..f455f3e1c1 100755 --- a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/style/Decoration.kt +++ b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/style/Decoration.kt @@ -1,43 +1,42 @@ package example.imageviewer.style import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.ImageAsset import androidx.compose.ui.res.imageResource import java.awt.image.BufferedImage import javax.imageio.ImageIO @Composable -fun icEmpty(): ImageAsset = imageResource("images/empty.png") +fun icEmpty() = imageResource("images/empty.png") @Composable -fun icBack(): ImageAsset = imageResource("images/back.png") +fun icBack() = imageResource("images/back.png") @Composable -fun icRefresh(): ImageAsset = imageResource("images/refresh.png") +fun icRefresh() = imageResource("images/refresh.png") @Composable -fun icDots(): ImageAsset = imageResource("images/dots.png") +fun icDots() = imageResource("images/dots.png") @Composable -fun icFilterGrayscaleOn(): ImageAsset = imageResource("images/grayscale_on.png") +fun icFilterGrayscaleOn() = imageResource("images/grayscale_on.png") @Composable -fun icFilterGrayscaleOff(): ImageAsset = imageResource("images/grayscale_off.png") +fun icFilterGrayscaleOff() = imageResource("images/grayscale_off.png") @Composable -fun icFilterPixelOn(): ImageAsset = imageResource("images/pixel_on.png") +fun icFilterPixelOn() = imageResource("images/pixel_on.png") @Composable -fun icFilterPixelOff(): ImageAsset = imageResource("images/pixel_off.png") +fun icFilterPixelOff() = imageResource("images/pixel_off.png") @Composable -fun icFilterBlurOn(): ImageAsset = imageResource("images/blur_on.png") +fun icFilterBlurOn() = imageResource("images/blur_on.png") @Composable -fun icFilterBlurOff(): ImageAsset = imageResource("images/blur_off.png") +fun icFilterBlurOff() = imageResource("images/blur_off.png") @Composable -fun icFilterUnknown(): ImageAsset = imageResource("images/filter_unknown.png") +fun icFilterUnknown() = imageResource("images/filter_unknown.png") private var icon: BufferedImage? = null fun icAppRounded(): BufferedImage { diff --git a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/FullImageScreen.kt b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/FullImageScreen.kt index ee97a5a53b..64465f8e3a 100755 --- a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/FullImageScreen.kt +++ b/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 androidx.compose.foundation.background -import androidx.compose.foundation.clickable import androidx.compose.foundation.ScrollableRow import androidx.compose.foundation.Image -import androidx.compose.foundation.Text import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.CircularProgressIndicator 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.padding import androidx.compose.material.Surface +import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.ImageAsset -import androidx.compose.ui.graphics.asImageAsset +import androidx.compose.ui.graphics.ImageBitmap +import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp @@ -57,7 +56,6 @@ import example.imageviewer.utils.cropImage import kotlin.math.abs import kotlin.math.pow import kotlin.math.roundToInt -import org.jetbrains.skija.Image import org.jetbrains.skija.IRect import java.awt.event.KeyEvent import java.awt.Rectangle @@ -193,15 +191,12 @@ fun FilterButton( } @Composable -fun getFilterImage(type: FilterType, content: ContentState): ImageAsset { +fun getFilterImage(type: FilterType, content: ContentState): ImageBitmap { return when (type) { FilterType.GrayScale -> if (content.isFilterEnabled(type)) icFilterGrayscaleOn() else icFilterGrayscaleOff() FilterType.Pixel -> if (content.isFilterEnabled(type)) icFilterPixelOn() else icFilterPixelOff() 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) Image( - asset = bitmap.asImageAsset(), + bitmap = bitmap, contentScale = ContentScale.Fit ) } @@ -245,9 +240,9 @@ fun imageByGesture( content: ContentState, scale: ScaleHandler, drag: DragHandler -): Image { +): ImageBitmap { 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 { diff --git a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt index b101b9da4b..e4f82dc034 100755 --- a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/MainScreen.kt +++ b/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.background -import androidx.compose.foundation.Text import androidx.compose.foundation.Image import androidx.compose.foundation.ScrollableColumn import androidx.compose.runtime.Composable @@ -26,13 +25,14 @@ import androidx.compose.foundation.VerticalScrollbar import androidx.compose.material.Surface import androidx.compose.material.CircularProgressIndicator import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text import androidx.compose.material.TopAppBar import androidx.compose.material.Card import androidx.compose.material.Divider import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember 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.RectangleShape import androidx.compose.ui.layout.ContentScale @@ -76,7 +76,6 @@ fun setMainScreen(content: ContentState) { @Composable private fun setLoadingScreen(content: ContentState) { - Box { Column { setTopContent(content) @@ -170,9 +169,9 @@ fun setPreviewImageUI(content: ContentState) { Image( if (content.isMainImageEmpty()) icEmpty() - else Image.makeFromEncoded( + else org.jetbrains.skija.Image.makeFromEncoded( toByteArray(content.getSelectedImage()) - ).asImageAsset(), + ).asImageBitmap(), modifier = Modifier .fillMaxWidth().padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 5.dp), contentScale = ContentScale.Fit @@ -212,9 +211,9 @@ fun setMiniatureUI( } ) { Image( - Image.makeFromEncoded( + org.jetbrains.skija.Image.makeFromEncoded( toByteArray(picture.image) - ).asImageAsset(), + ).asImageBitmap(), modifier = Modifier.preferredHeight(70.dp) .preferredWidth(90.dp) .padding(start = 1.dp, top = 1.dp, end = 1.dp, bottom = 1.dp), diff --git a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Toast.kt b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Toast.kt index 7f24a0d8c5..3368fa3651 100755 --- a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Toast.kt +++ b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Toast.kt @@ -1,11 +1,9 @@ package example.imageviewer.view -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.preferredSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.Text import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.onActive @@ -22,6 +20,7 @@ import kotlinx.coroutines.GlobalScope import example.imageviewer.style.ToastBackground import example.imageviewer.style.Foreground import androidx.compose.material.Surface +import androidx.compose.material.Text enum class ToastDuration(val value: Int) { Short(1000), Long(3000) @@ -43,14 +42,14 @@ fun Toast( isShown = true Box( modifier = Modifier.fillMaxSize().padding(bottom = 20.dp), - alignment = Alignment.BottomCenter + contentAlignment = Alignment.BottomCenter ) { Surface( modifier = Modifier.preferredSize(300.dp, 70.dp), color = ToastBackground, shape = RoundedCornerShape(4.dp) ) { - Box(alignment = Alignment.Center) { + Box(contentAlignment = Alignment.Center) { Text( text = text, color = Foreground diff --git a/examples/issues/build.gradle.kts b/examples/issues/build.gradle.kts index b8cdf0da82..9c87c1fc3e 100644 --- a/examples/issues/build.gradle.kts +++ b/examples/issues/build.gradle.kts @@ -8,9 +8,11 @@ buildscript { } 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(kotlin("gradle-plugin", version = "1.4.0")) + // __KOTLIN_COMPOSE_VERSION__ + classpath(kotlin("gradle-plugin", version = "1.4.20")) } } diff --git a/examples/issues/common/src/desktopMain/kotlin/androidx/ui/examples/jetissues/common/Platform.kt b/examples/issues/common/src/desktopMain/kotlin/androidx/ui/examples/jetissues/common/Platform.kt index 9ba9c4efc1..2e9d4ba018 100644 --- a/examples/issues/common/src/desktopMain/kotlin/androidx/ui/examples/jetissues/common/Platform.kt +++ b/examples/issues/common/src/desktopMain/kotlin/androidx/ui/examples/jetissues/common/Platform.kt @@ -12,6 +12,6 @@ actual fun SelectionContainer(children: @Composable () -> Unit) { DesktopSelectionContainer( selection = selection.value, onSelectionChange = { selection.value = it }, - children = children + content = children ) } \ No newline at end of file diff --git a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt index 44e878c54c..0fa4c1e033 100644 --- a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt +++ b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/IssuesRepository.kt @@ -138,7 +138,7 @@ class IssuesRepositoryImpl( } override fun onResponse(response: Response) { - val issue = response.data()?.repository?.issue + val issue = response.data?.repository?.issue if (issue == null) { callback(Result.Error(UnknownIssue())) } else { diff --git a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt index 5c7ef9dd7f..ff5a25e143 100644 --- a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt +++ b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt @@ -14,19 +14,15 @@ package androidx.ui.examples.jetissues.view -import androidx.compose.foundation.Box -import androidx.compose.foundation.ContentGravity -import androidx.compose.foundation.ScrollState -import androidx.compose.foundation.ScrollableColumn -import androidx.compose.foundation.clickable +import androidx.compose.foundation.* import androidx.compose.foundation.layout.* -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.* import androidx.compose.material.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.luminance import androidx.compose.ui.layout.WithConstraints @@ -109,7 +105,7 @@ fun SingleColumnLayout(currentIssue: MutableState) { @Composable fun TwoColumnsLayout(currentIssue: MutableState) { Row(Modifier.fillMaxSize()) { - Box(modifier = Modifier.fillMaxWidth(0.4f), alignment = Alignment.Center) { + Box(modifier = Modifier.fillMaxWidth(0.4f), contentAlignment = Alignment.Center) { IssuesList(currentIssue) } CurrentIssue(currentIssue.value) @@ -138,7 +134,7 @@ fun CurrentIssue( @Composable fun CurrentIssueStatus(content: @Composable () -> Unit) { - Box(modifier = Modifier.fillMaxSize(), gravity = ContentGravity.Center) { + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { content() } } @@ -218,6 +214,7 @@ fun OrderButton(order: MutableState, scroll: ScrollState) { }) { Text("DESC") } + else -> Error("Unknown direction") } } @@ -257,7 +254,7 @@ fun ListBody( for (iss in it.data.nodes) { Box(modifier = Modifier.clickable { currentIssue.value = iss - }, alignment = Alignment.CenterStart) { + }, contentAlignment = Alignment.CenterStart) { ListItem(iss) } } @@ -342,7 +339,7 @@ fun MoreButton(issues: MutableState>) { var loading by remember { mutableStateOf(false) } Box( - gravity = ContentGravity.Center, + contentAlignment = Alignment.Center, modifier = Modifier.fillMaxWidth().padding(10.dp) ) { if (loading) { @@ -373,9 +370,10 @@ fun Labels(labels: IssuesQuery.Labels?) { val color = parseColor(it.color) val textColor = if (color.luminance() > 0.5) Color.Black else Color.White Box( - shape = RoundedCornerShape(3.dp), - modifier = Modifier.padding(3.dp), - backgroundColor = color + modifier = Modifier + .padding(3.dp) + .background(color = color) + .clip(shape = RoundedCornerShape(3.dp)) ) { Text( text = it.name, @@ -390,7 +388,7 @@ fun Labels(labels: IssuesQuery.Labels?) { @Composable fun Loader() { Box( - gravity = ContentGravity.Center, + contentAlignment = Alignment.Center, modifier = Modifier.fillMaxWidth().padding(20.dp) ) { CircularProgressIndicator() @@ -400,7 +398,7 @@ fun Loader() { @Composable fun Error(err: String) { Box( - gravity = ContentGravity.Center, + contentAlignment = Alignment.Center, modifier = Modifier.fillMaxWidth().padding(20.dp) ) { Text(text = err, style = TextStyle(color = MaterialTheme.colors.error, fontWeight = FontWeight.Bold)) diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index 30ac0e33ba..ea062256a9 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -2,7 +2,8 @@ object Deps { object JetBrains { 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 testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" @@ -11,7 +12,7 @@ object Deps { object Compose { // __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" } } diff --git a/examples/todoapp/gradle/wrapper/gradle-wrapper.properties b/examples/todoapp/gradle/wrapper/gradle-wrapper.properties index 622ab64a3c..6c9a224775 100755 --- a/examples/todoapp/gradle/wrapper/gradle-wrapper.properties +++ b/examples/todoapp/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME 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 zipStorePath=wrapper/dists diff --git a/gradle-plugins/build.gradle.kts b/gradle-plugins/build.gradle.kts index 92ae07160a..52ce9ea8a4 100644 --- a/gradle-plugins/build.gradle.kts +++ b/gradle-plugins/build.gradle.kts @@ -1,7 +1,8 @@ import com.gradle.publish.PluginBundleExtension 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("de.fuerstenau.buildconfig") version "1.1.8" apply false } diff --git a/gradle-plugins/gradle.properties b/gradle-plugins/gradle.properties index 23cf8d3002..a2166c9f39 100644 --- a/gradle-plugins/gradle.properties +++ b/gradle-plugins/gradle.properties @@ -6,8 +6,8 @@ kotlin.code.style=official # unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var. # # __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, # unless overridden by COMPOSE_GRADLE_PLUGIN_VERSION env var. -deploy.version=0.1.0-SNAPSHOT \ No newline at end of file +deploy.version=0.1.0-SNAPSHOT diff --git a/templates/desktop-template/build.gradle.kts b/templates/desktop-template/build.gradle.kts index 86f608cbbf..933b92bec5 100644 --- a/templates/desktop-template/build.gradle.kts +++ b/templates/desktop-template/build.gradle.kts @@ -2,9 +2,10 @@ import org.jetbrains.compose.compose import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { - kotlin("jvm") version "1.4.0" + // __KOTLIN_COMPOSE_VERSION__ + kotlin("jvm") version "1.4.20" // __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 { diff --git a/templates/desktop-template/build_and_run_from_cli_example.sh b/templates/desktop-template/build_and_run_from_cli_example.sh index 3d908f4c45..d8eb66f2fc 100644 --- a/templates/desktop-template/build_and_run_from_cli_example.sh +++ b/templates/desktop-template/build_and_run_from_cli_example.sh @@ -19,9 +19,11 @@ function mavenDep { } PLATFORM=macos -SKIKO_VERSION=0.1.10 -KOTLIN_VERSION=1.4.0 -COMPOSE_VERSION=0.1.0-m1-build57 +SKIKO_VERSION=0.1.16 +# __KOTLIN_COMPOSE_VERSION__ +KOTLIN_VERSION=1.4.20 +# __LATEST_COMPOSE_RELEASE_VERSION__ +COMPOSE_VERSION=0.2.0-build128 COROUTINES_VERSION=1.3.6 COLLECTIONS_VERSION=0.3 SPACE_REPO="https://packages.jetbrains.team/maven/p/ui/dev" diff --git a/templates/desktop-template/gradle/wrapper/gradle-wrapper.properties b/templates/desktop-template/gradle/wrapper/gradle-wrapper.properties index ac33e9944a..bca17f3656 100644 --- a/templates/desktop-template/gradle/wrapper/gradle-wrapper.properties +++ b/templates/desktop-template/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME 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 zipStorePath=wrapper/dists diff --git a/templates/multiplatform-template/build.gradle.kts b/templates/multiplatform-template/build.gradle.kts index beb2848381..ffd5270dd4 100644 --- a/templates/multiplatform-template/build.gradle.kts +++ b/templates/multiplatform-template/build.gradle.kts @@ -1,6 +1,6 @@ buildscript { // __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 { // TODO: remove after new build is published @@ -13,7 +13,8 @@ buildscript { dependencies { classpath("org.jetbrains.compose:compose-gradle-plugin:$composeVersion") 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")) } } diff --git a/templates/multiplatform-template/gradle/wrapper/gradle-wrapper.properties b/templates/multiplatform-template/gradle/wrapper/gradle-wrapper.properties index ac33e9944a..bca17f3656 100644 --- a/templates/multiplatform-template/gradle/wrapper/gradle-wrapper.properties +++ b/templates/multiplatform-template/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME 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 zipStorePath=wrapper/dists