예제 #1
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int itemId = item.getItemId();
   if (itemId == R.id.menu_library_player) {
     MediaService mediaService = getMediaService();
     if (mediaService.getPlayerState() == MediaService.PlayerState.Stopped) {
       mediaService.setPlaylist(m_masterPlaylistTask.getPlaylist());
       getMediaService().play();
     }
     Intent intent = new Intent(this, PlayerActivity.class);
     startActivity(intent);
   }
   return super.onOptionsItemSelected(item);
 }
예제 #2
0
  private void initActivityState() {
    // Master playlist
    Playlist masterPlaylist = new Playlist();
    m_masterPlaylistTask =
        new Playlist.ListCreator(
            getContentResolver(), masterPlaylist, null, MediaStore.Audio.Media.TITLE);
    m_masterPlaylistTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    // Bitmap Provider
    StaticFragment sf =
        StaticFragment.getInstance(
            getSupportFragmentManager(), getContentResolver(), getResources());
    m_bitmapResolver = sf.getBitmapProvider();
  }