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

Commit f96f4fbf authored by Beth Thibodeau's avatar Beth Thibodeau
Browse files

Disable buttons with no action intent

Fixes: 158728328
Test: manual
Change-Id: I8ed112b5106830943b69d8fef48a9b9e128babf3
parent 4e86ccd2
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)
            }