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

Commit 5bc852a9 authored by Selim Cinek's avatar Selim Cinek
Browse files

Improved touch handling with groups and HUNS

Groups with HUNED children now don't totally destroy the touch
handling anymore.

Change-Id: I815260e22c59e939de12315a393de108fc0b47ab
parent 5104a6db
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -384,6 +384,13 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
            for (HeadsUpEntry entry : mSortedEntries) {
                ExpandableNotificationRow row = entry.entry.row;
                if (row.isPinned()) {
                    if (row.isChildInGroup()) {
                        final ExpandableNotificationRow groupSummary
                                = mGroupManager.getGroupSummary(row.getStatusBarNotification());
                        if (groupSummary != null) {
                            row = groupSummary;
                        }
                    }
                    row.getLocationOnScreen(mTmpTwoArray);
                    minX = mTmpTwoArray[0];
                    maxX = mTmpTwoArray[0] + row.getWidth();
@@ -495,9 +502,18 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL
     */
    public int getTopHeadsUpPinnedHeight() {
        HeadsUpEntry topEntry = getTopEntry();
        return topEntry != null && topEntry.entry != null
                ? topEntry.entry.row.getPinnedHeadsUpHeight(true /* atLeastMinHeight */)
                : 0;
        if (topEntry == null || topEntry.entry == null) {
            return 0;
        }
        ExpandableNotificationRow row = topEntry.entry.row;
        if (row.isChildInGroup()) {
            final ExpandableNotificationRow groupSummary
                    = mGroupManager.getGroupSummary(row.getStatusBarNotification());
            if (groupSummary != null) {
                row = groupSummary;
            }
        }
        return row.getPinnedHeadsUpHeight(true /* atLeastMinHeight */);
    }

    /**
+12 −6
Original line number Diff line number Diff line
@@ -363,14 +363,14 @@ public class NotificationStackScrollLayout extends ViewGroup
        updateContentHeight();
        clampScrollPosition();
        if (mRequestViewResizeAnimationOnLayout) {
            requestAnimationOnViewResize();
            requestAnimationOnViewResize(null);
            mRequestViewResizeAnimationOnLayout = false;
        }
        requestChildrenUpdate();
    }

    private void requestAnimationOnViewResize() {
        if (mIsExpanded && mAnimationsEnabled) {
    private void requestAnimationOnViewResize(ExpandableNotificationRow row) {
        if (mAnimationsEnabled && (mIsExpanded || row != null && row.isPinned())) {
            mNeedViewResizeAnimation = true;
            mNeedsAnimation = true;
        }
@@ -730,7 +730,10 @@ public class NotificationStackScrollLayout extends ViewGroup
                if (slidingChild instanceof ExpandableNotificationRow) {
                    ExpandableNotificationRow row = (ExpandableNotificationRow) slidingChild;
                    if (!mIsExpanded && row.isHeadsUp() && row.isPinned()
                            && mHeadsUpManager.getTopEntry().entry.row != row) {
                            && mHeadsUpManager.getTopEntry().entry.row != row
                            && mGroupManager.getGroupSummary(
                                mHeadsUpManager.getTopEntry().entry.row.getStatusBarNotification())
                                != row) {
                        continue;
                    }
                    return row.getViewAtPosition(touchY - childTop);
@@ -2338,7 +2341,10 @@ public class NotificationStackScrollLayout extends ViewGroup
        clampScrollPosition();
        notifyHeightChangeListener(view);
        if (needsAnimation) {
            requestAnimationOnViewResize();
            ExpandableNotificationRow row = view instanceof ExpandableNotificationRow
                    ? (ExpandableNotificationRow) view
                    : null;
            requestAnimationOnViewResize(row);
        }
        requestChildrenUpdate();
    }
@@ -2802,7 +2808,7 @@ public class NotificationStackScrollLayout extends ViewGroup

    @Override
    public void onGroupExpansionChanged(ExpandableNotificationRow changedRow, boolean expanded) {
        boolean animated = mAnimationsEnabled && mIsExpanded;
        boolean animated = mAnimationsEnabled && (mIsExpanded || changedRow.isPinned());
        if (animated) {
            mExpandedGroupView = changedRow;
            mNeedsAnimation = true;