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

Commit c59da455 authored by Selim Cinek's avatar Selim Cinek
Browse files

Ensured that Children within Bundles also have their notgoneindex set

Previously this was only going over one layer of depth, now it's
recursive.

Flag: com.android.systemui.notification_bundle_ui
Test: manual testing, debugging
Change-Id: I31cd82e839206184276a77eef34b2ba41713673e
parent b8c44333
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -491,21 +491,8 @@ public class StackScrollAlgorithm {
                    }
                }

                notGoneIndex = updateNotGoneIndex(state, notGoneIndex, v);
                if (v instanceof ExpandableNotificationRow row) {

                    // handle the notGoneIndex for the children as well
                    List<ExpandableNotificationRow> children = row.getAttachedChildren();
                    if (row.isSummaryWithChildren() && children != null) {
                        for (ExpandableNotificationRow childRow : children) {
                            if (childRow.getVisibility() != View.GONE) {
                                ExpandableViewState childState = childRow.getViewState();
                                childState.notGoneIndex = notGoneIndex;
                                notGoneIndex++;
                            }
                        }
                    }
                }
                state.visibleChildren.add(v);
                notGoneIndex = updateNotGoneIndex(notGoneIndex, v);
            }
        }

@@ -549,12 +536,28 @@ public class StackScrollAlgorithm {
        }
    }

    private int updateNotGoneIndex(StackScrollAlgorithmState state, int notGoneIndex,
            ExpandableView v) {
    private int updateNotGoneIndex(int notGoneIndex, ExpandableView v) {
        ExpandableViewState viewState = v.getViewState();
        viewState.notGoneIndex = notGoneIndex;
        state.visibleChildren.add(v);
        notGoneIndex++;
        if (v instanceof ExpandableNotificationRow row) {

            // handle the notGoneIndex for the children as well
            List<ExpandableNotificationRow> children = row.getAttachedChildren();
            if (row.isSummaryWithChildren() && children != null) {
                for (ExpandableNotificationRow childRow : children) {
                    if (childRow.getVisibility() != View.GONE) {
                        if (NotificationBundleUi.isEnabled()) {
                            notGoneIndex = updateNotGoneIndex(notGoneIndex, childRow);
                        } else {
                            ExpandableViewState childState = childRow.getViewState();
                            childState.notGoneIndex = notGoneIndex;
                            notGoneIndex++;
                        }
                    }
                }
            }
        }
        return notGoneIndex;
    }