Skip to content

Commit

Permalink
Merge pull request #869 from ZeusWPI/chore/more-updates
Browse files Browse the repository at this point in the history
Fix bug in Urgent.fm
  • Loading branch information
niknetniko authored Dec 12, 2023
2 parents 98a9d39 + 36e063d commit d55de85
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class MediaNotificationBuilder {

Notification buildNotification(MediaSessionCompat mediaSession) {
MediaControllerCompat controller = mediaSession.getController();
var playbackState = controller.getPlaybackState();
if (playbackState == null) {
return null; // Nothing we can do currently.
}

// Construct the actual notification
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, ChannelCreator.URGENT_CHANNEL);
Expand All @@ -65,10 +69,10 @@ Notification buildNotification(MediaSessionCompat mediaSession) {
.setShowActionsInCompactView(0);

// Construct the play/pause button.
boolean isPlaying = controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_PLAYING;
boolean isConnecting = controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_CONNECTING
|| controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_BUFFERING;
boolean isError = controller.getPlaybackState().getState() == PlaybackStateCompat.STATE_ERROR;
boolean isPlaying = playbackState.getState() == PlaybackStateCompat.STATE_PLAYING;
boolean isConnecting = playbackState.getState() == PlaybackStateCompat.STATE_CONNECTING
|| playbackState.getState() == PlaybackStateCompat.STATE_BUFFERING;
boolean isError = playbackState.getState() == PlaybackStateCompat.STATE_ERROR;
if (isPlaying || isConnecting) {
builder.addAction(new NotificationCompat.Action(
R.drawable.noti_ic_stop,
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@
toolsVersion = null;
platformToolsVersion = androidVersions.platformToolsVersion;
buildToolsVersions = [ androidVersions.buildToolsVersions ];
includeEmulator = false;
includeEmulator = true;
emulatorVersion = "34.1.9";
includeSystemImages = true;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "x86_64" ];
platformVersions = [ androidVersions.platformVersions ];
# Enable once nixpkgs is fixed...
includeSources = false;
includeSources = true;
includeNDK = false;
useGoogleAPIs = true;
includeExtras = [
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# SOFTWARE.
#

android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
Expand Down

0 comments on commit d55de85

Please sign in to comment.