Skip to content

Commit

Permalink
Added the track name and artist to status bar notification when playing
Browse files Browse the repository at this point in the history
  • Loading branch information
nperrier committed Oct 30, 2012
1 parent 1981949 commit e9547ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/com/pugh/sockso/android/activity/PlayerActivity.java
Expand Up @@ -391,7 +391,7 @@ else if (action.equals(ACTION_VIEW_PLAYER)) {


private void playTrack( long trackId ) {
Log.d(TAG, "startPlayback() called");
Log.d(TAG, "playTrack() called");

if (mService == null) {
Log.d(TAG, "mService is null");
Expand Down Expand Up @@ -440,7 +440,7 @@ private void playAlbum( long albumId ) {

mService.stop(); // stop whatever is currently playing
mService.open(tracks);

setPlayButtonImage(true);
//updateTrackInfo();

Expand Down
13 changes: 8 additions & 5 deletions src/com/pugh/sockso/android/player/PlayerService.java
Expand Up @@ -177,12 +177,12 @@ public Track getTrack() {
private void configAndStartMediaPlayer() {
Log.d(TAG, "configAndStartMediaPlayer() called");

// TODO Volume should be initially max, but ducked for phone calls, etc..
mPlayer.setVolume(1.0f, 1.0f);

mPlayer.start();
Track track = mPlaylist.get(mPlayIndex);
String notificationText = getString(R.string.notification_playing) + ": "
+ track.getArtist() + " - \"" + track.getName() + "\"";

setUpAsForeground(getString(R.string.notification_playing));
mPlayer.start();
setUpAsForeground(notificationText);
}

/**
Expand Down Expand Up @@ -254,6 +254,9 @@ private void createMediaPlayerIfNeeded() {
Log.d(TAG, "Creating a new MediaPlayer!");

mPlayer = new MediaPlayer();

// TODO Volume should be initially max, but ducked for phone calls, etc..
mPlayer.setVolume(1.0f, 1.0f);

// Listeners to the media player's events
mPlayer.setOnPreparedListener(this);
Expand Down

0 comments on commit e9547ae

Please sign in to comment.