예제 #1
0
  private void init(LayoutInflater inflater) {
    new Thread(
            new Runnable() {

              @Override
              public void run() {
                playbackService = PlaybackService.get(getContext());
              }
            })
        .start();
    view = (ViewGroup) inflater.inflate(getLayoutId(), null);
    listView = getListView(view);
    emptyMessage = getMessageView(view);
    adapter = getAdapter(inflater.getContext());
    listView.setAdapter(adapter);
    playLastPlaylist = view.findViewById(R.id.lastPlayedPlaylist);
    createNewPlayList = view.findViewById(R.id.createNewPlaylist);
    animateListView(listView, adapter);
    initListeners();
    updatePlaylist();
    if (adapter.isEmpty()) {
      listView.setEmptyView(emptyMessage);
    }
    adapter.getCount();
  }
예제 #2
0
 public void removeData(final PlaylistData data, final MusicData musicData) {
   ArrayList<AbstractSong> playlists = getAllItems();
   if (musicData == null) {
     if (data.getSongs().equals(playbackService.getArrayPlayback())) {
       playbackService.stopPressed();
     }
     if (data.isExpanded()) {
       playlists.removeAll(data.getSongs());
     }
     data.deletePlaylist(getContext(), data.getId());
     playlists.remove(playlists.indexOf(data));
   } else {
     data.removeFromPlaylist(getContext(), data.getId(), musicData.getId());
     ((PlaylistData) playlists.get(playlists.indexOf(data))).getSongs().remove(musicData);
     playlists.remove(musicData);
     playbackService.remove(musicData);
   }
   if (null != musicData
       && ((PlaylistData) playlists.get(playlists.indexOf(data))).getSongs().size() == 0) {
     ((PlaylistData) playlists.get(playlists.indexOf(data))).setExpanded(false);
   }
   adapter.remove(data);
   updateAdapter(playlists);
 }
예제 #3
0
 public void clearFilter() {
   adapter.clearFilter();
 }
예제 #4
0
 public void applyFilter(String srcFilter) {
   adapter.getFilter().filter(srcFilter);
 }
예제 #5
0
 public ArrayList<AbstractSong> getAllItems() {
   return adapter.getAll();
 }