icon change implemented in queque

This commit is contained in:
karol 2020-02-23 23:44:16 +01:00
parent 2a63f2a3a6
commit c4d5886059
3 changed files with 25 additions and 1 deletions

View File

@ -398,6 +398,12 @@ public final class BackgroundPlayer extends Service {
updatePlayback(); updatePlayback();
} }
@Override
public void onMuteUnmuteButtonClicled() {
super.onMuteUnmuteButtonClicled();
updatePlayback();
}
@Override @Override
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) {
updateProgress(currentProgress, duration, bufferPercent); updateProgress(currentProgress, duration, bufferPercent);

View File

@ -607,6 +607,12 @@ public final class PopupVideoPlayer extends Service {
updatePlayback(); updatePlayback();
} }
@Override
public void onMuteUnmuteButtonClicled() {
super.onMuteUnmuteButtonClicled();
updatePlayback();
}
@Override @Override
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) {
updateProgress(currentProgress, duration, bufferPercent); updateProgress(currentProgress, duration, bufferPercent);

View File

@ -7,6 +7,7 @@ import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.provider.Settings; import android.provider.Settings;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
@ -22,6 +23,7 @@ import android.widget.PopupMenu;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
@ -560,6 +562,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
onPlayModeChanged(repeatMode, shuffled); onPlayModeChanged(repeatMode, shuffled);
onPlaybackParameterChanged(parameters); onPlaybackParameterChanged(parameters);
onMaybePlaybackAdapterChanged(); onMaybePlaybackAdapterChanged();
onMaybeMuteChanged();
} }
@Override @Override
@ -667,7 +670,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
final int shuffleAlpha = shuffled ? 255 : 77; final int shuffleAlpha = shuffled ? 255 : 77;
shuffleButton.setImageAlpha(shuffleAlpha); shuffleButton.setImageAlpha(shuffleAlpha);
} }
private void onPlaybackParameterChanged(final PlaybackParameters parameters) { private void onPlaybackParameterChanged(final PlaybackParameters parameters) {
if (parameters != null) { if (parameters != null) {
playbackSpeedButton.setText(formatSpeed(parameters.speed)); playbackSpeedButton.setText(formatSpeed(parameters.speed));
@ -682,4 +685,13 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
itemsList.setAdapter(maybeNewAdapter); 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));
}
}
} }