diff options
-rw-r--r-- | core/java/android/preference/SeekBarVolumizer.java | 11 | ||||
-rw-r--r-- | core/res/res/drawable/ic_audio_media.xml | 27 | ||||
-rw-r--r-- | core/res/res/drawable/ic_audio_media_mute.xml | 30 | ||||
-rwxr-xr-x | core/res/res/values/symbols.xml | 2 |
4 files changed, 66 insertions, 4 deletions
diff --git a/core/java/android/preference/SeekBarVolumizer.java b/core/java/android/preference/SeekBarVolumizer.java index 30da0e7..4bd085f 100644 --- a/core/java/android/preference/SeekBarVolumizer.java +++ b/core/java/android/preference/SeekBarVolumizer.java @@ -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)) { diff --git a/core/res/res/drawable/ic_audio_media.xml b/core/res/res/drawable/ic_audio_media.xml new file mode 100644 index 0000000..a453b3db --- /dev/null +++ b/core/res/res/drawable/ic_audio_media.xml @@ -0,0 +1,27 @@ +<!-- + 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> + diff --git a/core/res/res/drawable/ic_audio_media_mute.xml b/core/res/res/drawable/ic_audio_media_mute.xml new file mode 100644 index 0000000..2e7f6dc --- /dev/null +++ b/core/res/res/drawable/ic_audio_media_mute.xml @@ -0,0 +1,30 @@ +<!-- + 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> + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index d4e502a..ac8216e 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -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" /> |