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

Commit b8716b54 authored by Steven Kester Yuwono's avatar Steven Kester Yuwono Committed by Android (Google) Code Review
Browse files

Merge "Remove empty space when suppressing action buttons and there are no buttons left." into main

parents 0ea5dd99 37d74e73
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1837,13 +1837,24 @@ public class NotificationContentView extends FrameLayout implements Notification
            if (DEBUG && !suppressedActionIndices.isEmpty()) {
                Log.d(TAG, "Suppressing actions with indices: " + suppressedActionIndices);
            }
            int suppressedActionCount = 0;
            for (int i = 0; i < actionsList.getChildCount(); i++) {
                View actionBtn = actionsList.getChildAt(i);
                Object actionIndex =
                        actionBtn.getTag(com.android.internal.R.id.notification_action_index_tag);
                boolean suppressAction = actionIndex instanceof Integer
                        && suppressedActionIndices.contains(actionIndex);
                actionBtn.setVisibility(suppressAction ? View.GONE : View.VISIBLE);
                if (suppressAction) {
                    actionBtn.setVisibility(View.GONE);
                    suppressedActionCount++;
                } else {
                    actionBtn.setVisibility(View.VISIBLE);
                }
            }
            // If all the actions in the actionList ViewGroup are suppressed, hide the ViewGroup
            // as well to remove the empty space with no action buttons.
            if (suppressedActionCount >= actionsList.getChildCount()) {
                actionsList.setVisibility(View.GONE);
            }
        }
    }