예제 #1
0
 @Override
 public void playAll(PlaylistData item, Context context) {
   if (item.getSongs().isEmpty()) {
     ((MainActivity) context).showMessage(R.string.playlist_is_empty);
     return;
   }
   PlaybackService player = PlaybackService.get(context);
   MusicApp.getSharedPreferences()
       .edit()
       .putLong(Constants.PREF_LAST_PLAYLIST_ID, item.getId())
       .commit();
   player.setArrayPlayback(new ArrayList<AbstractSong>(item.getSongs()));
   ((BaseMiniPlayerActivity) context).startSong((item.getSongs().get(0)));
 }
예제 #2
0
 private void setOpened() {
   ArrayList<AbstractSong> allItems = getAllItems();
   HashSet<String> myHashSet =
       (HashSet<String>)
           MusicApp.getSharedPreferences().getStringSet(PREF_LAST_OPENED, new HashSet<String>());
   for (AbstractSong data : getAllItems()) {
     if (data.getClass() == PlaylistData.class
         && myHashSet.contains(String.valueOf(data.getId()))) {
       if (((PlaylistData) data).getSongs().size() == 0 || ((PlaylistData) data).isExpanded())
         continue;
       allItems.addAll(allItems.indexOf(data) + 1, ((PlaylistData) data).getSongs());
       ((PlaylistData) data).setExpanded(true);
     }
   }
   updateAdapter(allItems);
 }
예제 #3
0
 public FragmentDrawer() {
   sPref = MusicApp.getSharedPreferences();
   sPref.registerOnSharedPreferenceChangeListener(sPrefListener);
 }
예제 #4
0
 public void onPause() {
   MusicApp.getSharedPreferences()
       .edit()
       .putStringSet(PREF_LAST_OPENED, getOpenedPlaylists())
       .apply();
 }