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

Commit 07cf49ff authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

Merge "Disable buttons with no action intent" into rvc-dev am: fd10b83c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11843853

Change-Id: I5a617427f9bdc904eb6b2fbc7c1139c814bca015
parents 36573354 fd10b83c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -302,11 +302,14 @@ public class MediaControlPanel {
            button.setContentDescription(mediaAction.getContentDescription());
            Runnable action = mediaAction.getAction();

            if (action == null) {
                button.setEnabled(false);
            } else {
                button.setEnabled(true);
                button.setOnClickListener(v -> {
                if (action != null) {
                    action.run();
                }
                });
            }
            boolean visibleInCompat = actionsWhenCollapsed.contains(i);
            setVisibleAndAlpha(collapsedSet, actionId, visibleInCompat);
            setVisibleAndAlpha(expandedSet, actionId, true /*visible */);
+12 −7
Original line number Diff line number Diff line
@@ -366,15 +366,20 @@ class MediaDataManager @Inject constructor(
                    actionsToShowCollapsed.remove(index)
                    continue
                }
                val mediaAction = MediaAction(
                        action.getIcon().loadDrawable(packageContext),
                val runnable = if (action.actionIntent != null) {
                    Runnable {
                        try {
                            action.actionIntent.send()
                        } catch (e: PendingIntent.CanceledException) {
                            Log.d(TAG, "Intent canceled", e)
                        }
                        },
                    }
                } else {
                    null
                }
                val mediaAction = MediaAction(
                        action.getIcon().loadDrawable(packageContext),
                        runnable,
                        action.title)
                actionIcons.add(mediaAction)
            }