The second Android 11 Developer Preview is now available, test it out and share your feedback.

androidx.ui.util

Top-level functions summary

Float
lerp(start: Float, stop: Float, fraction: Float)

Linearly interpolate between start and stop with fraction fraction between them.

Int
lerp(start: Int, stop: Int, fraction: Float)

Linearly interpolate between start and stop with fraction fraction between them.

Long
lerp(start: Long, stop: Long, fraction: Float)

Linearly interpolate between start and stop with fraction fraction between them.

Long
packFloats(val1: Float, val2: Float)

Packs two Float values into one Long value for use in inline classes.

Long
packInts(val1: Int, val2: Int)

Packs two Int values into one Long value for use in inline classes.

T
synchronized(lock: Any, block: () -> T)

kotlin.synchronized is deprecated, and the build fails if we use kotlin.synchronized along with the IR compiler.

T
trace(sectionName: String, block: () -> T)

Wrap the specified block in calls to Trace.beginSection (with the supplied sectionName) and Trace.endSection.

Float

Unpacks the first Float value in packFloats from its returned Long.

Float

Unpacks the second Float value in packFloats from its returned Long.

Int
unpackInt1(value: Long)

Unpacks the first Int value in packInts from its returned ULong.

Int
unpackInt2(value: Long)

Unpacks the second Int value in packInts from its returned ULong.

Extension functions summary

Top-level functions

lerp

fun lerp(
    start: Float,
    stop: Float,
    fraction: Float
): Float

Linearly interpolate between start and stop with fraction fraction between them.

lerp

fun lerp(
    start: Int,
    stop: Int,
    fraction: Float
): Int

Linearly interpolate between start and stop with fraction fraction between them.

lerp

fun lerp(
    start: Long,
    stop: Long,
    fraction: Float
): Long

Linearly interpolate between start and stop with fraction fraction between them.

packFloats

inline fun packFloats(
    val1: Float,
    val2: Float
): Long

Packs two Float values into one Long value for use in inline classes.

packInts

inline fun packInts(
    val1: Int,
    val2: Int
): Long

Packs two Int values into one Long value for use in inline classes.

synchronized

fun <T> synchronized(
    lock: Any,
    block: () -> T
): T

kotlin.synchronized is deprecated, and the build fails if we use kotlin.synchronized along with the IR compiler. As a workaround, we have this function here, which is in a module that doesn't use the IR COmpiler.

trace

inline fun <T> trace(
    sectionName: String,
    block: () -> T
): T

Wrap the specified block in calls to Trace.beginSection (with the supplied sectionName) and Trace.endSection.

unpackFloat1

inline fun unpackFloat1(value: Long): Float

Unpacks the first Float value in packFloats from its returned Long.

unpackFloat2

inline fun unpackFloat2(value: Long): Float

Unpacks the second Float value in packFloats from its returned Long.

unpackInt1

inline fun unpackInt1(value: Long): Int

Unpacks the first Int value in packInts from its returned ULong.

unpackInt2

inline fun unpackInt2(value: Long): Int

Unpacks the second Int value in packInts from its returned ULong.

Extension functions

toHexString

fun Int.toHexString(): String

toStringAsFixed

fun Float.toStringAsFixed(digits: Int): String