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

Commit 6c24afe4 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'more_groups'

* changes:
  Fixed a bug where the heads up had the wrong size
  Adapted the appear animation for notification children
  Added darkmode for notification groups
  And suddenly notification children appeared
parents 6f176f70 77019c72
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>
+24 −8
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
@@ -35,13 +36,19 @@ public class ViewInvertHelper {

    private final Paint mDarkPaint = new Paint();
    private final Interpolator mLinearOutSlowInInterpolator;
    private final ArrayList<View> mTargets;
    private final ColorMatrix mMatrix = new ColorMatrix();
    private final ColorMatrix mGrayscaleMatrix = new ColorMatrix();
    private final long mFadeDuration;
    private final ArrayList<View> mTargets = new ArrayList<>();

    public ViewInvertHelper(View target, long fadeDuration) {
        this(constructArray(target), fadeDuration);
    public ViewInvertHelper(View v, long fadeDuration) {
        this(v.getContext(), fadeDuration);
        addTarget(v);
    }
    public ViewInvertHelper(Context context, long fadeDuration) {
        mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
                android.R.interpolator.linear_out_slow_in);
        mFadeDuration = fadeDuration;
    }

    private static ArrayList<View> constructArray(View target) {
@@ -50,11 +57,12 @@ public class ViewInvertHelper {
        return views;
    }

    public ViewInvertHelper(ArrayList<View> targets, long fadeDuration) {
        mTargets = targets;
        mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(mTargets.get(0).getContext(),
                android.R.interpolator.linear_out_slow_in);
        mFadeDuration = fadeDuration;
    public void clearTargets() {
        mTargets.clear();
    }

    public void addTarget(View target) {
        mTargets.add(target);
    }

    public void fade(final boolean invert, long delay) {
@@ -112,4 +120,12 @@ public class ViewInvertHelper {
        mMatrix.preConcat(mGrayscaleMatrix);
        mDarkPaint.setColorFilter(new ColorMatrixColorFilter(mMatrix));
    }

    public void setInverted(boolean invert, boolean fade, long delay) {
        if (fade) {
            fade(invert, delay);
        } else {
            update(invert);
        }
    }
}
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -127,8 +127,8 @@ public abstract class BaseStatusBar extends SystemUI implements

    public static final boolean ENABLE_REMOTE_INPUT =
            SystemProperties.getBoolean("debug.enable_remote_input", true);
    public static final boolean ENABLE_CHILD_NOTIFICATIONS = Build.IS_DEBUGGABLE
                    && SystemProperties.getBoolean("debug.child_notifs", false);
    public static final boolean ENABLE_CHILD_NOTIFICATIONS
            = SystemProperties.getBoolean("debug.child_notifs", true);

    protected static final int MSG_SHOW_RECENT_APPS = 1019;
    protected static final int MSG_HIDE_RECENT_APPS = 1020;
+24 −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;
@@ -95,6 +97,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private boolean mIsHeadsUp;
    private boolean mLastChronometerRunning = true;
    private NotificationHeaderView mNotificationHeader;
    private NotificationViewWrapper mNotificationHeaderWrapper;
    private ViewStub mChildrenContainerStub;
    private NotificationGroupManager mGroupManager;
    private boolean mChildrenExpanded;
@@ -218,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() {
@@ -385,6 +393,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    }

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

@@ -462,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);
    }

    /**
@@ -570,6 +585,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        if (showing != null) {
            showing.setDark(dark, fade, delay);
        }
        if (mIsSummaryWithChildren) {
            mChildrenContainer.setDark(dark, fade, delay);
            mNotificationHeaderWrapper.setDark(dark, fade, delay);
        }
    }

    public boolean isExpandable() {
@@ -967,9 +986,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
                    com.android.internal.R.id.expand_button);
            expandButton.setVisibility(VISIBLE);
            mNotificationHeader.setOnClickListener(mExpandClickListener);
            mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(),
                    mNotificationHeader);
            addView(mNotificationHeader);
        } else {
            header.reapply(getContext(), mNotificationHeader);
            mNotificationHeaderWrapper.notifyContentUpdated();
        }
        updateHeaderExpandButton();
        updateChildrenHeaderAppearance();
+10 −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;
    }
@@ -457,6 +457,9 @@ public class NotificationContentView extends FrameLayout {
        if (mDark == dark || mContractedChild == null) return;
        mDark = dark;
        mContractedWrapper.setDark(dark && !mShowingLegacyBackground, fade, delay);
        if (mSingleLineView != null) {
            mSingleLineView.setDark(dark, fade, delay);
        }
    }

    public void setHeadsUp(boolean headsUp) {
Loading