diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-07-18 15:18:22 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-07-18 15:18:22 -0700 |
commit | 333960288ec17884cea0cefe3122bc074692d9aa (patch) | |
tree | 86442a28015832b38435498a701e53400d049f72 /src | |
parent | bd78e1422b403946ba0b1a44388fe35dc9308f23 (diff) | |
download | dsub-333960288ec17884cea0cefe3122bc074692d9aa.tar.gz dsub-333960288ec17884cea0cefe3122bc074692d9aa.tar.bz2 dsub-333960288ec17884cea0cefe3122bc074692d9aa.zip |
Convert artist fragment to use ListFragments default refresh method
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectArtistFragment.java | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java b/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java index 4817967f..e5b3bfba 100644 --- a/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java @@ -154,36 +154,8 @@ public class SelectArtistFragment extends SelectListFragment<Artist> { }
@Override
- protected void refresh(final boolean refresh) {
- listView.setVisibility(View.INVISIBLE);
-
- BackgroundTask<Indexes> task = new TabBackgroundTask<Indexes>(this) {
- @Override
- protected Indexes doInBackground() throws Throwable {
- MusicService musicService = MusicServiceFactory.getMusicService(context);
- if (!Util.isOffline(context) && !Util.isTagBrowsing(context)) {
- musicFolders = musicService.getMusicFolders(refresh, context, this);
- }
- String musicFolderId = Util.getSelectedMusicFolderId(context);
- return musicService.getIndexes(musicFolderId, refresh, context, this);
- }
-
- @Override
- protected void done(Indexes result) {
- objects = new ArrayList<Artist>(result.getShortcuts().size() + result.getArtists().size());
- objects.addAll(result.getShortcuts());
- objects.addAll(result.getArtists());
- listView.setFastScrollEnabled(false);
- listView.setAdapter(adapter = getAdapter(objects));
- listView.setFastScrollEnabled(true);
- entries = result.getEntries();
-
- setMusicFolders();
- listView.setVisibility(View.VISIBLE);
- refreshLayout.setRefreshing(false);
- }
- };
- task.execute();
+ protected void onFinishRefresh() {
+ setMusicFolders();
}
@Override
@@ -199,7 +171,18 @@ public class SelectArtistFragment extends SelectListFragment<Artist> { @Override
public List<Artist> getObjects(MusicService musicService, boolean refresh, ProgressListener listener) throws Exception {
- return null;
+ if(!Util.isOffline(context) && !Util.isTagBrowsing(context)) {
+ musicFolders = musicService.getMusicFolders(refresh, context, listener);
+ }
+ String musicFolderId = Util.getSelectedMusicFolderId(context);
+
+ Indexes indexes = musicService.getIndexes(musicFolderId, refresh, context, listener);
+ List<Artist> artists = new ArrayList<Artist>(indexes.getShortcuts().size() + indexes.getArtists().size());
+ artists.addAll(indexes.getShortcuts());
+ artists.addAll(indexes.getArtists());
+ entries = indexes.getEntries();
+
+ return artists;
}
@Override
|