-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
253 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
compose/src/commonMain/kotlin/androidx/constraintlayout/compose/extra/Class.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package androidx.constraintlayout.compose.extra | ||
|
||
internal val Any.javaKlass get() = this::class |
88 changes: 88 additions & 0 deletions
88
compose/src/commonMain/kotlin/androidx/constraintlayout/compose/extra/IntIntPair.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* 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.constraintlayout.compose.extra | ||
|
||
import kotlin.jvm.JvmField | ||
import kotlin.jvm.JvmInline | ||
|
||
/** | ||
* Container to ease passing around a tuple of two [Int] values. | ||
* | ||
* *Note*: This class is optimized by using a value class, a Kotlin language featured | ||
* not available from Java code. Java developers can get the same functionality by | ||
* using [Pair] or by constructing a custom implementation using Int parameters | ||
* directly (see [LongLongPair] for an example). | ||
*/ | ||
@JvmInline | ||
internal value class IntIntPair internal constructor( | ||
@PublishedApi @JvmField internal val packedValue: Long, | ||
) { | ||
/** | ||
* Constructs a [IntIntPair] with two [Int] values. | ||
* | ||
* @param first the first value in the pair | ||
* @param second the second value in the pair | ||
*/ | ||
public constructor(first: Int, second: Int) : this(packInts(first, second)) | ||
|
||
/** | ||
* The first value in the pair. | ||
*/ | ||
public val first: Int | ||
get() = (packedValue shr 32).toInt() | ||
|
||
/** | ||
* The second value in the pair. | ||
*/ | ||
public val second: Int | ||
get() = (packedValue and 0xFFFFFFFF).toInt() | ||
|
||
/** | ||
* Returns the [first] component of the pair. For instance, the first component | ||
* of `PairIntInt(3, 4)` is `3`. | ||
* | ||
* This method allows to use destructuring declarations when working with pairs, | ||
* for example: | ||
* ``` | ||
* val (first, second) = myPair | ||
* ``` | ||
*/ | ||
// NOTE: Unpack the value directly because using `first` forces an invokestatic | ||
public inline operator fun component1(): Int = (packedValue shr 32).toInt() | ||
|
||
/** | ||
* Returns the [second] component of the pair. For instance, the second component | ||
* of `PairIntInt(3, 4)` is `4`. | ||
* | ||
* This method allows to use destructuring declarations when working with pairs, | ||
* for example: | ||
* ``` | ||
* val (first, second) = myPair | ||
* ``` | ||
*/ | ||
// NOTE: Unpack the value directly because using `second` forces an invokestatic | ||
public inline operator fun component2(): Int = (packedValue and 0xFFFFFFFF).toInt() | ||
|
||
override fun toString(): String = "($first, $second)" | ||
} | ||
|
||
/** | ||
* Packs two Int values into one Long value for use in inline classes. | ||
*/ | ||
private inline fun packInts(val1: Int, val2: Int): Long { | ||
return (val1.toLong() shl 32) or (val2.toLong() and 0xFFFFFFFF) | ||
} |
21 changes: 21 additions & 0 deletions
21
...src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/FloatRange.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package androidx.constraintlayout.compose.platform.annotation | ||
|
||
/** | ||
* Replace when androidx.annotation.FloatRange support wasm | ||
*/ | ||
@Retention(AnnotationRetention.BINARY) | ||
@Target( | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
AnnotationTarget.VALUE_PARAMETER, | ||
AnnotationTarget.FIELD, | ||
AnnotationTarget.LOCAL_VARIABLE, | ||
AnnotationTarget.ANNOTATION_CLASS, | ||
) | ||
annotation class FloatRange( | ||
val from: Double = Double.NEGATIVE_INFINITY, | ||
val to: Double = Double.POSITIVE_INFINITY, | ||
val fromInclusive: Boolean = true, | ||
val toInclusive: Boolean = true, | ||
) |
19 changes: 19 additions & 0 deletions
19
...e/src/commonMain/kotlin/androidx/constraintlayout/compose/platform/annotation/IntRange.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package androidx.constraintlayout.compose.platform.annotation | ||
|
||
/** | ||
* Replace when androidx.annotation.IntRange support wasm | ||
*/ | ||
@Retention(AnnotationRetention.BINARY) | ||
@Target( | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
AnnotationTarget.VALUE_PARAMETER, | ||
AnnotationTarget.FIELD, | ||
AnnotationTarget.LOCAL_VARIABLE, | ||
AnnotationTarget.ANNOTATION_CLASS, | ||
) | ||
annotation class IntRange( | ||
val from: Long = Long.MIN_VALUE, | ||
val to: Long = Long.MAX_VALUE, | ||
) |
2 changes: 1 addition & 1 deletion
2
...eMain/kotlin/androidx/constraintlayout/compose/platform/annotation/SuppressLint.native.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package androidx.constraintlayout.compose.platform.annotation | ||
|
||
actual annotation class SuppressLint constructor(actual vararg val value: String) | ||
actual annotation class SuppressLint(actual vararg val value: String) |
4 changes: 3 additions & 1 deletion
4
compose/src/nativeMain/kotlin/androidx/constraintlayout/core/platform/System.native.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
compose/src/webMain/kotlin/androidx/constraintlayout/compose/MotionLayout.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package androidx.constraintlayout.compose | ||
|
||
internal actual val isShowingLayoutBounds: Boolean = false |
2 changes: 1 addition & 1 deletion
2
...onstraintlayout/compose/platform/Class.kt → ...straintlayout/compose/platform/Log.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package androidx.constraintlayout.compose.platform | ||
|
||
internal val Any.javaKlass get() = this::class | ||
internal actual typealias Log = BasicLog |
3 changes: 3 additions & 0 deletions
3
.../src/webMain/kotlin/androidx/constraintlayout/compose/platform/annotation/Language.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package androidx.constraintlayout.compose.platform.annotation | ||
|
||
actual annotation class Language actual constructor(actual val value: String) |
3 changes: 3 additions & 0 deletions
3
.../webMain/kotlin/androidx/constraintlayout/compose/platform/annotation/SuppressLint.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package androidx.constraintlayout.compose.platform.annotation | ||
|
||
actual annotation class SuppressLint actual constructor(actual vararg val value: String) |
3 changes: 3 additions & 0 deletions
3
...Main/kotlin/androidx/constraintlayout/compose/platform/annotation/SuppressWarnings.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package androidx.constraintlayout.compose.platform.annotation | ||
|
||
actual annotation class SuppressWarnings actual constructor(actual vararg val value: String) |
14 changes: 14 additions & 0 deletions
14
compose/src/webMain/kotlin/androidx/constraintlayout/core/platform/System.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package androidx.constraintlayout.core.platform | ||
|
||
import org.jetbrains.skiko.currentNanoTime | ||
|
||
internal actual object System { | ||
actual fun nanoTime(): Long = currentNanoTime() | ||
|
||
actual val err: PrintStream | ||
get() = object : PrintStream { | ||
override fun println(value: String) { | ||
println(value) | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
compose/src/webMain/kotlin/androidx/constraintlayout/core/platform/WeakReference.web.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package androidx.constraintlayout.core.platform | ||
|
||
actual class WeakReference<T : Any> actual constructor(referred: T) { | ||
private val workaroundReference: T = referred | ||
actual fun get(): T? = workaroundReference | ||
actual fun clear() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.