diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt index 388c5f1eb708b..e7f2c7396b2a6 100644 --- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt +++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/AnimationSpec.kt @@ -657,7 +657,6 @@ public class KeyframesSpec<T>(public val config: KeyframesSpecConfig<T>) : if (!config.keyframes.contains(config.durationMillis)) { timestamps.add(config.durationMillis) } - timestamps.sort() return VectorizedKeyframesSpec( @@ -772,7 +771,6 @@ public class KeyframesWithSplineSpec<T>( if (!keyframes.contains(config.durationMillis)) { timestamps.add(config.durationMillis) } - timestamps.sort() return VectorizedMonoSplineKeyframesSpec( timestamps = timestamps, diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/PathEasing.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/PathEasing.kt index 2163eaef48af1..93f4a538fc790 100644 --- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/PathEasing.kt +++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/PathEasing.kt @@ -16,7 +16,6 @@ package androidx.compose.animation.core -import androidx.compose.animation.core.internal.binarySearch import androidx.compose.runtime.Immutable import androidx.compose.ui.graphics.IntervalTree import androidx.compose.ui.graphics.Path diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt index 9490c76178701..54f125b0e4508 100644 --- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt +++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/VectorizedAnimationSpec.kt @@ -250,7 +250,6 @@ internal constructor( if (!keyframes.containsKey(durationMillis)) { times.add(durationMillis) } - times.sort() return@run times }, diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.kt index 6b2430cc50f55..0aebdc346a2e3 100644 --- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.kt +++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/internal/JvmDefaultWithCompatibility.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022 The Android Open Source Project + * Copyright 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package androidx.compose.animation.core.internal; +package androidx.compose.animation.core.internal internal expect annotation class JvmDefaultWithCompatibility() diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt index 62a88108da729..e02b5cfeb4588 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/draganddrop/DragAndDropTarget.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/draganddrop/DragAndDropTarget.kt index 296c46697469f..3263171c4c3e3 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/draganddrop/DragAndDropTarget.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/draganddrop/DragAndDropTarget.kt @@ -41,12 +41,12 @@ import androidx.compose.ui.platform.InspectorInfo fun Modifier.dragAndDropTarget( shouldStartDragAndDrop: (startEvent: DragAndDropEvent) -> Boolean, target: DragAndDropTarget, -): Modifier { - return this then DropTargetElement( - target = target, - shouldStartDragAndDrop = shouldStartDragAndDrop, - ) -} +): Modifier = + this then + DropTargetElement( + target = target, + shouldStartDragAndDrop = shouldStartDragAndDrop, + ) private class DropTargetElement( val shouldStartDragAndDrop: (event: DragAndDropEvent) -> Boolean, diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt index 2a35959c4cfea..27627d63a8760 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewNode.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListLayoutInfo.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListLayoutInfo.kt index abe0d8c4717cb..fe338bed6831c 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListLayoutInfo.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListLayoutInfo.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt index 1364368253997..7dae8094cd772 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt index 1a58143bdf3c6..bb3da934e5662 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt @@ -17,8 +17,6 @@ package androidx.compose.foundation.pager import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.gestures.Orientation -import androidx.compose.foundation.gestures.snapping.calculateDistanceToDesiredSnapPosition import androidx.compose.foundation.lazy.layout.LazyLayoutNearestRangeState import androidx.compose.foundation.lazy.layout.findIndexByKey import androidx.compose.runtime.getValue @@ -26,10 +24,6 @@ import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.setValue import kotlin.math.roundToLong -import androidx.compose.ui.unit.Density -import androidx.compose.ui.util.fastMaxBy -import kotlin.math.absoluteValue -import kotlin.math.roundToInt /** * Contains the current scroll position represented by the first visible page and the first visible diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt index d584f4eefc430..491dc91efb95c 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/BasicTextField.kt @@ -45,7 +45,6 @@ import androidx.compose.foundation.text.input.internal.TextFieldDecoratorModifie import androidx.compose.foundation.text.input.internal.TextFieldTextLayoutModifier import androidx.compose.foundation.text.input.internal.TextLayoutState import androidx.compose.foundation.text.input.internal.TransformedTextFieldState -import androidx.compose.foundation.text.input.internal.selection.TextFieldHandleState import androidx.compose.foundation.text.input.internal.selection.TextFieldSelectionState import androidx.compose.foundation.text.input.internal.selection.TextFieldSelectionState.InputType import androidx.compose.foundation.text.selection.SelectionHandle diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt index df7bc7e1a1d5f..0e350f1dc5128 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt @@ -66,53 +66,55 @@ internal fun Modifier.textFieldScrollable( interactionSource: MutableInteractionSource? = null, enabled: Boolean = true, overscrollEffect: OverscrollEffect? = null -) = composed( - inspectorInfo = - debugInspectorInfo { - name = "textFieldScrollable" - properties["scrollerPosition"] = scrollerPosition - properties["interactionSource"] = interactionSource - properties["enabled"] = enabled - } -) { - // do not reverse direction only in case of RTL in horizontal orientation - val rtl = LocalLayoutDirection.current == LayoutDirection.Rtl - val reverseDirection = scrollerPosition.orientation == Orientation.Vertical || !rtl - val scrollableState = rememberScrollableState { delta -> - val newOffset = scrollerPosition.offset + delta - val consumedDelta = - when { - newOffset > scrollerPosition.maximum -> - scrollerPosition.maximum - scrollerPosition.offset - newOffset < 0f -> -scrollerPosition.offset - else -> delta +) = + composed( + inspectorInfo = + debugInspectorInfo { + name = "textFieldScrollable" + properties["scrollerPosition"] = scrollerPosition + properties["interactionSource"] = interactionSource + properties["enabled"] = enabled } - scrollerPosition.offset += consumedDelta - consumedDelta - } - // TODO: b/255557085 remove when / if rememberScrollableState exposes lambda parameters for - // setting these - val wrappedScrollableState = - remember(scrollableState, scrollerPosition) { - object : ScrollableState by scrollableState { - override val canScrollForward by derivedStateOf { - scrollerPosition.offset < scrollerPosition.maximum + ) { + // do not reverse direction only in case of RTL in horizontal orientation + val rtl = LocalLayoutDirection.current == LayoutDirection.Rtl + val reverseDirection = scrollerPosition.orientation == Orientation.Vertical || !rtl + val scrollableState = rememberScrollableState { delta -> + val newOffset = scrollerPosition.offset + delta + val consumedDelta = + when { + newOffset > scrollerPosition.maximum -> + scrollerPosition.maximum - scrollerPosition.offset + newOffset < 0f -> -scrollerPosition.offset + else -> delta } - override val canScrollBackward by derivedStateOf { - scrollerPosition.offset > 0f + scrollerPosition.offset += consumedDelta + consumedDelta + } + // TODO: b/255557085 remove when / if rememberScrollableState exposes lambda parameters for + // setting these + val wrappedScrollableState = + remember(scrollableState, scrollerPosition) { + object : ScrollableState by scrollableState { + override val canScrollForward by derivedStateOf { + scrollerPosition.offset < scrollerPosition.maximum + } + override val canScrollBackward by derivedStateOf { + scrollerPosition.offset > 0f + } } } - } - val scroll = Modifier.scrollable( - orientation = scrollerPosition.orientation, - reverseDirection = reverseDirection, - overscrollEffect = overscrollEffect, - state = wrappedScrollableState, - interactionSource = interactionSource, - enabled = enabled && scrollerPosition.maximum != 0f - ) - scroll -} + val scroll = + Modifier.scrollable( + orientation = scrollerPosition.orientation, + reverseDirection = reverseDirection, + overscrollEffect = overscrollEffect, + state = wrappedScrollableState, + interactionSource = interactionSource, + enabled = enabled && scrollerPosition.maximum != 0f + ) + scroll + } // Layout // Expect/actual is needed due to a different implementation in uikit diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt index f730100a9fbe2..2b7d83c37f6c6 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextPointerIcon.kt @@ -18,9 +18,5 @@ package androidx.compose.foundation.text import androidx.compose.ui.input.pointer.PointerIcon -// TODO Replace to PointerIcon.Text. No need for expect/actual internal expect val textPointerIcon: PointerIcon - -// TODO Add appropriate property to PointerIcon interface instead of bypassing abstraction layer. -// https://youtrack.jetbrains.com/issue/CMP-7145/Properly-adopt-stylus-handwriting-hover-icon internal expect val handwritingPointerIcon: PointerIcon diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/InputTransformation.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/InputTransformation.kt index 1814b0add00df..77ec77369bcdd 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/InputTransformation.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/InputTransformation.kt @@ -26,7 +26,6 @@ import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.text.substring import androidx.compose.ui.text.toUpperCase -import kotlin.jvm.JvmName /** * A function that is ran after every change made to a [TextFieldState] by user input and can change diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CodepointHelpers.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CodepointHelpers.kt index 7d989d6857212..7b7fc5098e451 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CodepointHelpers.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CodepointHelpers.kt @@ -20,5 +20,4 @@ internal expect fun CharSequence.codePointAt(index: Int): Int internal expect fun charCount(codePoint: Int): Int -// TODO: It's not used from common, consider to remove internal expect fun CharSequence.codePointBefore(index: Int): Int diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CursorAnimationState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CursorAnimationState.kt index 2a44fbfdc03c7..58dca60aa78ac 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CursorAnimationState.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/CursorAnimationState.kt @@ -95,4 +95,4 @@ internal class CursorAnimationState(val animate: Boolean) { val job = animationJob.getAndSet(null) job?.cancel() } -} \ No newline at end of file +} diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt index 82c2cbd67b37b..76fa17e67a3fe 100644 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt +++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomSheetScaffold.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt index 7b9f7cab63f31..796b66efa0529 100644 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt +++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ModalBottomSheet.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,8 +63,8 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.dp -import kotlin.math.abs import kotlin.jvm.JvmName +import kotlin.math.abs import kotlin.math.max import kotlin.math.min import kotlinx.coroutines.launch diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationKeyEvents.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationKeyEvents.kt deleted file mode 100644 index 990b1fba937d7..0000000000000 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/NavigationKeyEvents.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.material - -import androidx.compose.ui.input.key.KeyEvent - -internal expect val KeyEvent.isDirectionUp: Boolean -internal expect val KeyEvent.isDirectionDown: Boolean -internal expect val KeyEvent.isDirectionRight: Boolean -internal expect val KeyEvent.isDirectionLeft: Boolean -internal expect val KeyEvent.isHome: Boolean -internal expect val KeyEvent.isMoveEnd: Boolean -internal expect val KeyEvent.isPgUp: Boolean -internal expect val KeyEvent.isPgDn: Boolean diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Strings.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Strings.kt index 792881a715a40..39c2fbdfdc397 100644 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Strings.kt +++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Strings.kt @@ -31,8 +31,6 @@ internal value class Strings private constructor(@Suppress("unused") private val val SliderRangeStart = Strings(5) val SliderRangeEnd = Strings(6) val SnackbarPaneTitle = Strings(7) - // When adding values here, make sure to also add them in material/build.gradle, - // updateTranslations task (stringByResourceName parameter), and re-run the task } } diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt index 3e25abdd431d3..2584f6f727768 100644 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt +++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/internal/JvmDefaultWithCompatibility.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/internal/JvmDefaultWithCompatibility.kt deleted file mode 100644 index ce9e330b7289c..0000000000000 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/internal/JvmDefaultWithCompatibility.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.material.internal - -// TODO: [1.4 Update] upstream it -internal expect annotation class JvmDefaultWithCompatibility() \ No newline at end of file diff --git a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/NavigationKeyEvents.desktop.kt b/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/NavigationKeyEvents.desktop.kt deleted file mode 100644 index 4c38442762bab..0000000000000 --- a/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/NavigationKeyEvents.desktop.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.material - -import androidx.compose.ui.input.key.KeyEvent -import androidx.compose.ui.input.key.key -import androidx.compose.ui.input.key.nativeKeyCode - -internal actual val KeyEvent.isDirectionUp: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_UP - -internal actual val KeyEvent.isDirectionDown: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_DOWN - -internal actual val KeyEvent.isDirectionRight: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_RIGHT - -internal actual val KeyEvent.isDirectionLeft: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_LEFT - -internal actual val KeyEvent.isHome: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_HOME - -internal actual val KeyEvent.isMoveEnd: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_END - -internal actual val KeyEvent.isPgUp: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_PAGE_UP - -internal actual val KeyEvent.isPgDn: Boolean - get() = key.nativeKeyCode == java.awt.event.KeyEvent.VK_PAGE_DOWN diff --git a/compose/material/material/src/jsNativeMain/kotlin/androidx/compose/material/NavigationKeyEvents.jsNative.kt b/compose/material/material/src/jsNativeMain/kotlin/androidx/compose/material/NavigationKeyEvents.jsNative.kt deleted file mode 100644 index 0f77ac9f35803..0000000000000 --- a/compose/material/material/src/jsNativeMain/kotlin/androidx/compose/material/NavigationKeyEvents.jsNative.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.material - -import androidx.compose.ui.input.key.Key -import androidx.compose.ui.input.key.KeyEvent -import androidx.compose.ui.input.key.key - -internal actual val KeyEvent.isDirectionUp: Boolean - get() = key == Key.DirectionUp - -internal actual val KeyEvent.isDirectionDown: Boolean - get() = key == Key.DirectionDown - -internal actual val KeyEvent.isDirectionRight: Boolean - get() = key == Key.DirectionRight - -internal actual val KeyEvent.isDirectionLeft: Boolean - get() = key == Key.DirectionLeft - -internal actual val KeyEvent.isHome: Boolean - get() = key == Key.Home - -internal actual val KeyEvent.isMoveEnd: Boolean - get() = key == Key.MoveEnd - -internal actual val KeyEvent.isPgUp: Boolean - get() = key == Key.PageUp - -internal actual val KeyEvent.isPgDn: Boolean - get() = key == Key.PageDown diff --git a/compose/material/material/src/jsNativeMain/kotlin/androidx/compose/material/internal/JvmDefaultWithCompatibility.kt b/compose/material/material/src/jsNativeMain/kotlin/androidx/compose/material/internal/JvmDefaultWithCompatibility.kt deleted file mode 100644 index 39305a53fd11d..0000000000000 --- a/compose/material/material/src/jsNativeMain/kotlin/androidx/compose/material/internal/JvmDefaultWithCompatibility.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.material.internal - -// TODO: this actual is not needed after https://youtrack.jetbrains.com/issue/KT-53149 is implemented -internal annotation class NoOp -internal actual typealias JvmDefaultWithCompatibility = NoOp \ No newline at end of file diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt index 77c85e1a70730..8e2eabd4ccea6 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/BottomSheetScaffold.kt @@ -58,7 +58,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastForEach import androidx.compose.ui.util.fastMap import androidx.compose.ui.util.fastMaxOfOrNull -import androidx.compose.ui.unit.IntSize import kotlin.math.max import kotlin.math.roundToInt import kotlinx.coroutines.launch diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt index c5084086fdb4d..85afe26f2e30a 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ListItem.kt @@ -714,7 +714,7 @@ private fun ProvideTextStyleFromToken( ) /** Helper class to define list item type. Used for padding and sizing definition. */ -@kotlin.jvm.JvmInline +@JvmInline private value class ListItemType private constructor(private val lines: Int) : Comparable<ListItemType> { diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ModalBottomSheet.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ModalBottomSheet.kt index d45ef53993be9..66bea4791031c 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ModalBottomSheet.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/ModalBottomSheet.kt @@ -295,8 +295,8 @@ internal fun BoxScope.ModalBottomSheetContent( else Modifier ) .draggableAnchors(sheetState.anchoredDraggableState, Orientation.Vertical) { - sheetSize, - constraints -> + sheetSize, + constraints -> val fullHeight = constraints.maxHeight.toFloat() val newAnchors = DraggableAnchors { Hidden at fullHeight diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt index 47e8233fa3936..1b29dd1f4844b 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt @@ -2109,7 +2109,7 @@ class SliderState( internal val gestureEndAction = { if (!isDragging) { // check isDragging in case the change is still in progress (touch -> drag case) - this.onValueChangeFinished?.invoke() + onValueChangeFinished?.invoke() } } diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/carousel/Carousel.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/carousel/Carousel.kt index 31d1cf1997b2f..67883b1e33cbd 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/carousel/Carousel.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/carousel/Carousel.kt @@ -53,8 +53,8 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp -import kotlin.math.roundToInt import kotlin.jvm.JvmInline +import kotlin.math.roundToInt /** * <a href=https://m3.material.io/components/carousel/overview" class="external" diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/Strings.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/Strings.kt index 1c87ad3e10d8a..0723548d8b108 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/Strings.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/internal/Strings.kt @@ -92,8 +92,6 @@ internal expect value class Strings constructor(val value: Int) { val TimePickerMinuteTextField: Strings val TooltipPaneDescription: Strings val WideNavigationRailPaneTitle: Strings - // When adding values here, make sure to also add them in material3/build.gradle, - // updateTranslations task (stringByResourceName parameter), and re-run the task } } diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/pulltorefresh/PullToRefresh.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/pulltorefresh/PullToRefresh.kt index 8e82eb2f131ae..9b5bfb76a6767 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/pulltorefresh/PullToRefresh.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/pulltorefresh/PullToRefresh.kt @@ -669,11 +669,6 @@ fun rememberPullToRefreshState(): PullToRefreshState { @ExperimentalMaterial3Api fun PullToRefreshState(): PullToRefreshState = PullToRefreshStateImpl() -/** - * Creates a [PullToRefreshState]. - * - * Note that in most cases, you are advised to use [rememberPullToRefreshState] when in composition. - */ @ExperimentalMaterial3Api internal class PullToRefreshStateImpl private constructor(private val anim: Animatable<Float, AnimationVector1D>) : PullToRefreshState { diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/layer/GraphicsLayer.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/layer/GraphicsLayer.kt index 495b73b6d0aaf..f9ce145104c14 100644 --- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/layer/GraphicsLayer.kt +++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/layer/GraphicsLayer.kt @@ -236,8 +236,6 @@ expect class GraphicsLayer { */ fun setPathOutline(path: Path) - // TODO Fix default values on Wasm - /** * Configures a rounded rect outline for this [GraphicsLayer]. By default, [topLeft] is set to * [Size.Zero] and [size] is set to [Size.Unspecified] indicating that the outline should match diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt index bffe631d2021d..2d09fea6fed4d 100644 --- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt +++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt @@ -22,7 +22,6 @@ import androidx.compose.runtime.Stable import androidx.compose.runtime.saveable.Saver import androidx.compose.ui.text.AnnotatedString.Annotation import androidx.compose.ui.text.AnnotatedString.Builder -import androidx.compose.ui.text.AnnotatedString.Companion.equals import androidx.compose.ui.text.AnnotatedString.Range import androidx.compose.ui.text.internal.checkPrecondition import androidx.compose.ui.text.internal.requirePrecondition @@ -463,8 +462,8 @@ internal constructor(internal val annotations: List<Range<out Annotation>>?, val @Deprecated( message = - "Replaced by the append(Char) method that returns an Appendable. " + - "This method must be kept around for binary compatibility.", + "Replaced by the append(Char) method that returns an Appendable. " + + "This method must be kept around for binary compatibility.", level = DeprecationLevel.HIDDEN ) @Suppress("FunctionName", "unused") diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicExpect.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt similarity index 93% rename from compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicExpect.kt rename to compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt index 3708e22751d14..4d03bc4155acb 100644 --- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicExpect.kt +++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AtomicReference.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 The Android Open Source Project + * Copyright 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,3 +25,4 @@ internal expect class AtomicReference<V>(value: V) { fun compareAndSet(expect: V, newValue: V): Boolean } + diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt deleted file mode 100644 index abc58367ea7a9..0000000000000 --- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.ui.text.input - -/** - * - * Workaround to bypass bug https://youtrack.jetbrains.com/issue/KT-52336/Differs-on-JVM-and-Native-in-stringBuilder-append-charArray-0-1 - * On JVM and Android this function work's as StringBuilder.append(char[], int offset, int len) - */ -internal expect fun StringBuilder.appendPartOfCharArray(charArray: CharArray, offset: Int, len: Int) diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/Hyphens.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/Hyphens.kt index bdbdb5eb81ad8..7ef0236939b53 100644 --- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/Hyphens.kt +++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/Hyphens.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt b/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt deleted file mode 100644 index c431497dc1a27..0000000000000 --- a/compose/ui/ui-text/src/desktopMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.ui.text.input - -internal actual fun StringBuilder.appendPartOfCharArray(charArray: CharArray, offset: Int, len: Int) { - append(charArray, offset, len) -} diff --git a/compose/ui/ui-text/src/jsWasmMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt b/compose/ui/ui-text/src/jsWasmMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt deleted file mode 100644 index e2407ff633234..0000000000000 --- a/compose/ui/ui-text/src/jsWasmMain/kotlin/androidx/compose/ui/text/input/appendPartOfCharArray.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.ui.text.input - -internal actual fun StringBuilder.appendPartOfCharArray(charArray: CharArray, offset: Int, len: Int) { - for (i in offset until (offset + len)) { - append(charArray[i]) - } -} diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt index 02cb27f2a5d25..748d1104d8789 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/AtomicReference.kt @@ -16,9 +16,6 @@ package androidx.compose.ui -// This should be kept internal by marking all actuals as internal. We can't mark the expect as -// internal since the typealias target on JVM is public, so the compiler complains about mismatched -// visibility. internal expect class AtomicReference<V>(value: V) { fun get(): V diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/HitPathTracker.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/HitPathTracker.kt index 7d984eee7f1bc..447358e2ef9cd 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/HitPathTracker.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/HitPathTracker.kt @@ -29,7 +29,6 @@ import androidx.compose.ui.layout.LayoutCoordinates import androidx.compose.ui.node.InternalCoreApi import androidx.compose.ui.node.Nodes import androidx.compose.ui.node.dispatchForKind -import androidx.compose.ui.node.has import androidx.compose.ui.node.layoutCoordinates import androidx.compose.ui.util.fastFirstOrNull import androidx.compose.ui.util.fastForEach diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerEvent.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerEvent.kt index cc1e54203c741..33359fe3af7d4 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerEvent.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerEvent.kt @@ -778,8 +778,6 @@ class PointerInputChange( it.consumedDelegate = this.consumedDelegate ?: this } - // Long string concatenation causes atomicfu plugin to be slow/hang. - // See https://youtrack.jetbrains.com/issue/KT-65645/Atomicfu-plugin-compilation-hangs-on-a-long-string-concatenation override fun toString(): String { return "PointerInputChange(id=$id, " + "uptimeMillis=$uptimeMillis, " + diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessor.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessor.kt index 342b3b21e10fb..bf5ab78f69a49 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessor.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerInputEventProcessor.kt @@ -62,7 +62,6 @@ internal class PointerInputEventProcessor(val root: LayoutNode) { * @see ProcessResult * @see PointerInputEvent */ - @OptIn(InternalCoreApi::class) fun process( @OptIn(InternalCoreApi::class) pointerEvent: PointerInputEvent, positionCalculator: PositionCalculator, diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerMoveFilter.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerMoveFilter.kt deleted file mode 100644 index bcc99cf74d9e8..0000000000000 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/PointerMoveFilter.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2020 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.ui.input.pointer - -import androidx.compose.runtime.remember -import androidx.compose.ui.Modifier -import androidx.compose.ui.composed -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.unit.IntSize - -// TODO: this code is copy-pasted from desktop (consider reusing it) - -/** - * Modifier allowing to track pointer (i.e. mouse or trackpad) move events. - * @param onMove The callback invoked when pointer is moved inside a component, - * relative position inside a component is passed - * @param onEnter The callback invoked when pointer enters the component - * @param onExit The callback invoked when pointer leaves the component - */ -//fun Modifier.pointerMoveFilter( -// onMove: (position: Offset) -> Boolean = { false }, -// onExit: () -> Boolean = { false }, -// onEnter: () -> Boolean = { false }, -//): Modifier = composed { -// val filter = remember(::PointerMoveEventFilter) -// filter.onEnterHandler = onEnter -// filter.onExitHandler = onExit -// filter.onMoveHandler = onMove -// MovePointerInputModifierImpl(filter) -//} -// -//internal class PointerMoveEventFilter : PointerInputFilter() { -// lateinit var onEnterHandler: () -> Boolean -// lateinit var onExitHandler: () -> Boolean -// lateinit var onMoveHandler: (position: Offset) -> Boolean -// -// override fun onPointerEvent( -// pointerEvent: PointerEvent, -// pass: PointerEventPass, -// bounds: IntSize -// ) = Unit -// -// override fun onCancel() = Unit -//} -// -//private data class MovePointerInputModifierImpl( -// override val pointerInputFilter: PointerInputFilter -//) : PointerInputModifier diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatingNode.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatingNode.kt index dfb5f93df2966..5415836da3d2b 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatingNode.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/DelegatingNode.kt @@ -16,7 +16,6 @@ package androidx.compose.ui.node -import androidx.annotation.VisibleForTesting import androidx.compose.ui.Modifier import androidx.compose.ui.internal.checkPrecondition @@ -47,11 +46,12 @@ abstract class DelegatingNode : Modifier.Node() { internal var delegate: Modifier.Node? = null - @VisibleForTesting + // @TestOnly internal fun <T : DelegatableNode> delegateUnprotected(delegatableNode: T): T = delegate(delegatableNode) - @VisibleForTesting internal fun undelegateUnprotected(instance: DelegatableNode) = undelegate(instance) + // @TestOnly + internal fun undelegateUnprotected(instance: DelegatableNode) = undelegate(instance) override fun setAsDelegateTo(owner: Modifier.Node) { super.setAsDelegateTo(owner) diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt index 1e6aa5da55ab3..ccca04217d586 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt @@ -1449,7 +1449,6 @@ internal abstract class NodeCoordinator( ) } - @kotlin.native.concurrent.ThreadLocal internal companion object { const val ExpectAttachedLayoutCoordinates = "LayoutCoordinate operations are only valid " + "when isAttached is true" diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt index a7cdaafc514b0..d204355ac5603 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023 The Android Open Source Project + * Copyright 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -336,8 +336,8 @@ private fun autoInvalidateNodeSelf(node: Modifier.Node, selfKindSet: Int, phase: } if ( Nodes.FocusProperties in selfKindSet && - node is FocusPropertiesModifierNode && - node.specifiesCanFocusProperty() + node is FocusPropertiesModifierNode && + node.specifiesCanFocusProperty() ) { when (phase) { Removed -> node.scheduleInvalidationOfAssociatedFocusTargets() diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt index fd3ae026f2b83..42df63e085cf8 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/Owner.kt @@ -276,7 +276,6 @@ internal interface Owner : PositionCalculator { * Android, this schedules view tree layout observer callback to be invoked for the underlying * platform view hierarchy. */ - // TODO: Move to InteropViewContainer @InternalComposeUiApi fun onInteropViewLayoutChange(view: InteropView) /** The [FocusDirection] represented by the specified keyEvent. */ diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Atomic.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AtomicInt.kt similarity index 100% rename from compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/Atomic.kt rename to compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/AtomicInt.kt diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest.kt index 52ee17c93e209..417cfbaee213e 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024 The Android Open Source Project + * Copyright 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,4 +20,4 @@ package androidx.compose.ui.platform * Represents a request to open a platform-specific text input session via * `PlatformTextInputModifierNode.textInputSession`. */ -expect interface PlatformTextInputMethodRequest \ No newline at end of file +expect interface PlatformTextInputMethodRequest diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticKeys.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticKeys.kt deleted file mode 100644 index 549cea26bc0ec..0000000000000 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticKeys.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package androidx.compose.ui.semantics - -internal fun <T> AccessibilityKey( - name: String -) = - SemanticsPropertyKey<T>( - name = name, - isImportantForAccessibility = true - ) - -internal fun <T> AccessibilityKey( - name: String, - mergePolicy: (T?, T) -> T? -) = - SemanticsPropertyKey<T>( - name = name, - isImportantForAccessibility = true, - mergePolicy = mergePolicy - ) - -@Suppress("NOTHING_TO_INLINE") -// inline to break static initialization cycle issue -internal inline fun <T : Function<Boolean>> ActionPropertyKey( - name: String -) = - AccessibilityKey<AccessibilityAction<T>>( - name = name, - mergePolicy = { parentValue, childValue -> - AccessibilityAction( - parentValue?.label ?: childValue.label, - parentValue?.action ?: childValue.action - ) - } - ) \ No newline at end of file diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt index 49a8613fef843..c1dc069c2adc8 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt @@ -449,6 +449,16 @@ private fun <T> throwSemanticsGetNotSupported(): T { ) } +internal fun <T> AccessibilityKey(name: String) = + SemanticsPropertyKey<T>(name = name, isImportantForAccessibility = true) + +internal fun <T> AccessibilityKey(name: String, mergePolicy: (T?, T) -> T?) = + SemanticsPropertyKey<T>( + name = name, + isImportantForAccessibility = true, + mergePolicy = mergePolicy + ) + /** * Standard accessibility action. * @@ -482,6 +492,19 @@ class AccessibilityAction<T : Function<Boolean>>(val label: String?, val action: } } +@Suppress("NOTHING_TO_INLINE") +// inline to break static initialization cycle issue +private inline fun <T : Function<Boolean>> ActionPropertyKey(name: String) = + AccessibilityKey<AccessibilityAction<T>>( + name = name, + mergePolicy = { parentValue, childValue -> + AccessibilityAction( + parentValue?.label ?: childValue.label, + parentValue?.action ?: childValue.action + ) + } + ) + /** * Custom accessibility action. * @@ -846,8 +869,9 @@ var SemanticsPropertyReceiver.focused by SemanticsProperties.Focused var SemanticsPropertyReceiver.isContainer by SemanticsProperties.IsContainer /** - * Whether this semantics node is a traversal group. This is defined as a node whose function is to - * serve as a boundary or border in organizing its children. + * Whether this semantics node is a traversal group. + * + * See https://developer.android.com/jetpack/compose/accessibility#modify-traversal-order * * @see SemanticsProperties.IsTraversalGroup */ diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt index 8e1a6f35ab772..0f2da647fd59a 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropView.kt @@ -24,10 +24,3 @@ import androidx.compose.ui.InternalComposeUiApi * in which case the typealias will resolve to [Any]. */ @InternalComposeUiApi expect class InteropView - -/** - * A typealias for the platform's built-in view group type. It's used as a wrapper of [InteropView] - * and might have different from [InteropView] type. Not all platforms support interoperability - * in this way, in which case the typealias will resolve to [Any]. - */ -internal expect class InteropViewGroup diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt index ed837597aaade..139cd77ade1b4 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/viewinterop/InteropViewFactoryHolder.kt @@ -19,7 +19,6 @@ package androidx.compose.ui.viewinterop import androidx.compose.runtime.ComposeNodeLifecycleCallback import androidx.compose.ui.InternalComposeUiApi -// TODO: Rename to InteropViewHolder: No need for typealiases and it's not a factory @InternalComposeUiApi internal expect class InteropViewFactoryHolder : ComposeNodeLifecycleCallback { fun getInteropView(): InteropView? diff --git a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt index 0106f819fd00e..c232eebf16ecd 100644 --- a/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt +++ b/compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/node/RootNodeOwner.skiko.kt @@ -23,7 +23,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshots.Snapshot -import androidx.compose.ui.ComposeUiFlags import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.InternalComposeUiApi import androidx.compose.ui.Modifier