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

Commit 9131397d authored by Christian Göllner's avatar Christian Göllner
Browse files

Split shade motion: improve expansion timing

In this CL the approach is the following:
1 - Define a minimum content height in NSSL for split shade
2 - Use the minimum height when computing Nssl#getEmptyBottomMargin()
3 - Components (Npvc) that calculate expansion fraction already use
    Nssl#getEmptyBottomMargin().

Bug: 213585177
Test: Manually
Change-Id: Id74531a95300ed093edb21c379b57b4ce6836771
parent 7d8c3ad7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -369,6 +369,13 @@
    <!-- The top margin of the panel that holds the list of notifications. -->
    <dimen name="notification_panel_margin_top">0dp</dimen>

    <!-- The minimum content height for the split shade NSSL.
         It is used because if the height is too small, the expansion motion is too fast.
         Note that the value of 256dp is more or less a random value and can be changed to tweak
         the expansion motion.
    -->
    <dimen name="nssl_split_shade_min_content_height">256dp</dimen>

    <!-- The bottom margin of the panel that holds the list of notifications. -->
    <dimen name="notification_panel_margin_bottom">0dp</dimen>

+14 −1
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private int mBottomMargin;
    private int mBottomInset = 0;
    private float mQsExpansionFraction;
    private final int mSplitShadeMinContentHeight;

    /**
     * The algorithm which calculates the properties for our children
@@ -583,6 +584,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                .getDefaultColor();
        int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
        int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
        mSplitShadeMinContentHeight = res.getDimensionPixelSize(
                R.dimen.nssl_split_shade_min_content_height);
        mExpandHelper = new ExpandHelper(getContext(), mExpandHelperCallback,
                minHeight, maxHeight);
        mExpandHelper.setEventSource(this);
@@ -3886,7 +3889,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

    @ShadeViewRefactor(RefactorComponent.COORDINATOR)
    int getEmptyBottomMargin() {
        return Math.max(mMaxLayoutHeight - mContentHeight, 0);
        int contentHeight;
        if (mShouldUseSplitNotificationShade) {
            // When in split shade and there are no notifications, the height can be too low, as
            // it is based on notifications bottom, which is lower on split shade.
            // Here we prefer to use at least a minimum height defined for split shade.
            // Otherwise the expansion motion is too fast.
            contentHeight = Math.max(mSplitShadeMinContentHeight, mContentHeight);
        } else {
            contentHeight = mContentHeight;
        }
        return Math.max(mMaxLayoutHeight - contentHeight, 0);
    }

    @ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)