mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 02:13:33 +00:00
fix: set no replay gain if array is null or empty
This commit is contained in:
parent
16561be854
commit
a50e50d797
1 changed files with 5 additions and 9 deletions
|
|
@ -1,7 +1,5 @@
|
||||||
package com.cappielloantonio.tempo.util;
|
package com.cappielloantonio.tempo.util;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.OptIn;
|
import androidx.annotation.OptIn;
|
||||||
import androidx.media3.common.MediaItem;
|
import androidx.media3.common.MediaItem;
|
||||||
import androidx.media3.common.Metadata;
|
import androidx.media3.common.Metadata;
|
||||||
|
|
@ -17,8 +15,6 @@ import java.util.Objects;
|
||||||
|
|
||||||
@OptIn(markerClass = UnstableApi.class)
|
@OptIn(markerClass = UnstableApi.class)
|
||||||
public class ReplayGainUtil {
|
public class ReplayGainUtil {
|
||||||
private static final String TAG = "ReplayGainUtil";
|
|
||||||
|
|
||||||
private static final String[] tags = {"REPLAYGAIN_TRACK_GAIN", "REPLAYGAIN_ALBUM_GAIN", "R128_TRACK_GAIN", "R128_ALBUM_GAIN"};
|
private static final String[] tags = {"REPLAYGAIN_TRACK_GAIN", "REPLAYGAIN_ALBUM_GAIN", "R128_TRACK_GAIN", "R128_ALBUM_GAIN"};
|
||||||
|
|
||||||
public static void setReplayGain(ExoPlayer player, Tracks tracks) {
|
public static void setReplayGain(ExoPlayer player, Tracks tracks) {
|
||||||
|
|
@ -113,6 +109,11 @@ public class ReplayGainUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void applyReplayGain(ExoPlayer player, List<ReplayGain> gains) {
|
private static void applyReplayGain(ExoPlayer player, List<ReplayGain> gains) {
|
||||||
|
if (Objects.equals(Preferences.getReplayGainMode(), "disabled") || gains == null || gains.isEmpty()) {
|
||||||
|
setNoReplayGain(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Objects.equals(Preferences.getReplayGainMode(), "auto")) {
|
if (Objects.equals(Preferences.getReplayGainMode(), "auto")) {
|
||||||
if (areTracksConsecutive(player)) {
|
if (areTracksConsecutive(player)) {
|
||||||
setAutoReplayGain(player, gains);
|
setAutoReplayGain(player, gains);
|
||||||
|
|
@ -123,11 +124,6 @@ public class ReplayGainUtil {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Objects.equals(Preferences.getReplayGainMode(), "disabled") || gains.size() == 0) {
|
|
||||||
setNoReplayGain(player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Objects.equals(Preferences.getReplayGainMode(), "track")) {
|
if (Objects.equals(Preferences.getReplayGainMode(), "track")) {
|
||||||
setTrackReplayGain(player, gains);
|
setTrackReplayGain(player, gains);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue