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

Commit 85ce6f1b authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Add flags to enable Notifications clipping." into tm-qpr-dev

parents a3542e18 89d57390
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@
    <!-- Whether to enable clipping on Quick Settings -->
    <bool name="qs_enable_clipping">true</bool>

    <!-- Whether to enable clipping on Notification Views -->
    <bool name="notification_enable_clipping">true</bool>

    <!-- Whether to enable transparent background for notification scrims -->
    <bool name="notification_scrim_transparent">false</bool>
</resources>
+7 −4
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private int[] mTmp = new int[2];
    private boolean mHideBackground;
    private int mStatusBarHeight;
    private boolean mEnableNotificationClipping;
    private AmbientState mAmbientState;
    private NotificationStackScrollLayoutController mHostLayoutController;
    private int mPaddingBetweenElements;
@@ -117,7 +118,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        // Setting this to first in section to get the clipping to the top roundness correct. This
        // value determines the way we are clipping to the top roundness of the overall shade
        setFirstInSection(true);
        initDimens();
        updateResources();
    }

    public void bind(AmbientState ambientState,
@@ -126,7 +127,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        mHostLayoutController = hostLayoutController;
    }

    private void initDimens() {
    private void updateResources() {
        Resources res = getResources();
        mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
        mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);
@@ -144,6 +145,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf);
        mCornerAnimationDistance = res.getDimensionPixelSize(
                R.dimen.notification_corner_animation_distance);
        mEnableNotificationClipping = res.getBoolean(R.bool.notification_enable_clipping);

        mShelfIcons.setInNotificationIconShelf(true);
        if (!mShowNotificationShelf) {
@@ -154,7 +156,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        initDimens();
        updateResources();
    }

    @Override
@@ -639,7 +641,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
        if (!isPinned) {
            if (viewEnd > notificationClipEnd && !shouldClipOwnTop) {
                int clipBottomAmount = (int) (viewEnd - notificationClipEnd);
                int clipBottomAmount =
                        mEnableNotificationClipping ? (int) (viewEnd - notificationClipEnd) : 0;
                view.setClipBottomAmount(clipBottomAmount);
            } else {
                view.setClipBottomAmount(0);
+3 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class StackScrollAlgorithm {
    private float mGapHeight;
    private float mGapHeightOnLockscreen;
    private int mCollapsedSize;
    private boolean mEnableNotificationClipping;

    private StackScrollAlgorithmState mTempAlgorithmState = new StackScrollAlgorithmState();
    private boolean mIsExpanded;
@@ -85,6 +86,7 @@ public class StackScrollAlgorithm {
        mPaddingBetweenElements = res.getDimensionPixelSize(
                R.dimen.notification_divider_height);
        mCollapsedSize = res.getDimensionPixelSize(R.dimen.notification_min_height);
        mEnableNotificationClipping = res.getBoolean(R.bool.notification_enable_clipping);
        mClipNotificationScrollToTop = res.getBoolean(R.bool.config_clipNotificationScrollToTop);
        int statusBarHeight = SystemBarUtils.getStatusBarHeight(context);
        mHeadsUpInset = statusBarHeight + res.getDimensionPixelSize(
@@ -289,7 +291,7 @@ public class StackScrollAlgorithm {
                // The bottom of this view is peeking out from under the previous view.
                // Clip the part that is peeking out.
                float overlapAmount = newNotificationEnd - firstHeadsUpEnd;
                state.clipBottomAmount = (int) overlapAmount;
                state.clipBottomAmount = mEnableNotificationClipping ? (int) overlapAmount : 0;
            } else {
                state.clipBottomAmount = 0;
            }