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

Commit 3e1dc20f authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Add rounded corners attribute to window animations

Windows now can have rounded corners that match the display shape,
this CL introduces a new xml attribute called hasRoundedCorners that
enables this feature when declared on an animation xml.

Bug: 111514493
Test: winscope
Test: atest WindowAnimationSpecTest
Change-Id: Ie7651bab00c6e9e0ab7ab50cdb14142c8b2b954b
parent c81eb674
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public abstract class Animation implements Cloneable {
    private float mScaleFactor = 1f;

    private boolean mShowWallpaper;
    private boolean mHasRoundedCorners;

    private boolean mMore = true;
    private boolean mOneMoreTime = true;
@@ -263,6 +264,8 @@ public abstract class Animation implements Cloneable {
                a.getBoolean(com.android.internal.R.styleable.Animation_detachWallpaper, false));
        setShowWallpaper(
                a.getBoolean(com.android.internal.R.styleable.Animation_showWallpaper, false));
        setHasRoundedCorners(
                a.getBoolean(com.android.internal.R.styleable.Animation_hasRoundedCorners, false));

        final int resID = a.getResourceId(com.android.internal.R.styleable.Animation_interpolator, 0);

@@ -677,6 +680,19 @@ public abstract class Animation implements Cloneable {
        mShowWallpaper = showWallpaper;
    }

    /**
     * If this is a window animation, the window will have rounded corners matching the display
     * corner radius.
     *
     * @param hasRoundedCorners Whether the window should have rounded corners or not.
     * @attr ref android.R.styleable#Animation_hasRoundedCorners
     * @see com.android.internal.policy.ScreenDecorationsUtils#getWindowCornerRadius(Resources)
     * @hide
     */
    public void setHasRoundedCorners(boolean hasRoundedCorners) {
        mHasRoundedCorners = hasRoundedCorners;
    }

    /**
     * Gets the acceleration curve type for this animation.
     *
@@ -803,6 +819,16 @@ public abstract class Animation implements Cloneable {
        return mShowWallpaper;
    }

    /**
     * @return if a window animation should have rounded corners or not.
     *
     * @attr ref android.R.styleable#Animation_hasRoundedCorners
     * @hide
     */
    public boolean hasRoundedCorners() {
        return mHasRoundedCorners;
    }

    /**
     * <p>Indicates whether or not this animation will affect the transformation
     * matrix. For instance, a fade animation will not affect the matrix whereas
+3 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@
-->
<!-- This should be kept in sync with task_open_enter.xml -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false" android:zAdjustment="top">
     android:hasRoundedCorners="true"
     android:shareInterpolator="false"
     android:zAdjustment="top">

    <alpha
        android:fromAlpha="1"
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false"
    android:zAdjustment="top"
    android:hasRoundedCorners="true"
    android:showWallpaper="true">

    <alpha
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false"
    android:hasRoundedCorners="true"
    android:showWallpaper="true">

    <alpha
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false"
    android:zAdjustment="top"
    android:hasRoundedCorners="true"
    android:showWallpaper="true">

    <alpha
Loading