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

Commit 64a9cdfd authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Automerger Merge Worker
Browse files

Merge "Add content fade to notification dismissal" into tm-qpr-dev am: 99f5cefd

parents 8d4756ba 99f5cefd
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -337,9 +337,6 @@
     have been scrolled off-screen. -->
    <bool name="config_showNotificationShelf">true</bool>

    <!-- Whether or not the notifications should always fade as they are dismissed. -->
    <bool name="config_fadeNotificationsOnDismiss">false</bool>

    <!-- Whether or not the fade on the notification is based on the amount that it has been swiped
         off-screen. -->
    <bool name="config_fadeDependingOnAmountSwiped">false</bool>
+17 −3
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;

import androidx.annotation.VisibleForTesting;

import com.android.systemui.animation.Interpolators;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
@@ -66,7 +68,7 @@ public class SwipeHelper implements Gefingerpoken {
    private static final int MAX_DISMISS_VELOCITY = 4000; // dp/sec
    private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 150; // ms

    static final float SWIPE_PROGRESS_FADE_END = 0.5f; // fraction of thumbnail width
    public static final float SWIPE_PROGRESS_FADE_END = 0.6f; // fraction of thumbnail width
                                              // beyond which swipe progress->0
    public static final float SWIPED_FAR_ENOUGH_SIZE_FRACTION = 0.6f;
    static final float MAX_SCROLL_SIZE_FRACTION = 0.3f;
@@ -235,7 +237,11 @@ public class SwipeHelper implements Gefingerpoken {
        return Math.min(Math.max(mMinSwipeProgress, result), mMaxSwipeProgress);
    }

    private float getSwipeAlpha(float progress) {
    /**
     * Returns the alpha value depending on the progress of the swipe.
     */
    @VisibleForTesting
    public float getSwipeAlpha(float progress) {
        if (mFadeDependingOnAmountSwiped) {
            // The more progress has been fade, the lower the alpha value so that the view fades.
            return Math.max(1 - progress, 0);
@@ -260,7 +266,7 @@ public class SwipeHelper implements Gefingerpoken {
                        animView.setLayerType(View.LAYER_TYPE_NONE, null);
                    }
                }
                animView.setAlpha(getSwipeAlpha(swipeProgress));
                updateSwipeProgressAlpha(animView, getSwipeAlpha(swipeProgress));
            }
        }
        invalidateGlobalRegion(animView);
@@ -561,6 +567,14 @@ public class SwipeHelper implements Gefingerpoken {
        mCallback.onChildSnappedBack(animView, targetLeft);
    }


    /**
     * Called to update the content alpha while the view is swiped
     */
    protected void updateSwipeProgressAlpha(View animView, float alpha) {
        animView.setAlpha(alpha);
    }

    /**
     * Give the swipe helper itself a chance to do something on snap back so NSSL doesn't have
     * to tell us what to do
+3 −1
Original line number Diff line number Diff line
@@ -71,7 +71,9 @@ public class Flags {
    public static final UnreleasedFlag NOTIFICATION_MEMORY_MONITOR_ENABLED = new UnreleasedFlag(112,
            false);

    // next id: 112
    public static final UnreleasedFlag NOTIFICATION_DISMISSAL_FADE = new UnreleasedFlag(113, true);

    // next id: 114

    /***************************************/
    // 200 - keyguard/lockscreen
+14 −0
Original line number Diff line number Diff line
@@ -1477,6 +1477,20 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    /**
     * Sets the alpha on the content, while leaving the background of the row itself as is.
     *
     * @param alpha alpha value to apply to the notification content
     */
    public void setContentAlpha(float alpha) {
        for (NotificationContentView l : mLayouts) {
            l.setAlpha(alpha);
        }
        if (mChildrenContainer != null) {
            mChildrenContainer.setAlpha(alpha);
        }
    }

    public void setIsLowPriority(boolean isLowPriority) {
        mIsLowPriority = isLowPriority;
        mPrivateLayout.setIsLowPriority(isLowPriority);
+7 −5
Original line number Diff line number Diff line
@@ -56,12 +56,13 @@ import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.ExpandHelper;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.R;
import com.android.systemui.SwipeHelper;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.media.KeyguardMediaController;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
@@ -178,6 +179,7 @@ public class NotificationStackScrollLayoutController {
    @Nullable private Boolean mHistoryEnabled;
    private int mBarState;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;
    private final FeatureFlags mFeatureFlags;

    private View mLongPressedView;

@@ -639,7 +641,8 @@ public class NotificationStackScrollLayoutController {
            InteractionJankMonitor jankMonitor,
            StackStateLogger stackLogger,
            NotificationStackScrollLogger logger,
            NotificationStackSizeCalculator notificationStackSizeCalculator) {
            NotificationStackSizeCalculator notificationStackSizeCalculator,
            FeatureFlags featureFlags) {
        mStackStateLogger = stackLogger;
        mLogger = logger;
        mAllowLongPress = allowLongPress;
@@ -675,6 +678,7 @@ public class NotificationStackScrollLayoutController {
        mUiEventLogger = uiEventLogger;
        mRemoteInputManager = remoteInputManager;
        mShadeController = shadeController;
        mFeatureFlags = featureFlags;
        updateResources();
    }

@@ -739,9 +743,7 @@ public class NotificationStackScrollLayoutController {

        mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener);

        mFadeNotificationsOnDismiss =  // TODO: this should probably be injected directly
                mResources.getBoolean(R.bool.config_fadeNotificationsOnDismiss);

        mFadeNotificationsOnDismiss = mFeatureFlags.isEnabled(Flags.NOTIFICATION_DISMISSAL_FADE);
        mNotificationRoundnessManager.setOnRoundingChangedCallback(mView::invalidate);
        mView.addOnExpandedHeightChangedListener(mNotificationRoundnessManager::setExpanded);

Loading