Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,11 @@ public class AnimatedNavDecoration(
modifier: Modifier,
content: @Composable (T) -> Unit,
) {
val decorator =
remember {
@Suppress("UNCHECKED_CAST")
decoratorFactory.create<T>() as AnimatedNavDecorator<T, AnimatedNavState>
}
.apply { updateNavigator(navigator) }
val decorator = remember {
@Suppress("UNCHECKED_CAST")
decoratorFactory.create<T>() as AnimatedNavDecorator<T, AnimatedNavState>
}
.apply { updateNavigator(navigator) }
with(decorator) {
val transition = updateTransition(args)
transition.AnimatedContent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ private class RecordingEventListener(private val onDispose: () -> Unit) : EventL
?: run {
log("Creating new RecordingEventListener for $screen")
RecordingEventListener {
log("Removing RecordingEventListener for $screen")
listeners.remove(screen)
}
log("Removing RecordingEventListener for $screen")
listeners.remove(screen)
}
.also { listeners[screen] = it }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,40 +220,39 @@ class NavResultTest {
appendLine(" top: ${backStack.topRecord?.key}")
appendLine(" records:")
// Append the string as a square diagram
val tableString =
table {
cellStyle {
// These options affect the style of all cells contained within the table.
border = true
alignment = TextAlignment.MiddleLeft
}
header {
row {
cellStyle { alignment = TextAlignment.MiddleCenter }
for ((i, record) in backStack.iterator().withIndex()) {
if (i == 0) {
cell("${record.key.take(8)} (top)")
} else {
cell(record.key.take(8))
}
}
val tableString = table {
cellStyle {
// These options affect the style of all cells contained within the table.
border = true
alignment = TextAlignment.MiddleLeft
}
header {
row {
cellStyle { alignment = TextAlignment.MiddleCenter }
for ((i, record) in backStack.iterator().withIndex()) {
if (i == 0) {
cell("${record.key.take(8)} (top)")
} else {
cell(record.key.take(8))
}
}
row {
for ((i, record) in backStack.iterator().withIndex()) {
val stateString =
"""
}
}
row {
for ((i, record) in backStack.iterator().withIndex()) {
val stateString =
"""
${record.screen::class.simpleName}
input=${(record.screen as? TestResultScreen)?.input}
⬅ expectingResult=${resultHandler.expectingResult(record.key)}
value=${if (i == 0) getCurrentText() else "undefined"}
"""
.trimIndent()
cell(stateString)
}
}
.trimIndent()
cell(stateString)
}
.toString()
}
}
.toString()
appendLine(tableString.prependIndent(" "))
}
println(state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import androidx.compose.runtime.derivedStateOf
/** Current progress fraction of the animation, between 0f and 1f. */
public fun AnimatedVisibilityScope.progress(): FloatState {
return derivedStateOf {
with(transition) {
when {
isRunning || isSeeking -> {
val fraction = playTimeNanos * 1f / totalDurationNanos
if (fraction.isNaN()) {
0f
} else {
fraction.coerceIn(0f, 1f)
}
with(transition) {
when {
isRunning || isSeeking -> {
val fraction = playTimeNanos * 1f / totalDurationNanos
if (fraction.isNaN()) {
0f
} else {
fraction.coerceIn(0f, 1f)
}
currentState == EnterExitState.Visible -> 1f
else -> 0f
}
currentState == EnterExitState.Visible -> 1f
else -> 0f
}
}
}
.asFloatState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,14 @@ private class GestureTranslationNode(
coroutineScope.launch {
animatable.snapTo(0f)
snapshotFlow {
val offset = swipeOffset()
when {
!offset.isValid() -> 0f
isSeeking() -> offset.x
showPrevious() -> maxWidth
else -> 0f
}
val offset = swipeOffset()
when {
!offset.isValid() -> 0f
isSeeking() -> offset.x
showPrevious() -> maxWidth
else -> 0f
}
}
.collectLatest {
try {
animatable.animateTo(it)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ kotlinpoet = "2.3.0"
kotlinx-coroutines = "1.11.0"
kotlinx-serialization = "1.11.0"
ksp = "2.3.10"
ktfmt = "0.63"
ktfmt = "0.64"
ktor = "3.5.1"
leakcanary = "2.14"
mavenPublish = "0.36.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,11 @@ private fun PetListGridItem(
LocalContentColor provides LocalContentColor.current.copy(alpha = 0.75f)
) {
// Gender, age
val genderAge =
buildList {
animal.gender?.let { add(it.displayName) }
add(animal.age)
}
.joinToString(" – ")
val genderAge = buildList {
animal.gender?.let { add(it.displayName) }
add(animal.age)
}
.joinToString(" – ")
Text(
modifier = Modifier.testTag(AGE_AND_BREED_TAG),
text = genderAge,
Expand Down
Loading