Make volume progress bar match system volume when we start sliding

pull/8377/head
iTrooz_ 2022-05-09 20:48:48 +02:00
rodzic 212a413e93
commit 61ee1c61df
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 1EA15C0AE076965F
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -126,6 +126,14 @@ public class PlayerGestureListener
}
private void onScrollMainVolume(final float distanceX, final float distanceY) {
// If we just started sliding, change the progress bar to match the system volume
if (player.getVolumeRelativeLayout().getVisibility() != View.VISIBLE) {
final float volumePercent = player
.getAudioReactor().getVolume() / (float) maxVolume;
player.getVolumeProgressBar().setProgress(
(int) (volumePercent * player.getMaxGestureLength()));
}
player.getVolumeProgressBar().incrementProgressBy((int) distanceY);
final float currentProgressPercent = (float) player
.getVolumeProgressBar().getProgress() / player.getMaxGestureLength();