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(); }
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); }
public void clearFilter() { adapter.clearFilter(); }
public void applyFilter(String srcFilter) { adapter.getFilter().filter(srcFilter); }
public ArrayList<AbstractSong> getAllItems() { return adapter.getAll(); }