Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfd6698a authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Rename remaining animations classes to cover transitions in general." into main

parents aa386ab7 fd3adeec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@
-packages/SystemUI/tests/src/com/android/systemui/DisplayCutoutBaseViewTest.kt
-packages/SystemUI/tests/src/com/android/systemui/InstanceIdSequenceFake.kt
-packages/SystemUI/tests/src/com/android/systemui/ScreenDecorHwcLayerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/animation/DialogLaunchAnimatorTest.kt
-packages/SystemUI/tests/src/com/android/systemui/animation/DialogTransitionAnimatorTest.kt
-packages/SystemUI/tests/src/com/android/systemui/animation/FontInterpolatorTest.kt
-packages/SystemUI/tests/src/com/android/systemui/animation/GhostedViewTransitionAnimatorControllerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/animation/TextAnimatorTest.kt
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
     limitations under the License.
-->
<resources>
    <!-- DialogLaunchAnimator -->
    <!-- DialogTransitionAnimator -->
    <item type="id" name="tag_dialog_background"/>

    <!-- ViewBoundsAnimator -->
+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@
     limitations under the License.
-->
<resources>
  <!-- An animation used by DialogLaunchAnimator to make a dialog appear instantly (to animate -->
  <!-- in-window) and disappear by fading out (when the exit into view is disabled). -->
  <!-- An animation used by DialogTransitionAnimator to make a dialog appear instantly (to -->
  <!-- animate in-window) and disappear by fading out (when the exit into view is disabled). -->
  <style name="Animation.LaunchAnimation" parent="@android:style/Animation">
    <item name="android:windowEnterAnimation">@anim/launch_dialog_enter</item>
    <item name="android:windowExitAnimation">@anim/launch_dialog_exit</item>
+16 −15
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ import com.android.systemui.util.maybeForceFullscreen
import com.android.systemui.util.registerAnimationOnBackInvoked
import kotlin.math.roundToInt

private const val TAG = "DialogLaunchAnimator"
private const val TAG = "DialogTransitionAnimator"

/**
 * A class that allows dialogs to be started in a seamless way from a view that is transforming
@@ -50,9 +50,9 @@ private const val TAG = "DialogLaunchAnimator"
 * @see show
 * @see showFromView
 * @see showFromDialog
 * @see createActivityLaunchController
 * @see createActivityTransitionController
 */
class DialogLaunchAnimator
class DialogTransitionAnimator
@JvmOverloads
constructor(
    private val callback: Callback,
@@ -166,9 +166,10 @@ constructor(
                // issues.
                if (source !is LaunchableView) {
                    throw IllegalArgumentException(
                        "A DialogLaunchAnimator.Controller was created from a View that does not " +
                            "implement LaunchableView. This can lead to subtle bugs where the " +
                            "visibility of the View we are launching from is not what we expected."
                        "A DialogTransitionAnimator.Controller was created from a View that does " +
                            "not implement LaunchableView. This can lead to subtle bugs where " +
                            "the visibility of the View we are launching from is not what we " +
                            "expected."
                    )
                }

@@ -181,7 +182,7 @@ constructor(
                    return null
                }

                return ViewDialogLaunchAnimatorController(source, cuj)
                return ViewDialogTransitionAnimatorController(source, cuj)
            }
        }
    }
@@ -305,7 +306,7 @@ constructor(
            Log.w(
                TAG,
                "Showing dialog $dialog normally as the dialog it is shown from was not shown " +
                    "using DialogLaunchAnimator"
                    "using DialogTransitionAnimator"
            )
            dialog.show()
            return
@@ -331,7 +332,7 @@ constructor(
     * @param view any view inside the dialog to animate.
     */
    @JvmOverloads
    fun createActivityLaunchController(
    fun createActivityTransitionController(
        view: View,
        cujType: Int? = null,
    ): ActivityTransitionAnimator.Controller? {
@@ -340,7 +341,7 @@ constructor(
                it.dialog.window?.decorView?.viewRootImpl == view.viewRootImpl
            }
                ?: return null
        return createActivityLaunchController(animatedDialog, cujType)
        return createActivityTransitionController(animatedDialog, cujType)
    }

    /**
@@ -355,15 +356,15 @@ constructor(
     * @param dialog the dialog to animate.
     */
    @JvmOverloads
    fun createActivityLaunchController(
    fun createActivityTransitionController(
        dialog: Dialog,
        cujType: Int? = null,
    ): ActivityTransitionAnimator.Controller? {
        val animatedDialog = openedDialogs.firstOrNull { it.dialog == dialog } ?: return null
        return createActivityLaunchController(animatedDialog, cujType)
        return createActivityTransitionController(animatedDialog, cujType)
    }

    private fun createActivityLaunchController(
    private fun createActivityTransitionController(
        animatedDialog: AnimatedDialog,
        cujType: Int? = null
    ): ActivityTransitionAnimator.Controller? {
@@ -494,14 +495,14 @@ data class DialogCuj(@CujType val cujType: Int, val tag: String? = null)

private class AnimatedDialog(
    private val transitionAnimator: TransitionAnimator,
    private val callback: DialogLaunchAnimator.Callback,
    private val callback: DialogTransitionAnimator.Callback,
    private val interactionJankMonitor: InteractionJankMonitor,

    /**
     * The controller of the source that triggered the dialog and that will animate into/from the
     * dialog.
     */
    val controller: DialogLaunchAnimator.Controller,
    val controller: DialogTransitionAnimator.Controller,

    /**
     * A callback that will be called with this [AnimatedDialog] after the dialog was dismissed and
+8 −8
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ interface Expandable {
     * @param cujType the CUJ type from the [com.android.internal.jank.InteractionJankMonitor]
     *   associated to the launch that will use this controller.
     */
    fun activityLaunchController(cujType: Int? = null): ActivityTransitionAnimator.Controller?
    fun activityTransitionController(cujType: Int? = null): ActivityTransitionAnimator.Controller?

    /**
     * Create a [DialogLaunchAnimator.Controller] that can be used to expand this [Expandable] into
     * a Dialog, or return `null` if this [Expandable] should not be animated (e.g. if it is
     * Create a [DialogTransitionAnimator.Controller] that can be used to expand this [Expandable]
     * into a Dialog, or return `null` if this [Expandable] should not be animated (e.g. if it is
     * currently not attached or visible).
     */
    fun dialogLaunchController(cuj: DialogCuj? = null): DialogLaunchAnimator.Controller?
    fun dialogTransitionController(cuj: DialogCuj? = null): DialogTransitionAnimator.Controller?

    companion object {
        /**
@@ -47,16 +47,16 @@ interface Expandable {
        @JvmStatic
        fun fromView(view: View): Expandable {
            return object : Expandable {
                override fun activityLaunchController(
                override fun activityTransitionController(
                    cujType: Int?,
                ): ActivityTransitionAnimator.Controller? {
                    return ActivityTransitionAnimator.Controller.fromView(view, cujType)
                }

                override fun dialogLaunchController(
                override fun dialogTransitionController(
                    cuj: DialogCuj?
                ): DialogLaunchAnimator.Controller? {
                    return DialogLaunchAnimator.Controller.fromView(view, cuj)
                ): DialogTransitionAnimator.Controller? {
                    return DialogTransitionAnimator.Controller.fromView(view, cuj)
                }
            }
        }
Loading