diff options
author | 2025-03-17 22:23:51 -0700 | |
---|---|---|
committer | 2025-03-18 11:56:53 -0700 | |
commit | 45f3c97c903676a53571f2ce7122f409f92b00b0 (patch) | |
tree | 083cf588e59c2b5720725f61e18b4ecd67dfe61a | |
parent | 8ef4bffedaba3d630f69e93b89d89189987eba78 (diff) |
Extract legacy UI logic and place it outside of shared components.
Move the logic to show the ongoing session indicator in the status icon
position from MediaOutputAdapterBase to MediaOutputAdapterLegacy
since it doesn't apply to the refreshed UI.
Bug: 386411078
Fix: 386411078
Flag: EXEMPT refactor
Test: atest SystemUiRoboTests:com.android.systemui.media.dialog,
atest SystemUIGoogleRoboRNGTests:com.android.systemui.media.dialog
Change-Id: I9e67e8d3fe9f0748ab0b931dd457ab2482e599e9
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterBase.java | 11 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java | 17 |
2 files changed, 16 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterBase.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterBase.java index ac1672db9375..e3990d25f94e 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterBase.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterBase.java @@ -237,8 +237,7 @@ public abstract class MediaOutputAdapterBase extends RecyclerView.Adapter<Recycl clickListener = v -> onItemClick(v, device); } } else { - deviceStatusIcon = getDeviceStatusIcon(device, - device.hasOngoingSession()); + deviceStatusIcon = getDeviceStatusIcon(device); clickListener = getClickListenerBasedOnSelectionBehavior(device); } deviceDisabled = clickListener == null; @@ -302,12 +301,8 @@ public abstract class MediaOutputAdapterBase extends RecyclerView.Adapter<Recycl } @Nullable - private Drawable getDeviceStatusIcon(MediaDevice device, boolean hasOngoingSession) { - if (hasOngoingSession) { - return mContext.getDrawable(R.drawable.ic_sound_bars_anim); - } else { - return Api34Impl.getDeviceStatusIconBasedOnSelectionBehavior(device, mContext); - } + private Drawable getDeviceStatusIcon(MediaDevice device) { + return Api34Impl.getDeviceStatusIconBasedOnSelectionBehavior(device, mContext); } protected void onExpandGroupButtonClicked() { diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java index 6ab4a52dc919..7ab6b3cfb8b1 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java @@ -231,7 +231,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { updateFullItemClickListener(clickListener); updateContentAlpha(deviceDisabled); updateSubtitle(subtitle); - updateDeviceStatusIcon(deviceStatusIcon); + updateDeviceStatusIcon(deviceStatusIcon, ongoingSessionStatus, connectionState); updateItemBackground(connectionState); } @@ -523,11 +523,20 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { mStatusIcon.setAlpha(alphaValue); } - private void updateDeviceStatusIcon(@Nullable Drawable deviceStatusIcon) { - if (deviceStatusIcon == null) { + private void updateDeviceStatusIcon(@Nullable Drawable deviceStatusIcon, + @Nullable OngoingSessionStatus ongoingSessionStatus, + ConnectionState connectionState) { + boolean showOngoingSession = + ongoingSessionStatus != null && connectionState == ConnectionState.DISCONNECTED; + if (deviceStatusIcon == null && !showOngoingSession) { mStatusIcon.setVisibility(View.GONE); } else { - mStatusIcon.setImageDrawable(deviceStatusIcon); + if (showOngoingSession) { + mStatusIcon.setImageDrawable( + mContext.getDrawable(R.drawable.ic_sound_bars_anim)); + } else { + mStatusIcon.setImageDrawable(deviceStatusIcon); + } mStatusIcon.setImageTintList(ColorStateList.valueOf( mController.getColorSchemeLegacy().getColorItemContent())); if (deviceStatusIcon instanceof AnimatedVectorDrawable) { |