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

Commit 78a34d01 authored by Yuri Lin's avatar Yuri Lin Committed by Android (Google) Code Review
Browse files

Merge "Add isParentGroupExpanded method to ExpandableNotificationRow" into main

parents ecb6430e e7cfe80a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -3383,6 +3383,20 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return mGroupExpansionManager.isGroupExpanded(getEntryLegacy());
    }

    /**
     * If this notification is a child of a group, returns whether the parent group is expanded.
     * This is distinct from isGroupExpanded() specifically in the case of nested groups (for
     * example, if a group is contained inside a bundle).
     *
     * Returns false if the notification is not a child of a group.
     */
    public boolean isParentGroupExpanded() {
        if (isChildInGroup()) {
            return getNotificationParent().isGroupExpanded();
        }
        return false;
    }

    @VisibleForTesting
    boolean isGroupRoot() {
        return NotificationBundleUi.isEnabled()
+12 −6
Original line number Diff line number Diff line
@@ -902,7 +902,7 @@ public class NotificationContentView extends FrameLayout implements Notification
    }

    public int getMinHeight(boolean likeGroupExpanded) {
        if (likeGroupExpanded || !mIsChildInGroup || isGroupExpanded()) {
        if (likeGroupExpanded || !mIsChildInGroup || isParentGroupExpanded()) {
            return mContractedChild != null
                    ? getViewHeight(VISIBLE_TYPE_CONTRACTED) : mMinContractedHeight;
        } else {
@@ -928,6 +928,10 @@ public class NotificationContentView extends FrameLayout implements Notification
        return mContainingNotification.isGroupExpanded();
    }

    private boolean isParentGroupExpanded() {
        return mContainingNotification.isParentGroupExpanded();
    }

    public void setClipTopAmount(int clipTopAmount) {
        mClipTopAmount = clipTopAmount;
        updateClipping();
@@ -1264,6 +1268,10 @@ public class NotificationContentView extends FrameLayout implements Notification
        }
    }

    private boolean shouldShowSingleLineView() {
        return mIsChildInGroup && !isParentGroupExpanded();
    }

    /**
     * @return one of the static enum types in this view, calculated from the current state
     */
@@ -1277,14 +1285,13 @@ public class NotificationContentView extends FrameLayout implements Notification
                height = mContentHeight;
            }
            int expandedVisualType = getVisualTypeForHeight(height);
            final boolean shouldShowSingleLineView = mIsChildInGroup && !isGroupExpanded();
            final boolean isSingleLineViewPresent = mSingleLineView != null;

            if (shouldShowSingleLineView && !isSingleLineViewPresent) {
            if (shouldShowSingleLineView() && !isSingleLineViewPresent) {
                Log.wtf(TAG, "calculateVisibleType: SingleLineView is not available!");
            }

            final int collapsedVisualType = shouldShowSingleLineView && isSingleLineViewPresent
            final int collapsedVisualType = shouldShowSingleLineView() && isSingleLineViewPresent
                    ? VISIBLE_TYPE_SINGLELINE
                    : getVisualTypeForHeight(mContainingNotification.getCollapsedHeight());
            return mTransformationStartVisibleType == collapsedVisualType
@@ -1305,10 +1312,9 @@ public class NotificationContentView extends FrameLayout implements Notification
        if (!noExpandedChild && viewHeight == getViewHeight(VISIBLE_TYPE_EXPANDED)) {
            return VISIBLE_TYPE_EXPANDED;
        }
        final boolean shouldShowSingleLineView = mIsChildInGroup && !isGroupExpanded();
        final boolean isSingleLinePresent =  mSingleLineView != null;

        if (!mUserExpanding && shouldShowSingleLineView && isSingleLinePresent) {
        if (!mUserExpanding && shouldShowSingleLineView() && isSingleLinePresent) {
            return VISIBLE_TYPE_SINGLELINE;
        }