Change event_loaded to replace_song

This commit is contained in:
Christopher Eby 2010-03-26 21:57:20 -05:00
parent 5528749b59
commit 210e2c5513
3 changed files with 8 additions and 5 deletions

View File

@ -456,8 +456,11 @@ public class CoverView extends View {
public void onReceive(Intent intent)
{
String action = intent.getAction();
if (PlaybackService.EVENT_LOADED.equals(action)) {
refreshSongs();
if (PlaybackService.EVENT_REPLACE_SONG.equals(action)) {
if (intent.getBooleanExtra("all", false))
refreshSongs();
else
mHandler.sendEmptyMessage(2);
} else if (PlaybackService.EVENT_CHANGED.equals(action)) {
Song currentSong = mSongs[STORE_SIZE / 2];
Song playingSong = intent.getParcelableExtra("song");

View File

@ -58,7 +58,7 @@ public abstract class PlaybackActivity extends Activity implements ServiceConnec
IntentFilter filter = new IntentFilter();
filter.addAction(PlaybackService.EVENT_CHANGED);
filter.addAction(PlaybackService.EVENT_LOADED);
filter.addAction(PlaybackService.EVENT_REPLACE_SONG);
registerReceiver(mReceiver, filter);
}

View File

@ -55,7 +55,7 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
public static final String TOGGLE_PLAYBACK = "org.kreed.vanilla.action.TOGGLE_PLAYBACK";
public static final String NEXT_SONG = "org.kreed.vanilla.action.NEXT_SONG";
public static final String EVENT_LOADED = "org.kreed.vanilla.event.LOADED";
public static final String EVENT_REPLACE_SONG = "org.kreed.vanilla.event.REPLACE_SONG";
public static final String EVENT_CHANGED = "org.kreed.vanilla.event.CHANGED";
public static final int ACTION_PLAY = 0;
@ -392,7 +392,7 @@ public class PlaybackService extends Service implements Runnable, MediaPlayer.On
if (mPendingSeek != 0)
mMediaPlayer.seekTo(mPendingSeek);
sendBroadcast(new Intent(EVENT_LOADED));
sendBroadcast(new Intent(EVENT_REPLACE_SONG).putExtra("all", true));
mHandler.sendEmptyMessage(POST_CREATE);