From 1999f58e75fe4b7c2fc3686e1392061f0bad276b Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Mon, 1 Mar 2021 09:37:24 +0300 Subject: [PATCH] Move to build 0.3.1. --- ci/compose-uber-jar/gradle.properties | 2 +- .../jetbrains/compose/splitpane/SplitPane.kt | 230 +++++------ .../compose/splitpane/SplitPaneDSL.kt | 377 +++++++++--------- .../compose/splitpane/SplitPaneState.kt | 9 +- .../compose/videoplayer/DesktopVideoPlayer.kt | 6 +- components/build.gradle.kts | 2 +- examples/codeviewer/common/build.gradle.kts | 2 +- examples/imageviewer/common/build.gradle.kts | 2 +- examples/intelliJPlugin/build.gradle.kts | 2 +- examples/issues/common/build.gradle.kts | 2 +- .../buildSrc/buildSrc/src/main/kotlin/Deps.kt | 4 +- .../multiplatform-compose-setup.gradle.kts | 2 +- .../widgetsgallery/common/build.gradle.kts | 2 +- gradle-plugins/gradle.properties | 2 +- templates/desktop-template/build.gradle.kts | 2 +- .../multiplatform-template/build.gradle.kts | 2 +- .../common/build.gradle.kts | 2 +- tools/replace.sh | 12 +- 18 files changed, 333 insertions(+), 329 deletions(-) diff --git a/ci/compose-uber-jar/gradle.properties b/ci/compose-uber-jar/gradle.properties index f78b69edb6..794713360a 100644 --- a/ci/compose-uber-jar/gradle.properties +++ b/ci/compose-uber-jar/gradle.properties @@ -1,3 +1,3 @@ # __LATEST_COMPOSE_RELEASE_VERSION__ -compose.version=0.3.0 +compose.version=0.3.1 kotlin.code.style=official diff --git a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPane.kt b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPane.kt index cdbce9d31b..e660cdced8 100644 --- a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPane.kt +++ b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPane.kt @@ -1,116 +1,116 @@ -package org.jetbrains.compose.splitpane - -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp - -internal data class MinimalSizes( - val firstPlaceableMinimalSize: Dp, - val secondPlaceableMinimalSize: Dp -) - -/** - * Pane that place it parts **vertically** from top to bottom and allows to change items **heights**. - * The [content] block defines DSL which allow you to configure top ([SplitPaneScope.first]), - * bottom ([SplitPaneScope.second]). - * - * @param modifier the modifier to apply to this layout - * @param splitPaneState the state object to be used to control or observe the split pane state - * @param content a block which describes the content. Inside this block you can use methods like - * [SplitPaneScope.first], [SplitPaneScope.second], to describe parts of split pane. - */ -@ExperimentalSplitPaneApi -@Composable -fun VerticalSplitPane( - modifier: Modifier = Modifier, - splitPaneState: SplitPaneState = rememberSplitPaneState(), - content: SplitPaneScope.() -> Unit -) { - with(SplitPaneScopeImpl(isHorizontal = false, splitPaneState).apply(content)) { - if (firstPlaceableContent != null && secondPlaceableContent != null) { - SplitPane( - modifier = modifier, - isHorizontal = false, - splitPaneState = splitPaneState, - minimalSizesConfiguration = minimalSizes, - first = firstPlaceableContent!!, - second = secondPlaceableContent!!, - splitter = splitter - ) - } else { - firstPlaceableContent?.invoke() - secondPlaceableContent?.invoke() - } - } -} - -/** - * Pane that place it parts **horizontally** from left to right and allows to change items **width**. - * The [content] block defines DSL which allow you to configure left ([SplitPaneScope.first]), - * right ([SplitPaneScope.second]) parts of split pane. - * - * @param modifier the modifier to apply to this layout - * @param splitPaneState the state object to be used to control or observe the split pane state - * @param content a block which describes the content. Inside this block you can use methods like - * [SplitPaneScope.first], [SplitPaneScope.second], to describe parts of split pane. - */ -@ExperimentalSplitPaneApi -@Composable -fun HorizontalSplitPane( - modifier: Modifier = Modifier, - splitPaneState: SplitPaneState = rememberSplitPaneState(), - content: SplitPaneScope.() -> Unit -) { - with(SplitPaneScopeImpl(isHorizontal = true, splitPaneState).apply(content)) { - if (firstPlaceableContent != null && secondPlaceableContent != null) { - SplitPane( - modifier = modifier, - isHorizontal = true, - splitPaneState = splitPaneState, - minimalSizesConfiguration = minimalSizes, - first = firstPlaceableContent!!, - second = secondPlaceableContent!!, - splitter = splitter - ) - } else { - firstPlaceableContent?.invoke() - secondPlaceableContent?.invoke() - } - } - -} - -/** - * Internal implementation of default splitter - * - * @param isHorizontal describes is it horizontal or vertical split pane - * @param splitPaneState the state object to be used to control or observe the split pane state - */ -@OptIn(ExperimentalSplitPaneApi::class) -internal expect fun defaultSplitter( - isHorizontal: Boolean, - splitPaneState: SplitPaneState -): Splitter - -/** - * Internal implementation of split pane that used in all public composable functions - * - * @param modifier the modifier to apply to this layout - * @param isHorizontal describes is it horizontal of vertical split pane - * @param splitPaneState the state object to be used to control or observe the split pane state - * @param minimalSizesConfiguration data class ([MinimalSizes]) that provides minimal size for split pane parts - * @param first first part of split pane, left or top according to [isHorizontal] - * @param second second part of split pane, right or bottom according to [isHorizontal] - * @param splitter separator composable, by default [Splitter] is used - * */ -@Composable -internal expect fun SplitPane( - modifier: Modifier = Modifier, - isHorizontal: Boolean = true, - splitPaneState: SplitPaneState, - minimalSizesConfiguration: MinimalSizes = MinimalSizes(0.dp, 0.dp), - first: @Composable () -> Unit, - second: @Composable () -> Unit, - splitter: Splitter +package org.jetbrains.compose.splitpane + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp + +internal data class MinimalSizes( + val firstPlaceableMinimalSize: Dp, + val secondPlaceableMinimalSize: Dp +) + +/** + * Pane that place it parts **vertically** from top to bottom and allows to change items **heights**. + * The [content] block defines DSL which allow you to configure top ([SplitPaneScope.first]), + * bottom ([SplitPaneScope.second]). + * + * @param modifier the modifier to apply to this layout + * @param splitPaneState the state object to be used to control or observe the split pane state + * @param content a block which describes the content. Inside this block you can use methods like + * [SplitPaneScope.first], [SplitPaneScope.second], to describe parts of split pane. + */ +@ExperimentalSplitPaneApi +@Composable +fun VerticalSplitPane( + modifier: Modifier = Modifier, + splitPaneState: SplitPaneState = rememberSplitPaneState(), + content: SplitPaneScope.() -> Unit +) { + with(SplitPaneScopeImpl(isHorizontal = false, splitPaneState).apply(content)) { + if (firstPlaceableContent != null && secondPlaceableContent != null) { + SplitPane( + modifier = modifier, + isHorizontal = false, + splitPaneState = splitPaneState, + minimalSizesConfiguration = minimalSizes, + first = firstPlaceableContent!!, + second = secondPlaceableContent!!, + splitter = splitter + ) + } else { + firstPlaceableContent?.invoke() + secondPlaceableContent?.invoke() + } + } +} + +/** + * Pane that place it parts **horizontally** from left to right and allows to change items **width**. + * The [content] block defines DSL which allow you to configure left ([SplitPaneScope.first]), + * right ([SplitPaneScope.second]) parts of split pane. + * + * @param modifier the modifier to apply to this layout + * @param splitPaneState the state object to be used to control or observe the split pane state + * @param content a block which describes the content. Inside this block you can use methods like + * [SplitPaneScope.first], [SplitPaneScope.second], to describe parts of split pane. + */ +@ExperimentalSplitPaneApi +@Composable +fun HorizontalSplitPane( + modifier: Modifier = Modifier, + splitPaneState: SplitPaneState = rememberSplitPaneState(), + content: SplitPaneScope.() -> Unit +) { + with(SplitPaneScopeImpl(isHorizontal = true, splitPaneState).apply(content)) { + if (firstPlaceableContent != null && secondPlaceableContent != null) { + SplitPane( + modifier = modifier, + isHorizontal = true, + splitPaneState = splitPaneState, + minimalSizesConfiguration = minimalSizes, + first = firstPlaceableContent!!, + second = secondPlaceableContent!!, + splitter = splitter + ) + } else { + firstPlaceableContent?.invoke() + secondPlaceableContent?.invoke() + } + } + +} + +/** + * Internal implementation of default splitter + * + * @param isHorizontal describes is it horizontal or vertical split pane + * @param splitPaneState the state object to be used to control or observe the split pane state + */ +@OptIn(ExperimentalSplitPaneApi::class) +internal expect fun defaultSplitter( + isHorizontal: Boolean, + splitPaneState: SplitPaneState +): Splitter + +/** + * Internal implementation of split pane that used in all public composable functions + * + * @param modifier the modifier to apply to this layout + * @param isHorizontal describes is it horizontal of vertical split pane + * @param splitPaneState the state object to be used to control or observe the split pane state + * @param minimalSizesConfiguration data class ([MinimalSizes]) that provides minimal size for split pane parts + * @param first first part of split pane, left or top according to [isHorizontal] + * @param second second part of split pane, right or bottom according to [isHorizontal] + * @param splitter separator composable, by default [Splitter] is used + * */ +@Composable +internal expect fun SplitPane( + modifier: Modifier = Modifier, + isHorizontal: Boolean = true, + splitPaneState: SplitPaneState, + minimalSizesConfiguration: MinimalSizes = MinimalSizes(0.dp, 0.dp), + first: @Composable () -> Unit, + second: @Composable () -> Unit, + splitter: Splitter ) \ No newline at end of file diff --git a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt index 481e920c0c..5cc3c007ba 100644 --- a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt +++ b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneDSL.kt @@ -1,191 +1,188 @@ -package org.jetbrains.compose.splitpane - -import androidx.compose.foundation.InteractionState -import androidx.compose.foundation.gestures.detectDragGestures -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.Modifier -import androidx.compose.ui.input.pointer.consumeAllChanges -import androidx.compose.ui.input.pointer.pointerInput -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp - -/** Receiver scope which is used by [HorizontalSplitPane] and [VerticalSplitPane] */ -@ExperimentalSplitPaneApi -interface SplitPaneScope { - - /** - * Set up first composable item if SplitPane, for [HorizontalSplitPane] it will be - * Right part, for [VerticalSplitPane] it will be Top part - * @param minSize a minimal size of composable item. - * For [HorizontalSplitPane] it will be minimal width, for [VerticalSplitPane] it wil be minimal Heights. - * In this context minimal mean that this composable item could not be smaller than specified value. - * @param content composable item content. - * */ - fun first( - minSize: Dp = 0.dp, - content: @Composable () -> Unit - ) - - /** - * Set up second composable item if SplitPane. - * For [HorizontalSplitPane] it will be Left part, for [VerticalSplitPane] it will be Bottom part - * @param minSize a minimal size of composable item. - * For [HorizontalSplitPane] it will be minimal width, for [VerticalSplitPane] it wil be minimal Heights. - * In this context minimal mean that this composable item could not be smaller than specified value. - * @param content composable item content. - * */ - fun second( - minSize: Dp = 0.dp, - content: @Composable () -> Unit - ) - - fun splitter(block: SplitterScope.() -> Unit) - -} - -/** Receiver scope which is used by [SplitterScope] */ -@ExperimentalSplitPaneApi -interface HandleScope { - /** allow mark composable as movable handle */ - fun Modifier.markAsHandle(): Modifier -} - -/** Receiver scope which is used by [SplitPaneScope] */ -@ExperimentalSplitPaneApi -interface SplitterScope { - /** - * Set up visible part of splitter. This part will be measured and placed between split pane - * parts (first and second) - * - * @param content composable item content - * */ - fun visiblePart(content: @Composable () -> Unit) - - /** - * Set up handle part, this part of splitter would be measured and placed above [visiblePart] content. - * Size of handle will have no effect on split pane parts (first and second) sizes. - * - * @param alignment alignment of handle according to [visiblePart] could be: - * * [SplitterHandleAlignment.BEFORE] if you place handle before [visiblePart], - * * [SplitterHandleAlignment.ABOVE] if you place handle above [visiblePart] (will be centered) - * * and [SplitterHandleAlignment.AFTER] if you place handle after [visiblePart]. - * - * @param content composable item content provider. Uses [HandleScope] to allow mark any provided composable part - * as handle. - * [content] will be placed only if [SplitPaneState.moveEnabled] is true - */ - fun handle( - alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE, - content: @Composable HandleScope.() -> Unit - ) -} - -@OptIn(ExperimentalSplitPaneApi::class) -internal class HandleScopeImpl( - private val containerScope: SplitPaneScopeImpl -) : HandleScope { - override fun Modifier.markAsHandle(): Modifier = this.pointerInput(containerScope.splitPaneState) { - detectDragGestures { change, _ -> - change.consumeAllChanges() - containerScope.splitPaneState.dispatchRawMovement( - if (containerScope.isHorizontal) change.position.x else change.position.y - ) - } - } -} - -@OptIn(ExperimentalSplitPaneApi::class) -internal class SplitterScopeImpl( - private val containerScope: SplitPaneScopeImpl -) : SplitterScope { - - override fun visiblePart(content: @Composable () -> Unit) { - containerScope.visiblePart = content - } - - override fun handle( - alignment: SplitterHandleAlignment, - content: @Composable HandleScope.() -> Unit - ) { - containerScope.handle = { HandleScopeImpl(containerScope).content() } - containerScope.alignment = alignment - } -} - -private typealias ComposableSlot = @Composable () -> Unit - -@OptIn(ExperimentalSplitPaneApi::class) -internal class SplitPaneScopeImpl( - internal val isHorizontal: Boolean, - internal val splitPaneState: SplitPaneState -) : SplitPaneScope { - - private var firstPlaceableMinimalSize: Dp = 0.dp - private var secondPlaceableMinimalSize: Dp = 0.dp - - internal val minimalSizes: MinimalSizes - get() = MinimalSizes(firstPlaceableMinimalSize, secondPlaceableMinimalSize) - - internal var firstPlaceableContent: ComposableSlot? = null - private set - internal var secondPlaceableContent: ComposableSlot? = null - private set - - internal lateinit var visiblePart: ComposableSlot - internal lateinit var handle: ComposableSlot - internal var alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE - internal val splitter - get() = - if (this::visiblePart.isInitialized && this::handle.isInitialized) { - Splitter(visiblePart, handle, alignment) - } else { - defaultSplitter(isHorizontal, splitPaneState) - } - - override fun first( - minSize: Dp, - content: @Composable () -> Unit - ) { - firstPlaceableMinimalSize = minSize - firstPlaceableContent = content - } - - override fun second( - minSize: Dp, - content: @Composable () -> Unit - ) { - secondPlaceableMinimalSize = minSize - secondPlaceableContent = content - } - - override fun splitter(block: SplitterScope.() -> Unit) { - SplitterScopeImpl(this).block() - } -} - -/** - * creates a [SplitPaneState] and remembers it across composition - * - * Changes to the provided initial values will **not** result in the state being recreated or - * changed in any way if it has already been created. - * - * @param initialPositionPercentage the initial value for [SplitPaneState.positionPercentage] - * @param moveEnabled the initial value for [SplitPaneState.moveEnabled] - * @param interactionState the initial value for [SplitPaneState.interactionState] - * */ -@ExperimentalSplitPaneApi -@Composable -fun rememberSplitPaneState( - initialPositionPercentage: Float = 0f, - moveEnabled: Boolean = true, - interactionState: InteractionState = remember { InteractionState() } -): SplitPaneState { - return remember { - SplitPaneState( - moveEnabled = moveEnabled, - initialPositionPercentage = initialPositionPercentage, - interactionState = interactionState - ) - } +package org.jetbrains.compose.splitpane + +import androidx.compose.foundation.gestures.detectDragGestures +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.pointer.consumeAllChanges +import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp + +/** Receiver scope which is used by [HorizontalSplitPane] and [VerticalSplitPane] */ +@ExperimentalSplitPaneApi +interface SplitPaneScope { + + /** + * Set up first composable item if SplitPane, for [HorizontalSplitPane] it will be + * Right part, for [VerticalSplitPane] it will be Top part + * @param minSize a minimal size of composable item. + * For [HorizontalSplitPane] it will be minimal width, for [VerticalSplitPane] it wil be minimal Heights. + * In this context minimal mean that this composable item could not be smaller than specified value. + * @param content composable item content. + * */ + fun first( + minSize: Dp = 0.dp, + content: @Composable () -> Unit + ) + + /** + * Set up second composable item if SplitPane. + * For [HorizontalSplitPane] it will be Left part, for [VerticalSplitPane] it will be Bottom part + * @param minSize a minimal size of composable item. + * For [HorizontalSplitPane] it will be minimal width, for [VerticalSplitPane] it wil be minimal Heights. + * In this context minimal mean that this composable item could not be smaller than specified value. + * @param content composable item content. + * */ + fun second( + minSize: Dp = 0.dp, + content: @Composable () -> Unit + ) + + fun splitter(block: SplitterScope.() -> Unit) + +} + +/** Receiver scope which is used by [SplitterScope] */ +@ExperimentalSplitPaneApi +interface HandleScope { + /** allow mark composable as movable handle */ + fun Modifier.markAsHandle(): Modifier +} + +/** Receiver scope which is used by [SplitPaneScope] */ +@ExperimentalSplitPaneApi +interface SplitterScope { + /** + * Set up visible part of splitter. This part will be measured and placed between split pane + * parts (first and second) + * + * @param content composable item content + * */ + fun visiblePart(content: @Composable () -> Unit) + + /** + * Set up handle part, this part of splitter would be measured and placed above [visiblePart] content. + * Size of handle will have no effect on split pane parts (first and second) sizes. + * + * @param alignment alignment of handle according to [visiblePart] could be: + * * [SplitterHandleAlignment.BEFORE] if you place handle before [visiblePart], + * * [SplitterHandleAlignment.ABOVE] if you place handle above [visiblePart] (will be centered) + * * and [SplitterHandleAlignment.AFTER] if you place handle after [visiblePart]. + * + * @param content composable item content provider. Uses [HandleScope] to allow mark any provided composable part + * as handle. + * [content] will be placed only if [SplitPaneState.moveEnabled] is true + */ + fun handle( + alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE, + content: @Composable HandleScope.() -> Unit + ) +} + +@OptIn(ExperimentalSplitPaneApi::class) +internal class HandleScopeImpl( + private val containerScope: SplitPaneScopeImpl +) : HandleScope { + override fun Modifier.markAsHandle(): Modifier = this.pointerInput(containerScope.splitPaneState) { + detectDragGestures { change, _ -> + change.consumeAllChanges() + containerScope.splitPaneState.dispatchRawMovement( + if (containerScope.isHorizontal) change.position.x else change.position.y + ) + } + } +} + +@OptIn(ExperimentalSplitPaneApi::class) +internal class SplitterScopeImpl( + private val containerScope: SplitPaneScopeImpl +) : SplitterScope { + + override fun visiblePart(content: @Composable () -> Unit) { + containerScope.visiblePart = content + } + + override fun handle( + alignment: SplitterHandleAlignment, + content: @Composable HandleScope.() -> Unit + ) { + containerScope.handle = { HandleScopeImpl(containerScope).content() } + containerScope.alignment = alignment + } +} + +private typealias ComposableSlot = @Composable () -> Unit + +@OptIn(ExperimentalSplitPaneApi::class) +internal class SplitPaneScopeImpl( + internal val isHorizontal: Boolean, + internal val splitPaneState: SplitPaneState +) : SplitPaneScope { + + private var firstPlaceableMinimalSize: Dp = 0.dp + private var secondPlaceableMinimalSize: Dp = 0.dp + + internal val minimalSizes: MinimalSizes + get() = MinimalSizes(firstPlaceableMinimalSize, secondPlaceableMinimalSize) + + internal var firstPlaceableContent: ComposableSlot? = null + private set + internal var secondPlaceableContent: ComposableSlot? = null + private set + + internal lateinit var visiblePart: ComposableSlot + internal lateinit var handle: ComposableSlot + internal var alignment: SplitterHandleAlignment = SplitterHandleAlignment.ABOVE + internal val splitter + get() = + if (this::visiblePart.isInitialized && this::handle.isInitialized) { + Splitter(visiblePart, handle, alignment) + } else { + defaultSplitter(isHorizontal, splitPaneState) + } + + override fun first( + minSize: Dp, + content: @Composable () -> Unit + ) { + firstPlaceableMinimalSize = minSize + firstPlaceableContent = content + } + + override fun second( + minSize: Dp, + content: @Composable () -> Unit + ) { + secondPlaceableMinimalSize = minSize + secondPlaceableContent = content + } + + override fun splitter(block: SplitterScope.() -> Unit) { + SplitterScopeImpl(this).block() + } +} + +/** + * creates a [SplitPaneState] and remembers it across composition + * + * Changes to the provided initial values will **not** result in the state being recreated or + * changed in any way if it has already been created. + * + * @param initialPositionPercentage the initial value for [SplitPaneState.positionPercentage] + * @param moveEnabled the initial value for [SplitPaneState.moveEnabled] + * @param interactionState the initial value for [SplitPaneState.interactionState] + * */ +@ExperimentalSplitPaneApi +@Composable +fun rememberSplitPaneState( + initialPositionPercentage: Float = 0f, + moveEnabled: Boolean = true +): SplitPaneState { + return remember { + SplitPaneState( + moveEnabled = moveEnabled, + initialPositionPercentage = initialPositionPercentage + ) + } } \ No newline at end of file diff --git a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneState.kt b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneState.kt index 772d91a982..53101cca3c 100644 --- a/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneState.kt +++ b/components/SplitPane/common/src/commonMain/kotlin/org/jetbrains/compose/splitpane/SplitPaneState.kt @@ -1,7 +1,9 @@ package org.jetbrains.compose.splitpane -import androidx.compose.foundation.Interaction -import androidx.compose.foundation.InteractionState +import androidx.compose.foundation.interaction.Interaction +import androidx.compose.foundation.interaction.InteractionSource +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.interaction.collectIsDraggedAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue @@ -10,7 +12,6 @@ import androidx.compose.runtime.setValue class SplitPaneState( initialPositionPercentage: Float, moveEnabled: Boolean, - private val interactionState: InteractionState ) { var moveEnabled by mutableStateOf(moveEnabled) @@ -24,13 +25,11 @@ class SplitPaneState( internal var maxPosition: Float = Float.POSITIVE_INFINITY fun dispatchRawMovement(delta: Float) { - interactionState.addInteraction(Interaction.Dragged) val movableArea = maxPosition - minPosition if (movableArea > 0) { positionPercentage = ((movableArea * positionPercentage) + delta).coerceIn(minPosition, maxPosition) / movableArea } - interactionState.removeInteraction(Interaction.Dragged) } } \ No newline at end of file diff --git a/components/VideoPlayer/common/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt b/components/VideoPlayer/common/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt index fec7134aa2..a37953b5de 100644 --- a/components/VideoPlayer/common/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt +++ b/components/VideoPlayer/common/src/desktopMain/kotlin/org/jetbrains/compose/videoplayer/DesktopVideoPlayer.kt @@ -4,6 +4,8 @@ import androidx.compose.desktop.SwingPanel import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCompositionContext import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import uk.co.caprica.vlcj.factory.discovery.NativeDiscovery @@ -14,7 +16,7 @@ internal actual fun VideoPlayerImpl(url: String, width: Int, height: Int) { println("Video player for $url") NativeDiscovery().discover() // Doesn't work on macOS, see https://github.com/caprica/vlcj/issues/887 for suggestions. - val mediaPlayerComponent = EmbeddedMediaPlayerComponent() + val mediaPlayerComponent = remember { EmbeddedMediaPlayerComponent() } SideEffect { val ok = mediaPlayerComponent.mediaPlayer().media().play(url) println("play gave $ok") @@ -22,7 +24,7 @@ internal actual fun VideoPlayerImpl(url: String, width: Int, height: Int) { return SwingPanel( background = Color.Transparent, modifier = Modifier.fillMaxSize(), - componentBlock = { + factory = { mediaPlayerComponent } ) diff --git a/components/build.gradle.kts b/components/build.gradle.kts index e667db4be6..41ad0fa991 100644 --- a/components/build.gradle.kts +++ b/components/build.gradle.kts @@ -1,6 +1,6 @@ buildscript { // __LATEST_COMPOSE_RELEASE_VERSION__ - val composeVersion = System.getenv("COMPOSE_RELEASE_VERSION") ?: "0.3.0-build150" + val composeVersion = System.getenv("COMPOSE_RELEASE_VERSION") ?: "0.3.1" repositories { google() diff --git a/examples/codeviewer/common/build.gradle.kts b/examples/codeviewer/common/build.gradle.kts index f14bbb300b..1d30687a8e 100644 --- a/examples/codeviewer/common/build.gradle.kts +++ b/examples/codeviewer/common/build.gradle.kts @@ -22,7 +22,7 @@ kotlin { named("androidMain") { kotlin.srcDirs("src/jvmMain/kotlin") dependencies { - api("androidx.appcompat:appcompat:1.1.0") + api("androidx.appcompat:appcompat:1.3.0-beta01") api("androidx.core:core-ktx:1.3.1") } } diff --git a/examples/imageviewer/common/build.gradle.kts b/examples/imageviewer/common/build.gradle.kts index a788a938e6..f1f3c97bfa 100755 --- a/examples/imageviewer/common/build.gradle.kts +++ b/examples/imageviewer/common/build.gradle.kts @@ -20,7 +20,7 @@ kotlin { } named("androidMain") { dependencies { - api("androidx.appcompat:appcompat:1.1.0") + api("androidx.appcompat:appcompat:1.3.0-beta01") api("androidx.core:core-ktx:1.3.1") implementation("io.ktor:ktor-client-cio:1.4.1") } diff --git a/examples/intelliJPlugin/build.gradle.kts b/examples/intelliJPlugin/build.gradle.kts index 181c0bb0f7..b98f913752 100644 --- a/examples/intelliJPlugin/build.gradle.kts +++ b/examples/intelliJPlugin/build.gradle.kts @@ -5,7 +5,7 @@ plugins { java kotlin("jvm") version "1.4.30" // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version "0.3.0" + id("org.jetbrains.compose") version "0.3.1" } group = "org.example" diff --git a/examples/issues/common/build.gradle.kts b/examples/issues/common/build.gradle.kts index 5211da54b5..75f08c4629 100644 --- a/examples/issues/common/build.gradle.kts +++ b/examples/issues/common/build.gradle.kts @@ -24,7 +24,7 @@ kotlin { named("androidMain") { kotlin.srcDirs("src/jvmAndAndroidMain/kotlin") dependencies { - api("androidx.appcompat:appcompat:1.1.0") + api("androidx.appcompat:appcompat:1.3.0-beta01") api("androidx.core:core-ktx:1.3.1") } } diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index bdefd86ead..3d8d3b560b 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -12,7 +12,7 @@ object Deps { object Compose { // __LATEST_COMPOSE_RELEASE_VERSION__ - private const val VERSION = "0.4.0-build168" + private const val VERSION = "0.3.1" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } } @@ -27,7 +27,7 @@ object Deps { object AndroidX { object AppCompat { - const val appCompat = "androidx.appcompat:appcompat:1.1.0" + const val appCompat = "androidx.appcompat:appcompat:1.3.0-beta01" } object Activity { diff --git a/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts b/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts index 8904aa7196..7d007fdfd3 100644 --- a/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts +++ b/examples/todoapp/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts @@ -21,7 +21,7 @@ kotlin { named("androidMain") { dependencies { - implementation("androidx.appcompat:appcompat:1.1.0") + implementation("androidx.appcompat:appcompat:1.3.0-beta01") implementation("androidx.core:core-ktx:1.3.1") } } diff --git a/examples/widgetsgallery/common/build.gradle.kts b/examples/widgetsgallery/common/build.gradle.kts index f14bbb300b..1d30687a8e 100644 --- a/examples/widgetsgallery/common/build.gradle.kts +++ b/examples/widgetsgallery/common/build.gradle.kts @@ -22,7 +22,7 @@ kotlin { named("androidMain") { kotlin.srcDirs("src/jvmMain/kotlin") dependencies { - api("androidx.appcompat:appcompat:1.1.0") + api("androidx.appcompat:appcompat:1.3.0-beta01") api("androidx.core:core-ktx:1.3.1") } } diff --git a/gradle-plugins/gradle.properties b/gradle-plugins/gradle.properties index 85e57f7835..cc8434904a 100644 --- a/gradle-plugins/gradle.properties +++ b/gradle-plugins/gradle.properties @@ -6,7 +6,7 @@ kotlin.code.style=official # unless overridden by COMPOSE_GRADLE_PLUGIN_COMPOSE_VERSION env var. # # __LATEST_COMPOSE_RELEASE_VERSION__ -compose.version=0.3.0 +compose.version=0.3.1 # A version of Gradle plugin, that will be published, # unless overridden by COMPOSE_GRADLE_PLUGIN_VERSION env var. diff --git a/templates/desktop-template/build.gradle.kts b/templates/desktop-template/build.gradle.kts index c81a78a765..328f86d0a6 100644 --- a/templates/desktop-template/build.gradle.kts +++ b/templates/desktop-template/build.gradle.kts @@ -5,7 +5,7 @@ plugins { // __KOTLIN_COMPOSE_VERSION__ kotlin("jvm") version "1.4.30" // __LATEST_COMPOSE_RELEASE_VERSION__ - id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.3.0") + id("org.jetbrains.compose") version (System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.3.1") } repositories { diff --git a/templates/multiplatform-template/build.gradle.kts b/templates/multiplatform-template/build.gradle.kts index d6fd8b08cf..6cee40b9a9 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.3.0" + val composeVersion = System.getenv("COMPOSE_TEMPLATE_COMPOSE_VERSION") ?: "0.3.1" repositories { // TODO: remove after new build is published diff --git a/templates/multiplatform-template/common/build.gradle.kts b/templates/multiplatform-template/common/build.gradle.kts index 7653e66c45..ec7c4db090 100644 --- a/templates/multiplatform-template/common/build.gradle.kts +++ b/templates/multiplatform-template/common/build.gradle.kts @@ -20,7 +20,7 @@ kotlin { } named("androidMain") { dependencies { - api("androidx.appcompat:appcompat:1.1.0") + api("androidx.appcompat:appcompat:1.3.0-beta01") api("androidx.core:core-ktx:1.3.1") } } diff --git a/tools/replace.sh b/tools/replace.sh index 1539099a3f..e4cbedc7e2 100755 --- a/tools/replace.sh +++ b/tools/replace.sh @@ -1,3 +1,9 @@ -OLDVER=0.3.0-rc1 -NEWVER=0.3.0 -find -E ../ -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$OLDVER/$NEWVER/g" {} \; +#!/bin/bash +ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/.. +COMPOSE_OLDVER=0.3.0 +COMPOSE_NEWVER=0.3.1 +find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$COMPOSE_OLDVER/$COMPOSE_NEWVER/g" {} \; +APPCOMPAT_OLDVER=1.1.0 +APPCOMPAT_NEWVER=1.3.0-beta01 +find -E $ROOT -regex '.*\.(kts|properties|kt)' -exec sed -i '' -e "s/$APPCOMPAT_OLDVER/$APPCOMPAT_NEWVER/g" {} \; +