diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java | 35 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java | 23 |
2 files changed, 25 insertions, 33 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java index ffc9cfb00d7d..a9732b8e7d0c 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java @@ -158,12 +158,12 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { && !mController.hasAdjustVolumeUserRestriction()) { setUpDeviceIcon(device); updateProgressBarColor(); - setSingleLineLayout(getItemTitle(device), false /* showSeekBar*/, + setSingleLineLayout(device.getName(), false /* showSeekBar*/, true /* showProgressBar */, false /* showCheckBox */, false /* showEndTouchArea */); } else { setUpDeviceIcon(device); - setSingleLineLayout(getItemTitle(device)); + setSingleLineLayout(device.getName()); } } else { // Set different layout for each device @@ -172,7 +172,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateUnmutedVolumeIcon(device); mCurrentActivePosition = position; updateFullItemClickListener(v -> onItemClick(v, device)); - setSingleLineLayout(getItemTitle(device)); + setSingleLineLayout(device.getName()); initFakeActiveDevice(device); } else if (device.hasSubtext()) { boolean isActiveWithOngoingSession = @@ -188,10 +188,10 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateEndClickAreaAsSessionEditing(device, isHost ? R.drawable.media_output_status_edit_session : R.drawable.ic_sound_bars_anim); - setTwoLineLayout(device, null /* title */, + setTwoLineLayout(device.getName() /* title */, true /* showSeekBar */, false /* showProgressBar */, true /* showSubtitle */, false /* showStatus */, - true /* showEndTouchArea */, false /* isFakeActive */); + true /* showEndTouchArea */); initSeekbar(device, isCurrentSeekbarInvisible); } else { if (currentlyConnected) { @@ -213,24 +213,23 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateTwoLineLayoutContentAlpha( updateClickActionBasedOnSelectionBehavior(device) ? DEVICE_CONNECTED_ALPHA : DEVICE_DISCONNECTED_ALPHA); - setTwoLineLayout(device, + setTwoLineLayout(device.getName(), currentlyConnected /* showSeekBar */, false /* showProgressBar */, true /* showSubtitle */, - deviceStatusIcon != null /* showStatus */, - false /* isFakeActive */); + deviceStatusIcon != null /* showStatus */); } } else if (device.getState() == MediaDeviceState.STATE_CONNECTING_FAILED) { setUpDeviceIcon(device); updateConnectionFailedStatusIcon(); mSubTitleText.setText(R.string.media_output_dialog_connect_failed); updateFullItemClickListener(v -> onItemClick(v, device)); - setTwoLineLayout(device, false /* showSeekBar */, + setTwoLineLayout(device.getName(), false /* showSeekBar */, false /* showProgressBar */, true /* showSubtitle */, - true /* showStatus */, false /*isFakeActive*/); + true /* showStatus */); } else if (device.getState() == MediaDeviceState.STATE_GROUPING) { setUpDeviceIcon(device); updateProgressBarColor(); - setSingleLineLayout(getItemTitle(device), false /* showSeekBar*/, + setSingleLineLayout(device.getName(), false /* showSeekBar*/, true /* showProgressBar */, false /* showCheckBox */, false /* showEndTouchArea */); } else if (mController.getSelectedMediaDevice().size() > 1 @@ -243,7 +242,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateEndClickArea(device, isDeviceDeselectable); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); - setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, + setSingleLineLayout(device.getName(), true /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); initSeekbar(device, isCurrentSeekbarInvisible); @@ -255,7 +254,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { // mark as disconnected and set special click listener setUpDeviceIcon(device); updateFullItemClickListener(v -> cancelMuteAwaitConnection()); - setSingleLineLayout(getItemTitle(device)); + setSingleLineLayout(device.getName()); } else if (device.hasOngoingSession()) { mCurrentActivePosition = position; updateUnmutedVolumeIcon(device); @@ -263,7 +262,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { ? R.drawable.media_output_status_edit_session : R.drawable.ic_sound_bars_anim); mEndClickIcon.setVisibility(View.VISIBLE); - setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, + setSingleLineLayout(device.getName(), true /* showSeekBar */, false /* showProgressBar */, false /* showCheckBox */, true /* showEndTouchArea */); initSeekbar(device, isCurrentSeekbarInvisible); @@ -278,7 +277,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateEndClickArea(device, isDeviceDeselectable); disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); - setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, + setSingleLineLayout(device.getName(), true /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); initSeekbar(device, isCurrentSeekbarInvisible); @@ -287,7 +286,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { disableFocusPropertyForView(mContainerLayout); setUpContentDescriptionForView(mSeekBar, device); mCurrentActivePosition = position; - setSingleLineLayout(getItemTitle(device), true /* showSeekBar */, + setSingleLineLayout(device.getName(), true /* showSeekBar */, false /* showProgressBar */, false /* showCheckBox */, false /* showEndTouchArea */); initSeekbar(device, isCurrentSeekbarInvisible); @@ -298,12 +297,12 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter { updateGroupableCheckBox(false, true, device); updateEndClickArea(device, true); updateFullItemClickListener(v -> onItemClick(v, device)); - setSingleLineLayout(getItemTitle(device), false /* showSeekBar */, + setSingleLineLayout(device.getName(), false /* showSeekBar */, false /* showProgressBar */, true /* showCheckBox */, true /* showEndTouchArea */); } else { setUpDeviceIcon(device); - setSingleLineLayout(getItemTitle(device)); + setSingleLineLayout(device.getName()); Drawable deviceStatusIcon = device.hasOngoingSession() ? mContext.getDrawable( R.drawable.ic_sound_bars_anim) diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java index 8b2adf9d30aa..4958b223a2f2 100644 --- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java @@ -94,10 +94,6 @@ public abstract class MediaOutputBaseAdapter extends mController.setCurrentColorScheme(wallpaperColors, isDarkTheme); } - CharSequence getItemTitle(MediaDevice device) { - return device.getName(); - } - boolean isCurrentlyConnected(MediaDevice device) { return TextUtils.equals(device.getId(), mController.getCurrentConnectedMediaDevice().getId()) @@ -232,16 +228,14 @@ public abstract class MediaOutputBaseAdapter extends : mController.getItemMarginEndDefault(); } - void setTwoLineLayout(MediaDevice device, boolean showSeekBar, - boolean showProgressBar, boolean showSubtitle, boolean showStatus, - boolean isFakeActive) { - setTwoLineLayout(device, null, showSeekBar, showProgressBar, showSubtitle, - showStatus, false, isFakeActive); + void setTwoLineLayout(CharSequence title, boolean showSeekBar, + boolean showProgressBar, boolean showSubtitle, boolean showStatus) { + setTwoLineLayout(title, showSeekBar, showProgressBar, showSubtitle, showStatus, false); } - void setTwoLineLayout(MediaDevice device, CharSequence title, + void setTwoLineLayout(CharSequence title, boolean showSeekBar, boolean showProgressBar, boolean showSubtitle, - boolean showStatus , boolean showEndTouchArea, boolean isFakeActive) { + boolean showStatus , boolean showEndTouchArea) { mTitleText.setVisibility(View.GONE); mTwoLineLayout.setVisibility(View.VISIBLE); mStatusIcon.setVisibility(showStatus ? View.VISIBLE : View.GONE); @@ -249,10 +243,10 @@ public abstract class MediaOutputBaseAdapter extends mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE); final Drawable backgroundDrawable; backgroundDrawable = mContext.getDrawable( - showSeekBar || isFakeActive ? R.drawable.media_output_item_background_active + showSeekBar ? R.drawable.media_output_item_background_active : R.drawable.media_output_item_background).mutate(); mItemLayout.setBackgroundTintList(ColorStateList.valueOf( - showSeekBar || isFakeActive ? mController.getColorConnectedItemBackground() + showSeekBar ? mController.getColorConnectedItemBackground() : mController.getColorItemBackground() )); if (showSeekBar) { @@ -268,8 +262,7 @@ public abstract class MediaOutputBaseAdapter extends mItemLayout.setBackground(backgroundDrawable); mProgressBar.setVisibility(showProgressBar ? View.VISIBLE : View.GONE); mSubTitleText.setVisibility(showSubtitle ? View.VISIBLE : View.GONE); - mTwoLineTitleText.setTranslationY(0); - mTwoLineTitleText.setText(device == null ? title : getItemTitle(device)); + mTwoLineTitleText.setText(title); } void updateSeekbarProgressBackground() { |