aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-18 16:23:55 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-18 16:23:55 -0700
commit8738032259a3ca7bde8eb97bd1f6840fd03d5b31 (patch)
tree652d4e85624ae765fe8802ecabb6fa6af28e2672
parentacd3c966966b632cd20d4e67b33d9839dc69b459 (diff)
downloaddsub-8738032259a3ca7bde8eb97bd1f6840fd03d5b31.tar.gz
dsub-8738032259a3ca7bde8eb97bd1f6840fd03d5b31.tar.bz2
dsub-8738032259a3ca7bde8eb97bd1f6840fd03d5b31.zip
#370 Cancel current load task before starting another
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 2191f439..f0497703 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -63,6 +63,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
private List<MusicDirectory.Entry> entries;
private boolean albumContext = false;
private boolean addAlbumHeader = false;
+ private LoadTask currentTask;
String id;
String name;
@@ -433,6 +434,10 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
refresh = true;
}
+ if(currentTask != null) {
+ currentTask.cancel();
+ }
+
entryList.setVisibility(View.INVISIBLE);
if (playlistId != null) {
getPlaylist(playlistId, playlistName, refresh);
@@ -599,6 +604,8 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
public LoadTask() {
super(SelectDirectoryFragment.this);
+
+ currentTask = this;
}
protected abstract MusicDirectory load(MusicService service) throws Exception;
@@ -622,6 +629,8 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
licenseValid = result.getSecond();
finishLoading();
+
+ currentTask = null;
}
}