mirror of
https://github.com/jlengrand/compose-multiplatform.git
synced 2026-03-10 08:11:20 +00:00
iMove to 0.3.0-build135 and Kotlin 1.4.21.
This commit is contained in:
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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, ":")
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,9 +200,6 @@ fun getFilterImage(type: FilterType, content: ContentState): ImageBitmap {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(
|
||||
ExperimentalKeyInput::class
|
||||
)
|
||||
@Composable
|
||||
fun setImage(content: ContentState) {
|
||||
val drag = DragHandler()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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") }
|
||||
)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user