diff options
author | Arian Kulmer <arian.kulmer@rwth-aachen.de> | 2020-12-18 19:01:10 +0100 |
---|---|---|
committer | Arian <arian.kulmer@web.de> | 2021-02-06 17:38:18 +0100 |
commit | dcbb629d2b5b8a127c5ff470de9d0ec68fd0d76a (patch) | |
tree | b9f9e6abf452e610a45a6a273b87a923a273a306 | |
parent | 73020379eb29cba2d9ec2bb14baa6bc007c74c69 (diff) |
profiles: SeekBarVolumizer: Properly setup the minimum of the seekbar
Some streams, like the alarm stream, have a minimal volume of 1
instead of 0 which leads to a seekbar where 0 and 1 result in the
same volume set.
Test: The seekbar for a stream with a minimal value of 1 (alarm)
starts with 1 and other streams stay uneffected
Change-Id: I9e6f8caf45c5333a2e865e09e754da0bef5cee99
-rw-r--r-- | src/org/lineageos/lineageparts/profiles/SeekBarVolumizer.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/org/lineageos/lineageparts/profiles/SeekBarVolumizer.java b/src/org/lineageos/lineageparts/profiles/SeekBarVolumizer.java index 61f950f..2642520 100644 --- a/src/org/lineageos/lineageparts/profiles/SeekBarVolumizer.java +++ b/src/org/lineageos/lineageparts/profiles/SeekBarVolumizer.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2014 The Android Open Source Project + * 2021 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,6 +86,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba private final NotificationManager mNotificationManager; private final int mStreamType; private final int mMaxStreamVolume; + private final int mMinStreamVolume; private final boolean mVoiceCapable; private boolean mAffectedByRingerMode; private boolean mNotificationOrRing; @@ -153,6 +155,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba } mMaxStreamVolume = mAudioManager.getStreamMaxVolume(mStreamType); + mMinStreamVolume = mAudioManager.getStreamMinVolume(mStreamType); mCallback = callback; mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType); mLastAudibleStreamVolume = mAudioManager.getLastAudibleStreamVolume(mStreamType); @@ -233,6 +236,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba mSeekBar = seekBar; mSeekBar.setOnSeekBarChangeListener(null); mSeekBar.setMax(mMaxStreamVolume); + mSeekBar.setMin(mMinStreamVolume); updateSeekBar(); mSeekBar.setOnSeekBarChangeListener(this); } |