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

Commit e816dcd7 authored by Alexandr Shabalin's avatar Alexandr Shabalin Committed by Android (Google) Code Review
Browse files

Merge "Extract legacy UI logic and place it outside of shared components." into main

parents 5434639a 45f3c97c
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -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,13 +301,9 @@ 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 {
        private Drawable getDeviceStatusIcon(MediaDevice device) {
            return Api34Impl.getDeviceStatusIconBasedOnSelectionBehavior(device, mContext);
        }
        }

        protected void onExpandGroupButtonClicked() {
            mShouldGroupSelectedMediaItems = false;
+13 −4
Original line number Diff line number Diff line
@@ -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 {
                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) {