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

Commit faa430be authored by William C. Garrison III's avatar William C. Garrison III Committed by Gerrit Code Review
Browse files

VolumePanel: show hint for unlinked notification slider too

Change-Id: Ia79e5ed5d6516e61a8833dca07f0a8de2afae654
parent ecda406b
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -927,6 +927,8 @@ public class VolumePanel extends Handler implements DemoMode {
    private void updateSliderEnabled(final StreamControl sc, boolean muted, boolean fixedVolume) {
        final boolean wasEnabled = sc.seekbarView.isEnabled();
        final boolean isRinger = isNotificationOrRing(sc.streamType);
        final boolean isUnlinkedNotification =
                !mVolumeLinkNotification && sc.streamType == AudioManager.STREAM_NOTIFICATION;
        if (sc.streamType == STREAM_REMOTE_MUSIC) {
            // never disable touch interactions for remote playback, the muting is not tied to
            // the state of the phone.
@@ -945,7 +947,7 @@ public class VolumePanel extends Handler implements DemoMode {
                (sc.streamType != mAudioManager.getMasterStreamType() && !isRinger && muted) ||
                (sSafetyWarning != null)) {
            sc.seekbarView.setEnabled(false);
            if (!mVolumeLinkNotification && sc.streamType == AudioManager.STREAM_NOTIFICATION) {
            if (isUnlinkedNotification) {
                sc.icon.setEnabled(false);
                sc.icon.setAlpha(mDisabledAlpha);
            }
@@ -954,17 +956,22 @@ public class VolumePanel extends Handler implements DemoMode {
            sc.icon.setEnabled(true);
            sc.icon.setAlpha(1f);
        }
        // show the silent hint when the disabled slider is touched in silent mode
        if (isRinger && wasEnabled != sc.seekbarView.isEnabled()) {
        // show the appropriate hint when a disabled slider is touched
        if ((isRinger || isUnlinkedNotification) && wasEnabled != sc.seekbarView.isEnabled()) {
            if (sc.seekbarView.isEnabled()) {
                sc.group.setOnTouchListener(null);
                sc.icon.setClickable(mHasVibrator);
                sc.icon.setClickable(isRinger && mHasVibrator);
            } else {
                final View.OnTouchListener showHintOnTouch = new View.OnTouchListener() {
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        resetTimeout();
                        if (mAudioManager.getRingerModeInternal() ==
                                AudioManager.RINGER_MODE_VIBRATE) {
                            showRingerHint();
                        } else {
                            showSilentHint();
                        }
                        return false;
                    }
                };
@@ -979,6 +986,13 @@ public class VolumePanel extends Handler implements DemoMode {
        }
    }

    private void showRingerHint() {
        final StreamControl ringer = mStreamControls.get(AudioManager.STREAM_RING);
        if (ringer != null) {
            mIconPulser.start(ringer.icon);
        }
    }

    private void showVibrateHint() {
        final StreamControl active = mStreamControls.get(mActiveStreamType);
        if (active != null) {