aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src
diff options
context:
space:
mode:
Diffstat (limited to 'subsonic-android/src')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java11
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/view/EntryAdapter.java13
2 files changed, 15 insertions, 9 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
index 392401bf..926467ec 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
@@ -53,6 +53,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
private Button moreButton;
private Boolean licenseValid;
private boolean showHeader = true;
+ private EntryAdapter entryAdapter;
/**
* Called when the activity is first created.
@@ -695,7 +696,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
}
emptyView.setVisibility(entries.isEmpty() ? View.VISIBLE : View.GONE);
- entryList.setAdapter(new EntryAdapter(SelectAlbumActivity.this, getImageLoader(), entries, true));
+ entryList.setAdapter(entryAdapter = new EntryAdapter(SelectAlbumActivity.this, getImageLoader(), entries, true));
licenseValid = result.getSecond();
invalidateOptionsMenu();
@@ -753,12 +754,16 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
@Override
protected void done(Void result) {
- refresh();
+ 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) {
+ protected void error(Throwable error) {
String msg;
if (error instanceof OfflineException || error instanceof ServerTooOldException) {
msg = getErrorMessage(error);
diff --git a/subsonic-android/src/github/daneren2005/dsub/view/EntryAdapter.java b/subsonic-android/src/github/daneren2005/dsub/view/EntryAdapter.java
index 6d2c7a63..476d3478 100644
--- a/subsonic-android/src/github/daneren2005/dsub/view/EntryAdapter.java
+++ b/subsonic-android/src/github/daneren2005/dsub/view/EntryAdapter.java
@@ -37,13 +37,19 @@ public class EntryAdapter extends ArrayAdapter<MusicDirectory.Entry> {
private final SubsonicTabActivity activity;
private final ImageLoader imageLoader;
private final boolean checkable;
+ private List<MusicDirectory.Entry> entries;
public EntryAdapter(SubsonicTabActivity activity, ImageLoader imageLoader, List<MusicDirectory.Entry> entries, boolean checkable) {
super(activity, android.R.layout.simple_list_item_1, entries);
+ this.entries = entries;
this.activity = activity;
this.imageLoader = imageLoader;
this.checkable = checkable;
}
+
+ public void removeAt(int position) {
+ entries.remove(position);
+ }
@Override
public View getView(int position, View convertView, ViewGroup parent) {
@@ -51,12 +57,7 @@ public class EntryAdapter extends ArrayAdapter<MusicDirectory.Entry> {
if (entry.isDirectory()) {
AlbumView view;
- // TODO: Reuse AlbumView objects once cover art loading is working.
-// if (convertView != null && convertView instanceof AlbumView) {
-// view = (AlbumView) convertView;
-// } else {
- view = new AlbumView(activity);
-// }
+ view = new AlbumView(activity);
view.setAlbum(entry, imageLoader);
return view;