Skip to content

Commit

Permalink
make volume progress bar match system volume when we start sliding
Browse files Browse the repository at this point in the history
  • Loading branch information
iTrooz committed May 9, 2022
1 parent 212a413 commit 00693ef
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ public void onScroll(@NonNull final MainPlayer.PlayerType playerType,
}

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();
Expand Down

0 comments on commit 00693ef

Please sign in to comment.