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

Commit a5f909ff authored by Jay Aliomer's avatar Jay Aliomer
Browse files

Properly apply launch animation params

Also rename methods to make sense

Fixes: 229075523
Test: visual
Change-Id: I76e1b4904df69958e01641e362a0de60185f94af
parent a9448a67
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -7,8 +7,8 @@ import com.android.systemui.animation.Interpolators
import com.android.systemui.animation.LaunchAnimator
import com.android.systemui.animation.LaunchAnimator
import kotlin.math.min
import kotlin.math.min


/** Parameters for the notifications expand animations. */
/** Parameters for the notifications launch expanding animations. */
class ExpandAnimationParameters(
class LaunchAnimationParameters(
    top: Int,
    top: Int,
    bottom: Int,
    bottom: Int,
    left: Int,
    left: Int,
+5 −5
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ class NotificationLaunchAnimatorController(
        } else {
        } else {
            notification.currentBackgroundRadiusTop
            notification.currentBackgroundRadiusTop
        }
        }
        val params = ExpandAnimationParameters(
        val params = LaunchAnimationParameters(
            top = windowTop,
            top = windowTop,
            bottom = location[1] + height,
            bottom = location[1] + height,
            left = location[0],
            left = location[0],
@@ -165,9 +165,9 @@ class NotificationLaunchAnimatorController(
        onFinishAnimationCallback?.run()
        onFinishAnimationCallback?.run()
    }
    }


    private fun applyParams(params: ExpandAnimationParameters?) {
    private fun applyParams(params: LaunchAnimationParameters?) {
        notification.applyExpandAnimationParams(params)
        notification.applyLaunchAnimationParams(params)
        notificationListContainer.applyExpandAnimationParams(params)
        notificationListContainer.applyLaunchAnimationParams(params)
    }
    }


    override fun onLaunchAnimationProgress(
    override fun onLaunchAnimationProgress(
@@ -175,7 +175,7 @@ class NotificationLaunchAnimatorController(
        progress: Float,
        progress: Float,
        linearProgress: Float
        linearProgress: Float
    ) {
    ) {
        val params = state as ExpandAnimationParameters
        val params = state as LaunchAnimationParameters
        params.progress = progress
        params.progress = progress
        params.linearProgress = linearProgress
        params.linearProgress = linearProgress


+24 −6
Original line number Original line Diff line number Diff line
@@ -93,7 +93,7 @@ import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.SmartReplyController;
import com.android.systemui.statusbar.SmartReplyController;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
import com.android.systemui.statusbar.notification.ExpandAnimationParameters;
import com.android.systemui.statusbar.notification.LaunchAnimationParameters;
import com.android.systemui.statusbar.notification.FeedbackIcon;
import com.android.systemui.statusbar.notification.FeedbackIcon;
import com.android.systemui.statusbar.notification.NotificationFadeAware;
import com.android.systemui.statusbar.notification.NotificationFadeAware;
import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController;
import com.android.systemui.statusbar.notification.NotificationLaunchAnimatorController;
@@ -367,8 +367,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private SystemNotificationAsyncTask mSystemNotificationAsyncTask =
    private SystemNotificationAsyncTask mSystemNotificationAsyncTask =
            new SystemNotificationAsyncTask();
            new SystemNotificationAsyncTask();


    private float mTopRoundnessDuringExpandAnimation;
    private float mTopRoundnessDuringLaunchAnimation;
    private float mBottomRoundnessDuringExpandAnimation;
    private float mBottomRoundnessDuringLaunchAnimation;


    /**
    /**
     * Returns whether the given {@code statusBarNotification} is a system notification.
     * Returns whether the given {@code statusBarNotification} is a system notification.
@@ -2130,7 +2130,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }
    }




    public void applyExpandAnimationParams(ExpandAnimationParameters params) {
    public void applyLaunchAnimationParams(LaunchAnimationParameters params) {
        if (params == null) {
        if (params == null) {
            return;
            return;
        }
        }
@@ -2195,13 +2195,31 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
        }
        setTranslationY(top);
        setTranslationY(top);


        mTopRoundnessDuringExpandAnimation = params.getTopCornerRadius() / mOutlineRadius;
        mTopRoundnessDuringLaunchAnimation = params.getTopCornerRadius() / mOutlineRadius;
        mBottomRoundnessDuringExpandAnimation = params.getBottomCornerRadius() / mOutlineRadius;
        mBottomRoundnessDuringLaunchAnimation = params.getBottomCornerRadius() / mOutlineRadius;
        invalidateOutline();
        invalidateOutline();


        mBackgroundNormal.setExpandAnimationSize(params.getWidth(), actualHeight);
        mBackgroundNormal.setExpandAnimationSize(params.getWidth(), actualHeight);
    }
    }


    @Override
    public float getCurrentTopRoundness() {
        if (mExpandAnimationRunning) {
            return mTopRoundnessDuringLaunchAnimation;
        }

        return super.getCurrentTopRoundness();
    }

    @Override
    public float getCurrentBottomRoundness() {
        if (mExpandAnimationRunning) {
            return mBottomRoundnessDuringLaunchAnimation;
        }

        return super.getCurrentBottomRoundness();
    }

    public void setExpandAnimationRunning(boolean expandAnimationRunning) {
    public void setExpandAnimationRunning(boolean expandAnimationRunning) {
        if (expandAnimationRunning) {
        if (expandAnimationRunning) {
            setAboveShelf(true);
            setAboveShelf(true);
+0 −2
Original line number Original line Diff line number Diff line
@@ -29,8 +29,6 @@ import android.view.View;


import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ArrayUtils;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.notification.ExpandAnimationParameters;


/**
/**
 * A view that can be used for both the dimmed and normal background of an notification.
 * A view that can be used for both the dimmed and normal background of an notification.
+2 −2
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.annotation.Nullable;


import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
import com.android.systemui.statusbar.notification.ExpandAnimationParameters;
import com.android.systemui.statusbar.notification.LaunchAnimationParameters;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
import com.android.systemui.statusbar.notification.VisibilityLocationProvider;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -175,7 +175,7 @@ public interface NotificationListContainer extends
    /**
    /**
     * Apply parameters of the expand animation to the layout
     * Apply parameters of the expand animation to the layout
     */
     */
    default void applyExpandAnimationParams(ExpandAnimationParameters params) {}
    default void applyLaunchAnimationParams(LaunchAnimationParameters params) {}


    default void setExpandingNotification(ExpandableNotificationRow row) {}
    default void setExpandingNotification(ExpandableNotificationRow row) {}


Loading