Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +1 −1 Original line number Diff line number Diff line Loading @@ -207,10 +207,10 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateTitleIcon(R.drawable.media_output_icon_volume, mController.getColorItemContent()); } initMutingExpectedDevice(); mCurrentActivePosition = position; updateFullItemClickListener(v -> onItemClick(v, device)); setSingleLineLayout(getItemTitle(device)); initMutingExpectedDevice(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && mController.isSubStatusSupported() && mController.isAdvancedLayoutSupported() && device.hasSubtext()) { Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java +11 −14 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import androidx.recyclerview.widget.RecyclerView; import com.android.settingslib.Utils; import com.android.settingslib.media.MediaDevice; import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.R; Loading Loading @@ -277,9 +276,10 @@ public abstract class MediaOutputBaseAdapter extends backgroundDrawable = mContext.getDrawable( showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active : R.drawable.media_output_item_background).mutate(); backgroundDrawable.setTint( mItemLayout.setBackgroundTintList(ColorStateList.valueOf( showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground() : mController.getColorItemBackground()); : mController.getColorItemBackground() )); mIconAreaLayout.setBackgroundTintList( ColorStateList.valueOf(showProgressBar || isFakeActive ? mController.getColorConnectedItemBackground() Loading @@ -299,7 +299,8 @@ public abstract class MediaOutputBaseAdapter extends backgroundDrawable = mContext.getDrawable( R.drawable.media_output_item_background) .mutate(); backgroundDrawable.setTint(mController.getColorItemBackground()); mItemLayout.setBackgroundTintList( ColorStateList.valueOf(mController.getColorItemBackground())); } mItemLayout.setBackground(backgroundDrawable); mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); Loading Loading @@ -455,11 +456,16 @@ public abstract class MediaOutputBaseAdapter extends void initMutingExpectedDevice() { disableSeekBar(); updateTitleIcon(R.drawable.media_output_icon_volume, mController.getColorItemContent()); final Drawable backgroundDrawable = mContext.getDrawable( R.drawable.media_output_item_background_active) .mutate(); backgroundDrawable.setTint(mController.getColorConnectedItemBackground()); mItemLayout.setBackground(backgroundDrawable); mItemLayout.setBackgroundTintList( ColorStateList.valueOf(mController.getColorConnectedItemBackground())); mIconAreaLayout.setBackgroundTintList( ColorStateList.valueOf(mController.getColorConnectedItemBackground())); } private void animateCornerAndVolume(int fromProgress, int toProgress) { Loading Loading @@ -530,14 +536,6 @@ public abstract class MediaOutputBaseAdapter extends }); } Drawable getSpeakerDrawable() { final Drawable drawable = mContext.getDrawable(R.drawable.ic_speaker_group_black_24dp) .mutate(); drawable.setTint(Utils.getColorStateListDefaultColor(mContext, R.color.media_dialog_item_main_content)); return drawable; } protected void disableSeekBar() { mSeekBar.setEnabled(false); mSeekBar.setOnTouchListener((v, event) -> true); Loading Loading @@ -574,7 +572,6 @@ public abstract class MediaOutputBaseAdapter extends return; } mTitleIcon.setImageIcon(icon); icon.setTint(mController.getColorItemContent()); mTitleIcon.setImageTintList( ColorStateList.valueOf(mController.getColorItemContent())); }); Loading packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -347,10 +347,13 @@ public class MediaOutputAdapterTest extends SysuiTestCase { } @Test public void onBindViewHolder_isMutingExpectedDevice_verifyView() { public void advanced_onBindViewHolder_isMutingExpectedDevice_verifyView() { when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true); when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(true); when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false); when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false); mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter .onCreateViewHolder(new LinearLayout(mContext), 0); mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0); assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE); Loading Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +1 −1 Original line number Diff line number Diff line Loading @@ -207,10 +207,10 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateTitleIcon(R.drawable.media_output_icon_volume, mController.getColorItemContent()); } initMutingExpectedDevice(); mCurrentActivePosition = position; updateFullItemClickListener(v -> onItemClick(v, device)); setSingleLineLayout(getItemTitle(device)); initMutingExpectedDevice(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && mController.isSubStatusSupported() && mController.isAdvancedLayoutSupported() && device.hasSubtext()) { Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java +11 −14 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import androidx.recyclerview.widget.RecyclerView; import com.android.settingslib.Utils; import com.android.settingslib.media.MediaDevice; import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.R; Loading Loading @@ -277,9 +276,10 @@ public abstract class MediaOutputBaseAdapter extends backgroundDrawable = mContext.getDrawable( showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active : R.drawable.media_output_item_background).mutate(); backgroundDrawable.setTint( mItemLayout.setBackgroundTintList(ColorStateList.valueOf( showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground() : mController.getColorItemBackground()); : mController.getColorItemBackground() )); mIconAreaLayout.setBackgroundTintList( ColorStateList.valueOf(showProgressBar || isFakeActive ? mController.getColorConnectedItemBackground() Loading @@ -299,7 +299,8 @@ public abstract class MediaOutputBaseAdapter extends backgroundDrawable = mContext.getDrawable( R.drawable.media_output_item_background) .mutate(); backgroundDrawable.setTint(mController.getColorItemBackground()); mItemLayout.setBackgroundTintList( ColorStateList.valueOf(mController.getColorItemBackground())); } mItemLayout.setBackground(backgroundDrawable); mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); Loading Loading @@ -455,11 +456,16 @@ public abstract class MediaOutputBaseAdapter extends void initMutingExpectedDevice() { disableSeekBar(); updateTitleIcon(R.drawable.media_output_icon_volume, mController.getColorItemContent()); final Drawable backgroundDrawable = mContext.getDrawable( R.drawable.media_output_item_background_active) .mutate(); backgroundDrawable.setTint(mController.getColorConnectedItemBackground()); mItemLayout.setBackground(backgroundDrawable); mItemLayout.setBackgroundTintList( ColorStateList.valueOf(mController.getColorConnectedItemBackground())); mIconAreaLayout.setBackgroundTintList( ColorStateList.valueOf(mController.getColorConnectedItemBackground())); } private void animateCornerAndVolume(int fromProgress, int toProgress) { Loading Loading @@ -530,14 +536,6 @@ public abstract class MediaOutputBaseAdapter extends }); } Drawable getSpeakerDrawable() { final Drawable drawable = mContext.getDrawable(R.drawable.ic_speaker_group_black_24dp) .mutate(); drawable.setTint(Utils.getColorStateListDefaultColor(mContext, R.color.media_dialog_item_main_content)); return drawable; } protected void disableSeekBar() { mSeekBar.setEnabled(false); mSeekBar.setOnTouchListener((v, event) -> true); Loading Loading @@ -574,7 +572,6 @@ public abstract class MediaOutputBaseAdapter extends return; } mTitleIcon.setImageIcon(icon); icon.setTint(mController.getColorItemContent()); mTitleIcon.setImageTintList( ColorStateList.valueOf(mController.getColorItemContent())); }); Loading
packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -347,10 +347,13 @@ public class MediaOutputAdapterTest extends SysuiTestCase { } @Test public void onBindViewHolder_isMutingExpectedDevice_verifyView() { public void advanced_onBindViewHolder_isMutingExpectedDevice_verifyView() { when(mMediaOutputController.isAdvancedLayoutSupported()).thenReturn(true); when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(true); when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false); when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false); mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter .onCreateViewHolder(new LinearLayout(mContext), 0); mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0); assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE); Loading