[Output Switcher] Adjust volume progress scale to decrease gap
Adjust scale from volume to progress by increasing 500, when user adjust volume to 1551, close and open again, seekbar will be initialized to 1000, which will have 551 gap, after this change it will be adjusted to 1500, to decrease gap to 51. Bug: 264841237 Test: atest MediaOutputAdapterTest MediaOutputControllerTest MediaOutputBaseDialogTest MediaOutputDialogTest Change-Id: I61f95a79fb23065c8a767ea23be31c36a62db193
This commit is contained in:
committed by
Shaowei Shen
parent
142c5c5eda
commit
22cc6e9759
@@ -26,6 +26,7 @@ import android.widget.SeekBar;
|
||||
*/
|
||||
public class MediaOutputSeekbar extends SeekBar {
|
||||
private static final int SCALE_SIZE = 1000;
|
||||
private static final int INITIAL_PROGRESS = 500;
|
||||
public static final int VOLUME_PERCENTAGE_SCALE_SIZE = 100000;
|
||||
|
||||
public MediaOutputSeekbar(Context context, AttributeSet attrs) {
|
||||
@@ -38,7 +39,7 @@ public class MediaOutputSeekbar extends SeekBar {
|
||||
}
|
||||
|
||||
static int scaleVolumeToProgress(int volume) {
|
||||
return volume * SCALE_SIZE;
|
||||
return volume == 0 ? 0 : INITIAL_PROGRESS + volume * SCALE_SIZE;
|
||||
}
|
||||
|
||||
int getVolume() {
|
||||
@@ -46,7 +47,7 @@ public class MediaOutputSeekbar extends SeekBar {
|
||||
}
|
||||
|
||||
void setVolume(int volume) {
|
||||
setProgress(volume * SCALE_SIZE, true);
|
||||
setProgress(scaleVolumeToProgress(volume), true);
|
||||
}
|
||||
|
||||
void setMaxVolume(int maxVolume) {
|
||||
|
||||
Reference in New Issue
Block a user