diff --git a/examples/codeviewer/build.gradle.kts b/examples/codeviewer/build.gradle.kts index fd6b8915e8..f4ead8617a 100644 --- a/examples/codeviewer/build.gradle.kts +++ b/examples/codeviewer/build.gradle.kts @@ -9,9 +9,10 @@ buildscript { dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:0.2.0-build132") + classpath("org.jetbrains.compose:compose-gradle-plugin:0.3.0-build135") classpath("com.android.tools.build:gradle:4.0.1") - classpath(kotlin("gradle-plugin", version = "1.4.20")) + // __KOTLIN_COMPOSE_VERSION__ + classpath(kotlin("gradle-plugin", version = "1.4.21")) } } diff --git a/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/CodeViewerView.kt b/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/CodeViewerView.kt index c0ad01543f..a3f101de36 100644 --- a/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/CodeViewerView.kt +++ b/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/CodeViewerView.kt @@ -13,7 +13,7 @@ import androidx.compose.material.icons.filled.ArrowForward import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.drawLayer +import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.unit.dp import org.jetbrains.codeviewer.ui.editor.EditorEmptyView import org.jetbrains.codeviewer.ui.editor.EditorTabsView @@ -85,7 +85,7 @@ private fun ResizablePanel( val alpha = animate(if (state.isExpanded) 1f else 0f, SpringSpec(stiffness = StiffnessLow)) Box(modifier) { - Box(Modifier.fillMaxSize().drawLayer(alpha = alpha)) { + Box(Modifier.fillMaxSize().graphicsLayer(alpha = alpha)) { content() } diff --git a/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/editor/EditorView.kt b/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/editor/EditorView.kt index 8a3fd87000..a40760a15b 100644 --- a/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/editor/EditorView.kt +++ b/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/ui/editor/EditorView.kt @@ -13,13 +13,11 @@ import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.drawOpacity import androidx.compose.ui.platform.AmbientDensity import androidx.compose.ui.selection.DisableSelection -import androidx.compose.ui.text.AnnotatedString -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.annotatedString -import androidx.compose.ui.text.withStyle +import androidx.compose.ui.text.* import androidx.compose.ui.unit.dp import org.jetbrains.codeviewer.platform.SelectionContainer import org.jetbrains.codeviewer.platform.VerticalScrollbar @@ -104,7 +102,7 @@ private fun Line(modifier: Modifier, maxNum: String, line: Editor.Line, settings Row(modifier = modifier) { DisableSelection { Box { - LineNumber(maxNum, Modifier.drawOpacity(0f), settings) + LineNumber(maxNum, Modifier.alpha(0f), settings) LineNumber(line.number.toString(), Modifier.align(Alignment.CenterEnd), settings) } } @@ -133,7 +131,7 @@ private fun LineContent(content: Editor.Content, modifier: Modifier, settings: S text = if (content.isCode) { codeString(content.value.value) } else { - annotatedString { + buildAnnotatedString { withStyle(AppTheme.code.simple) { append(content.value.value) } @@ -145,7 +143,7 @@ private fun LineContent(content: Editor.Content, modifier: Modifier, settings: S softWrap = false ) -private fun codeString(str: String) = annotatedString { +private fun codeString(str: String) = buildAnnotatedString { withStyle(AppTheme.code.simple) { append(str.replace("\t", " ")) addStyle(AppTheme.code.punctuation, ":") diff --git a/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/util/LazyColumnFor.kt b/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/util/LazyColumnFor.kt index 66e9f58146..6b7548b214 100644 --- a/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/util/LazyColumnFor.kt +++ b/examples/codeviewer/common/src/commonMain/kotlin/org/jetbrains/codeviewer/util/LazyColumnFor.kt @@ -16,14 +16,14 @@ fun LazyColumnFor( modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), - horizontalGravity: Alignment.Horizontal = Alignment.Start, + horizontalAlignment: Alignment.Horizontal = Alignment.Start, itemContent: @Composable LazyItemScope.(index: Int) -> Unit ) = LazyColumnForIndexed( - UnitList(size), - modifier, - state, - contentPadding, - horizontalGravity, + items = UnitList(size), + modifier = modifier, + state = state, + contentPadding = contentPadding, + horizontalAlignment = horizontalAlignment, ) { index, _ -> itemContent(index) } diff --git a/examples/imageviewer/build.gradle.kts b/examples/imageviewer/build.gradle.kts index c18dfcd909..97168ac1e5 100755 --- a/examples/imageviewer/build.gradle.kts +++ b/examples/imageviewer/build.gradle.kts @@ -11,10 +11,10 @@ buildscript { dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:0.2.0-build132") + classpath("org.jetbrains.compose:compose-gradle-plugin:0.3.0-build135") classpath("com.android.tools.build:gradle:4.0.1") // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.4.20")) + classpath(kotlin("gradle-plugin", version = "1.4.21")) } } 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 64465f8e3a..fac05a34c9 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 @@ -200,9 +200,6 @@ fun getFilterImage(type: FilterType, content: ContentState): ImageBitmap { } } -@OptIn( - ExperimentalKeyInput::class -) @Composable fun setImage(content: ContentState) { val drag = DragHandler() diff --git a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Zoomable.kt b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Zoomable.kt index 17f3ff933f..7a7d35f9b4 100644 --- a/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Zoomable.kt +++ b/examples/imageviewer/common/src/desktopMain/kotlin/example/imageviewer/view/Zoomable.kt @@ -2,30 +2,22 @@ package example.imageviewer.view import androidx.compose.foundation.clickable import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue import androidx.compose.material.Surface import androidx.compose.runtime.remember -import androidx.compose.runtime.mutableStateOf -import androidx.compose.ui.focus -import androidx.compose.ui.focus.ExperimentalFocus -import androidx.compose.ui.focus.FocusRequester -import androidx.compose.ui.focusRequester +import androidx.compose.ui.focus.FocusReference import androidx.compose.ui.input.key.* import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.focusModifier +import androidx.compose.ui.focus.focusReference import example.imageviewer.style.Transparent -@OptIn( - ExperimentalKeyInput::class, - ExperimentalFocus::class -) @Composable fun Zoomable( onScale: ScaleHandler, modifier: Modifier = Modifier, children: @Composable() () -> Unit ) { - val focusRequester = remember { FocusRequester() } + val focusRequester = remember { FocusReference() } Surface( color = Transparent, @@ -40,8 +32,8 @@ fun Zoomable( onScale.resetFactor() } } - .focusRequester(focusRequester) - .focus() + .focusReference(focusRequester) + .focusModifier() .clickable(indication = null) { focusRequester.requestFocus() } ) { children() diff --git a/examples/issues/build.gradle.kts b/examples/issues/build.gradle.kts index a02049edea..c811d62670 100644 --- a/examples/issues/build.gradle.kts +++ b/examples/issues/build.gradle.kts @@ -9,10 +9,10 @@ buildscript { dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:0.2.0-build132") + classpath("org.jetbrains.compose:compose-gradle-plugin:0.3.0-build135") classpath("com.android.tools.build:gradle:4.0.1") // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.4.20")) + classpath(kotlin("gradle-plugin", version = "1.4.21")) } } diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index 73bc2db527..5942392f39 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -3,7 +3,7 @@ object Deps { object JetBrains { object Kotlin { // __KOTLIN_COMPOSE_VERSION__ - private const val VERSION = "1.4.20" + private const val VERSION = "1.4.21" 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" @@ -12,7 +12,7 @@ object Deps { object Compose { // __LATEST_COMPOSE_RELEASE_VERSION__ - private const val VERSION = "0.2.0-build132" + private const val VERSION = "0.3.0-build135" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } } diff --git a/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt b/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt index 80457f823c..be2d99566f 100644 --- a/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt +++ b/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt @@ -23,9 +23,8 @@ import androidx.compose.material.icons.filled.Delete import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.input.key.ExperimentalKeyInput import androidx.compose.ui.input.key.Key -import androidx.compose.ui.input.key.keyInputFilter +import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -132,7 +131,6 @@ private fun Item( } } -@OptIn(ExperimentalKeyInput::class) @Composable private fun TodoInput( text: String, @@ -142,7 +140,7 @@ private fun TodoInput( Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(8.dp)) { OutlinedTextField( value = text, - modifier = Modifier.weight(weight = 1F).keyInputFilter(onKeyUp(Key.Enter, onAddClicked)), + modifier = Modifier.weight(weight = 1F).onKeyEvent(onKeyUp(Key.Enter, onAddClicked)), onValueChange = onTextChanged, label = { Text(text = "Add a todo") } ) diff --git a/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/ShortcutHandler.kt b/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/ShortcutHandler.kt index 5e676dd484..31fcbd74e7 100644 --- a/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/ShortcutHandler.kt +++ b/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/ShortcutHandler.kt @@ -1,10 +1,8 @@ package example.todo.common.utils -import androidx.compose.ui.input.key.ExperimentalKeyInput import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.KeyEvent -@OptIn(ExperimentalKeyInput::class) fun onKeyUp(key: Key, onEvent: () -> Unit): (KeyEvent) -> Boolean = { keyEvent -> if (keyEvent.key == key) {