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

Commit f8aaf7ab authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Automerger Merge Worker
Browse files

Implementation of the FooterActions following the MAD (1/3) am: 6fb22d4b

parents bba6ca46 6fb22d4b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ android_library {
    libs: [
        "android.test.runner",
        "android.test.base",
        "android.test.mock",
    ],
    kotlincflags: ["-Xjvm-default=enable"],
    aaptflags: [
+1 −2
Original line number Diff line number Diff line
@@ -311,8 +311,7 @@ class ActivityLaunchAnimator(
            @JvmStatic
            fun fromView(view: View, cujType: Int? = null): Controller? {
                if (view.parent !is ViewGroup) {
                    // TODO(b/192194319): Throw instead of just logging.
                    Log.wtf(
                    Log.e(
                        TAG,
                        "Skipping animation as view $view is not attached to a ViewGroup",
                        Exception()
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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 com.android.systemui.animation

import android.view.View

/** A piece of UI that can be expanded into a Dialog or an Activity. */
interface Expandable {
    /**
     * Create an [ActivityLaunchAnimator.Controller] that can be used to expand this [Expandable]
     * into an Activity, or return `null` if this [Expandable] should not be animated (e.g. if it is
     * currently not attached or visible).
     *
     * @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): ActivityLaunchAnimator.Controller?

    // TODO(b/230830644): Introduce DialogLaunchAnimator and a function to expose it here.

    companion object {
        /**
         * Create an [Expandable] that will animate [view] when expanded.
         *
         * Note: The background of [view] should be a (rounded) rectangle so that it can be properly
         * animated.
         */
        fun fromView(view: View): Expandable {
            return object : Expandable {
                override fun activityLaunchController(
                    cujType: Int?,
                ): ActivityLaunchAnimator.Controller? {
                    return ActivityLaunchAnimator.Controller.fromView(view, cujType)
                }
            }
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,11 @@ android_library {
        "testables",
        "truth-prebuilt",
        "androidx.test.uiautomator",
        "kotlinx_coroutines_test",
    ],

    libs: [
        "android.test.mock",
    ],

    kotlincflags: ["-Xjvm-default=all"],
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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 com.android.systemui.common.shared.model

import android.annotation.StringRes

/**
 * Models a content description, that can either be already [loaded][ContentDescription.Loaded] or
 * be a [reference][ContentDescription.Resource] to a resource.
 */
sealed class ContentDescription {
    data class Loaded(
        val description: String?,
    ) : ContentDescription()

    data class Resource(
        @StringRes val res: Int,
    ) : ContentDescription()
}
Loading