diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index 9e23d9145..25a9f3be3 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -398,6 +398,12 @@ public final class BackgroundPlayer extends Service { updatePlayback(); } + @Override + public void onMuteUnmuteButtonClicled() { + super.onMuteUnmuteButtonClicled(); + updatePlayback(); + } + @Override public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { updateProgress(currentProgress, duration, bufferPercent); diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java index fc14e8d51..88d227936 100644 --- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java @@ -607,6 +607,12 @@ public final class PopupVideoPlayer extends Service { updatePlayback(); } + @Override + public void onMuteUnmuteButtonClicled() { + super.onMuteUnmuteButtonClicled(); + updatePlayback(); + } + @Override public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { updateProgress(currentProgress, duration, bufferPercent); diff --git a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java index 034746a2b..a3d8dde8d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -7,6 +7,7 @@ import android.os.Bundle; import android.os.IBinder; import android.provider.Settings; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.appcompat.widget.Toolbar; @@ -22,6 +23,7 @@ import android.widget.PopupMenu; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; +import android.widget.Toast; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.Player; @@ -560,6 +562,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity onPlayModeChanged(repeatMode, shuffled); onPlaybackParameterChanged(parameters); onMaybePlaybackAdapterChanged(); + onMaybeMuteChanged(); } @Override @@ -667,7 +670,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity final int shuffleAlpha = shuffled ? 255 : 77; shuffleButton.setImageAlpha(shuffleAlpha); } - + private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { playbackSpeedButton.setText(formatSpeed(parameters.speed)); @@ -682,4 +685,13 @@ public abstract class ServicePlayerActivity extends AppCompatActivity itemsList.setAdapter(maybeNewAdapter); } } + + private void onMaybeMuteChanged(){ + if (player.isMuted()) { + muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.white)); + } + else { + muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.gray)); + } + } }