示例#1
0
 private HashSet getOpenedPlaylists() {
   HashSet<String> myHashSet = new HashSet<>();
   for (AbstractSong data : getAllItems()) {
     if (data.getClass() == PlaylistData.class && ((PlaylistData) data).isExpanded()) {
       myHashSet.add(String.valueOf(data.getId()));
     }
   }
   return myHashSet;
 }
示例#2
0
 public void updatePlaylist() {
   ArrayList<AbstractSong> playlists = getPlaylists();
   for (AbstractSong playlistData : playlists) {
     ((PlaylistData) playlistData)
         .setSongs(
             ((PlaylistData) playlistData)
                 .getSongsFromPlaylist(getContext(), playlistData.getId()));
   }
   updateAdapter(playlists);
 }
示例#3
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);
 }