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

Commit 77019c72 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed a bug where the heads up had the wrong size

Change-Id: I05bc0e68bf4b9f786b9f0cb4466bba002a0fc4d4
parent e812652f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -45,8 +45,11 @@
    <!-- Height of a large notification in the status bar -->
    <dimen name="notification_max_height">276dp</dimen>

    <!-- Height of a medium notification in the status bar -->
    <dimen name="notification_mid_height">128dp</dimen>
    <!-- Height of a heads up notification in the status bar for legacy custom views -->
    <dimen name="notification_max_heads_up_height_legacy">128dp</dimen>

    <!-- Height of a heads up notification in the status bar -->
    <dimen name="notification_max_heads_up_height">140dp</dimen>

    <!-- Height of a the summary ("more card") notification on keyguard. -->
    <dimen name="notification_summary_height">44dp</dimen>
+16 −2
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private static final int COLORED_DIVIDER_ALPHA = 0x7B;
    private final LinearInterpolator mLinearInterpolator = new LinearInterpolator();
    private final int mNotificationMinHeightLegacy;
    private final int mMaxHeadsUpHeightLegacy;
    private final int mMaxHeadsUpHeight;
    private final int mNotificationMinHeight;
    private final int mNotificationMaxHeight;
    private int mRowMinHeight;
@@ -219,10 +221,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        boolean beforeN = mEntry.targetSdk < Build.VERSION_CODES.N;
        int minHeight = customView && beforeN && !mIsSummaryWithChildren ?
                mNotificationMinHeightLegacy : mNotificationMinHeight;
        boolean headsUpCustom = getPrivateLayout().getHeadsUpChild() != null &&
                getPrivateLayout().getHeadsUpChild().getId()
                != com.android.internal.R.id.status_bar_latest_event_content;
        int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy
                : mMaxHeadsUpHeight;
        mRowMinHeight = minHeight;
        mMaxViewHeight = mNotificationMaxHeight;
        mPrivateLayout.setSmallHeight(mRowMinHeight);
        mPublicLayout.setSmallHeight(mRowMinHeight);
        mPrivateLayout.setHeights(mRowMinHeight, headsUpheight);
        mPublicLayout.setHeights(mRowMinHeight, headsUpheight);
    }

    public StatusBarNotification getStatusBarNotification() {
@@ -386,6 +393,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    }

    public int getHeadsUpHeight() {
        if (mIsSummaryWithChildren) {
            return mChildrenContainer.getIntrinsicHeight();
        }
        return mHeadsUpHeight;
    }

@@ -463,6 +473,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
                R.dimen.notification_min_height);
        mNotificationMaxHeight =  getResources().getDimensionPixelSize(
                R.dimen.notification_max_height);
        mMaxHeadsUpHeightLegacy =  getResources().getDimensionPixelSize(
                R.dimen.notification_max_heads_up_height_legacy);
        mMaxHeadsUpHeight =  getResources().getDimensionPixelSize(
                R.dimen.notification_max_heads_up_height);
    }

    /**
+7 −7
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ public class NotificationContentView extends FrameLayout {
    private static final int VISIBLE_TYPE_SINGLELINE = 3;

    private final Rect mClipBounds = new Rect();
    private final int mHeadsUpHeight;
    private final int mRoundRectRadius;
    private final Interpolator mLinearInterpolator = new LinearInterpolator();
    private final boolean mRoundRectClippingEnabled;
@@ -77,6 +76,7 @@ public class NotificationContentView extends FrameLayout {
    private boolean mShowingLegacyBackground;
    private boolean mIsChildInGroup;
    private int mSmallHeight;
    private int mHeadsUpHeight;
    private StatusBarNotification mStatusBarNotification;
    private NotificationGroupManager mGroupManager;

@@ -103,7 +103,6 @@ public class NotificationContentView extends FrameLayout {
        super(context, attrs);
        mHybridViewManager = new HybridNotificationViewManager(getContext(), this);
        mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
        mHeadsUpHeight = getResources().getDimensionPixelSize(R.dimen.notification_mid_height);
        mRoundRectRadius = getResources().getDimensionPixelSize(
                R.dimen.notification_material_rounded_rect_radius);
        mRoundRectClippingEnabled = getResources().getBoolean(
@@ -112,8 +111,9 @@ public class NotificationContentView extends FrameLayout {
        setOutlineProvider(mOutlineProvider);
    }

    public void setSmallHeight(int smallHeight) {
    public void setHeights(int smallHeight, int headsUpMaxHeight) {
        mSmallHeight = smallHeight;
        mHeadsUpHeight = headsUpMaxHeight;
    }

    @Override
@@ -150,7 +150,7 @@ public class NotificationContentView extends FrameLayout {
            ViewGroup.LayoutParams layoutParams = mHeadsUpChild.getLayoutParams();
            if (layoutParams.height >= 0) {
                // An actual height is set
                size = Math.min(maxSize, layoutParams.height);
                size = Math.min(size, layoutParams.height);
            }
            mHeadsUpChild.measure(widthMeasureSpec,
                    MeasureSpec.makeMeasureSpec(size, MeasureSpec.AT_MOST));
@@ -283,10 +283,10 @@ public class NotificationContentView extends FrameLayout {
    }

    public int getMaxHeight() {
        if (mIsHeadsUp && mHeadsUpChild != null) {
            return mHeadsUpChild.getHeight();
        } else if (mExpandedChild != null) {
        if (mExpandedChild != null) {
            return mExpandedChild.getHeight();
        } else if (mIsHeadsUp && mHeadsUpChild != null) {
            return mHeadsUpChild.getHeight();
        }
        return mSmallHeight;
    }
+1 −1
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ public class NotificationChildrenContainer extends ViewGroup {
        if (!likeCollapsed && (mChildrenExpanded || mNotificationParent.isUserLocked())) {
            return NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED;
        }
        if (mNotificationParent.isExpanded()) {
        if (mNotificationParent.isExpanded() || mNotificationParent.isHeadsUp()) {
            return NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED;
        }
        return NUMBER_OF_CHILDREN_WHEN_COLLAPSED;