[Output Switcher] Add unmute function on volume icon

when tap on muted icon, adjust volume to 2, just the same with volume
rocker.

Bug: 265755689
Test: atest MediaOutputAdapterTest MediaOutputControllerTest MediaOutputBaseDialogTest MediaOutputDialogTest
Change-Id: I76696368cb1788e61e2d2ac90bb69900ab575c65
This commit is contained in:
shaoweishen
2023-03-24 13:02:20 +00:00
parent 590c89ffe6
commit 4b2a96ee15

View File

@@ -66,6 +66,8 @@ public abstract class MediaOutputBaseAdapter extends
protected final MediaOutputController mController;
private static final int UNMUTE_DEFAULT_VOLUME = 2;
Context mContext;
View mHolderView;
boolean mIsDragging;
@@ -193,10 +195,6 @@ public abstract class MediaOutputBaseAdapter extends
mTwoLineTitleText.setTextColor(mController.getColorItemContent());
if (mController.isAdvancedLayoutSupported()) {
mVolumeValueText.setTextColor(mController.getColorItemContent());
mTitleIcon.setOnTouchListener(((v, event) -> {
mSeekBar.dispatchTouchEvent(event);
return false;
}));
}
mSeekBar.setProgressTintList(
ColorStateList.valueOf(mController.getColorSeekbarProgress()));
@@ -546,13 +544,21 @@ public abstract class MediaOutputBaseAdapter extends
private void enableSeekBar(MediaDevice device) {
mSeekBar.setEnabled(true);
mSeekBar.setOnTouchListener((v, event) -> false);
if (mController.isAdvancedLayoutSupported()) {
updateIconAreaClickListener((v) -> {
updateIconAreaClickListener((v) -> {
if (device.getCurrentVolume() == 0) {
mController.adjustVolume(device, UNMUTE_DEFAULT_VOLUME);
updateUnmutedVolumeIcon();
mTitleIcon.setOnTouchListener(((iconV, event) -> false));
} else {
mSeekBar.resetVolume();
mController.adjustVolume(device, 0);
updateMutedVolumeIcon();
});
}
mTitleIcon.setOnTouchListener(((iconV, event) -> {
mSeekBar.dispatchTouchEvent(event);
return false;
}));
}
});
}
protected void setUpDeviceIcon(MediaDevice device) {