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

Commit 4b2a96ee authored by shaoweishen's avatar shaoweishen
Browse files

[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
parent 590c89ff
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -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) -> {
                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) {