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

Commit 721d4576 authored by John Spurlock's avatar John Spurlock
Browse files

Volume: Automute in seek bar volumizer.

Never disable the slider, allow mutebusting and syncing mute to 0
value.

Also add new framework icon for media.

Bug: 20096341
Change-Id: I9db1671c3442365866a49c9d6f7becf0b2e05435
parent 5925a910
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -121,13 +121,10 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba

    protected void updateSeekBar() {
        if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
            mSeekBar.setEnabled(true);
            mSeekBar.setProgress(0);
        } else if (mMuted) {
            mSeekBar.setEnabled(false);
            mSeekBar.setProgress(0);
        } else {
            mSeekBar.setEnabled(true);
            mSeekBar.setProgress(mLastProgress > -1 ? mLastProgress : mOriginalStreamVolume);
        }
    }
@@ -136,6 +133,11 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
    public boolean handleMessage(Message msg) {
        switch (msg.what) {
            case MSG_SET_STREAM_VOLUME:
                if (mMuted && mLastProgress > 0) {
                    mAudioManager.adjustStreamVolume(mStreamType, AudioManager.ADJUST_UNMUTE, 0);
                } else if (!mMuted && mLastProgress == 0) {
                    mAudioManager.adjustStreamVolume(mStreamType, AudioManager.ADJUST_MUTE, 0);
                }
                mAudioManager.setStreamVolume(mStreamType, mLastProgress,
                        AudioManager.FLAG_SHOW_UI_WARNINGS);
                break;
@@ -375,7 +377,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
                final boolean streamMatch = mNotificationOrRing ? isNotificationOrRing(streamType)
                        : (streamType == mStreamType);
                if (mSeekBar != null && streamMatch && streamValue != -1) {
                    final boolean muted = mAudioManager.isStreamMute(mStreamType);
                    final boolean muted = mAudioManager.isStreamMute(mStreamType)
                            || streamValue == 0;
                    mUiHandler.postUpdateSlider(streamValue, muted);
                }
            } else if (AudioManager.INTERNAL_RINGER_MODE_CHANGED_ACTION.equals(action)) {
+27 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2015 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="32.0dp"
    android:viewportHeight="24.0"
    android:viewportWidth="24.0"
    android:width="32.0dp" >

    <path
        android:fillColor="?android:attr/colorControlNormal"
        android:pathData="M12.0,3.0l0.0,9.28c-0.47,-0.17 -0.97,-0.28 -1.5,-0.28C8.01,12.0 6.0,14.01 6.0,16.5S8.01,21.0 10.5,21.0c2.31,0.0 4.2,-1.75 4.45,-4.0L15.0,17.0L15.0,6.0l4.0,0.0L19.0,3.0l-7.0,0.0z" />

</vector>
+30 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2015 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="32.0dp"
    android:viewportHeight="24.0"
    android:viewportWidth="24.0"
    android:width="32.0dp" >

    <path
        android:fillColor="?android:attr/colorControlNormal"
        android:pathData="M15.0,6.0l4.0,0.0L19.0,3.0l-7.0,0.0l0.0,5.6l3.0,3.0C15.0,8.8 15.0,6.0 15.0,6.0z" />
    <path
        android:fillColor="?android:attr/colorControlNormal"
        android:pathData="M4.8,3.9L3.5,5.1l6.9,6.9C8.0,12.1 6.0,14.0 6.0,16.5C6.0,19.0 8.0,21.0 10.5,21.0c2.7,0.0 4.5,-2.3 4.5,-4.3c0.0,0.0 0.0,-0.1 0.0,-0.1l4.0,4.0l1.3,-1.3L4.8,3.9z" />

</vector>
+2 −0
Original line number Diff line number Diff line
@@ -1165,6 +1165,8 @@
  <java-symbol type="drawable" name="ic_audio_alarm_mute" />
  <java-symbol type="drawable" name="ic_audio_bt" />
  <java-symbol type="drawable" name="ic_audio_bt_mute" />
  <java-symbol type="drawable" name="ic_audio_media" />
  <java-symbol type="drawable" name="ic_audio_media_mute" />
  <java-symbol type="drawable" name="ic_audio_notification" />
  <java-symbol type="drawable" name="ic_audio_notification_mute" />
  <java-symbol type="drawable" name="ic_audio_phone" />