diff --git a/designcompose/src/main/java/com/android/designcompose/squoosh/SquooshVariantTransition.kt b/designcompose/src/main/java/com/android/designcompose/squoosh/SquooshVariantTransition.kt index 3f5b4bb97..cf808ce37 100644 --- a/designcompose/src/main/java/com/android/designcompose/squoosh/SquooshVariantTransition.kt +++ b/designcompose/src/main/java/com/android/designcompose/squoosh/SquooshVariantTransition.kt @@ -130,7 +130,27 @@ internal class VariantAnimationInfo( val transition: AnimationTransition, ) -class VariantTransitionContext(val from: View?, val to: View?) { +class VariantTransitionContext(private val from: View?, private val to: View?) { + @Discouraged( + message = + "This helper function will the name of the `from` View. This function is intended to " + + "temporarily help with creating custom variant transitions, but may be deprecated or " + + "removed in the future." + ) + fun getFromViewName(): String { + return from?.name ?: "" + } + + @Discouraged( + message = + "This helper function will the name of the `to` View. This function is intended to " + + "temporarily help with creating custom variant transitions, but may be deprecated or " + + "removed in the future." + ) + fun getToViewName(): String { + return to?.name ?: "" + } + @Discouraged( message = "This helper function will return true if the transition is within a variant from the " + diff --git a/designcompose/src/main/java/com/android/designcompose/utils/ViewStyleUtils.kt b/designcompose/src/main/java/com/android/designcompose/utils/ViewStyleUtils.kt index e44827f08..5f20a26d1 100644 --- a/designcompose/src/main/java/com/android/designcompose/utils/ViewStyleUtils.kt +++ b/designcompose/src/main/java/com/android/designcompose/utils/ViewStyleUtils.kt @@ -31,7 +31,6 @@ import com.android.designcompose.definition.layout.LayoutSizing import com.android.designcompose.definition.layout.Overflow import com.android.designcompose.definition.layout.PositionType import com.android.designcompose.definition.layout.copy -import com.android.designcompose.definition.layout.layoutStyle import com.android.designcompose.definition.modifier.BlendMode import com.android.designcompose.definition.modifier.TextAlign import com.android.designcompose.definition.modifier.TextAlignVertical @@ -41,7 +40,6 @@ import com.android.designcompose.definition.view.ViewStyle import com.android.designcompose.definition.view.copy import com.android.designcompose.definition.view.fontStretchOrNull import com.android.designcompose.definition.view.nodeSizeOrNull -import com.android.designcompose.definition.view.nodeStyle import com.android.designcompose.definition.view.strokeOrNull import com.android.designcompose.definition.view.viewStyle diff --git a/integration-tests/validation/src/main/assets/figma/VariantAnimationTimelineTestDoc_vJRf4zxY4QX4zzSSUd1nJ5.dcf b/integration-tests/validation/src/main/assets/figma/VariantAnimationTimelineTestDoc_vJRf4zxY4QX4zzSSUd1nJ5.dcf new file mode 100644 index 000000000..5afe90cc6 Binary files /dev/null and b/integration-tests/validation/src/main/assets/figma/VariantAnimationTimelineTestDoc_vJRf4zxY4QX4zzSSUd1nJ5.dcf differ diff --git a/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/AllExamples.kt b/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/AllExamples.kt index c37120837..127c2efed 100644 --- a/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/AllExamples.kt +++ b/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/AllExamples.kt @@ -133,10 +133,11 @@ val EXAMPLES: ArrayList Unit, String?>> = // Animations Triple("SA", { SmartAnimateTest() }, SmartAnimateTestDoc.javaClass.name), Triple("SA Variant", { VariantAnimationTest() }, VariantAnimationTestDoc.javaClass.name), - /** - * Temporarily disabled: GH-1945 Triple( "SA Variant Timelines", { - * VariantAnimationTimelineTest() }, VariantAnimationTimelineTestDoc.javaClass.name, ), - */ + Triple( + "SA Variant Timelines", + { VariantAnimationTimelineTest() }, + VariantAnimationTimelineTestDoc.javaClass.name, + ), // No support for hyperlinks in squoosh. Triple("Hyperlink", { HyperlinkTest() }, HyperlinkValidationDoc.javaClass.name), // GH-636: Test takes too long to execute. diff --git a/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/VariantAnimationTimelineTest.DISABLED b/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/VariantAnimationTimelineTest.kt similarity index 97% rename from integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/VariantAnimationTimelineTest.DISABLED rename to integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/VariantAnimationTimelineTest.kt index 6df74f1c8..3633b695c 100644 --- a/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/VariantAnimationTimelineTest.DISABLED +++ b/integration-tests/validation/src/main/java/com/android/designcompose/testapp/validation/examples/VariantAnimationTimelineTest.kt @@ -15,7 +15,6 @@ */ package com.android.designcompose.testapp.validation.examples -/** Temporarily disabled: GH-1945 import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.tween @@ -23,7 +22,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.absoluteOffset -import androidx.compose.material.Text +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.mutableStateOf @@ -78,10 +77,10 @@ fun VariantAnimationTimelineTest() { DesignDocSettings( customVariantTransition = { context -> val defaultEasing = CubicBezierEasing(0.37f, 0f, 0.63f, 1f) - val regexMatch = tNumRegex.find(context.from?.name ?: "") + val regexMatch = tNumRegex.find(context.getFromViewName()) val tNum = regexMatch?.let { it.groupValues[1].toInt() } if ( - context.from?.name == "T3Rect" && + context.getFromViewName() == "T3Rect" && childAnimType.value != ChildAnimType.Normal ) { val delayMillis = @@ -213,4 +212,3 @@ fun VariantAnimationTimelineTest() { } } } - */