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
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 @@
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 @@
}
mMaxStreamVolume = mAudioManager.getStreamMaxVolume(mStreamType);
+ mMinStreamVolume = mAudioManager.getStreamMinVolume(mStreamType);
mCallback = callback;
mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType);
mLastAudibleStreamVolume = mAudioManager.getLastAudibleStreamVolume(mStreamType);
@@ -233,6 +236,7 @@
mSeekBar = seekBar;
mSeekBar.setOnSeekBarChangeListener(null);
mSeekBar.setMax(mMaxStreamVolume);
+ mSeekBar.setMin(mMinStreamVolume);
updateSeekBar();
mSeekBar.setOnSeekBarChangeListener(this);
}