From b3841c04a7961cac98a8ec0e63e07d0613d7a08d Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 31 Mar 2013 21:35:36 -0700 Subject: Put back others --- .../dsub/fragments/SelectDirectoryFragment.java | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 8ce9d6d5..d6f35479 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -158,10 +158,10 @@ public class SelectDirectoryFragment extends LibraryFunctionsFragment implements selectAll(false, false); return true; case R.id.menu_add_playlist: - // addToPlaylist(getSelectedSongs()); + addToPlaylist(getSelectedSongs()); return true; case R.id.menu_remove_playlist: - // removeFromPlaylist(playlistId, playlistName, getSelectedIndexes()); + removeFromPlaylist(playlistId, playlistName, getSelectedIndexes()); return true; } @@ -541,6 +541,39 @@ public class SelectDirectoryFragment extends LibraryFunctionsFragment implements } } + public void removeFromPlaylist(final String id, final String name, final List indexes) { + /*new LoadingTask(this, true) { + @Override + protected Void doInBackground() throws Throwable { + MusicService musicService = MusicServiceFactory.getMusicService(SelectAlbumActivity.this); + musicService.removeFromPlaylist(id, indexes, SelectAlbumActivity.this, null); + return null; + } + + @Override + protected void done(Void result) { + for(int i = indexes.size() - 1; i >= 0; i--) { + entryList.setItemChecked(indexes.get(i) + 1, false); + entryAdapter.removeAt(indexes.get(i)); + } + entryAdapter.notifyDataSetChanged(); + Util.toast(SelectAlbumActivity.this, getResources().getString(R.string.removed_playlist, indexes.size(), name)); + } + + @Override + protected void error(Throwable error) { + String msg; + if (error instanceof OfflineException || error instanceof ServerTooOldException) { + msg = getErrorMessage(error); + } else { + msg = getResources().getString(R.string.updated_playlist_error, name) + " " + getErrorMessage(error); + } + + Util.toast(SelectAlbumActivity.this, msg, false); + } + }.execute();*/ + } + private void checkLicenseAndTrialPeriod(Runnable onValid) { if (licenseValid) { onValid.run(); -- cgit v1.2.3