aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-11-20 13:29:34 -0800
committerdaneren2005 <daneren2005@gmail.com>2013-11-20 13:29:34 -0800
commitff38b10ad35996a5f5f981532e1b5d455bdfc0e7 (patch)
treed661d19a87f6395c66e8174348f2cda793d7c8de /src
parent83cf5a29d4428296f3ccfbfc7d5bddd2d601be58 (diff)
downloaddsub-ff38b10ad35996a5f5f981532e1b5d455bdfc0e7.tar.gz
dsub-ff38b10ad35996a5f5f981532e1b5d455bdfc0e7.tar.bz2
dsub-ff38b10ad35996a5f5f981532e1b5d455bdfc0e7.zip
Attempt to fix download list going back to top on changes
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/DownloadFragment.java31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/github/daneren2005/dsub/fragments/DownloadFragment.java b/src/github/daneren2005/dsub/fragments/DownloadFragment.java
index fe886e42..e6b7c0a6 100644
--- a/src/github/daneren2005/dsub/fragments/DownloadFragment.java
+++ b/src/github/daneren2005/dsub/fragments/DownloadFragment.java
@@ -103,6 +103,7 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
private VisualizerView visualizerView;
private boolean nowPlaying = true;
private ScheduledFuture<?> hideControlsFuture;
+ private List<DownloadFile> songList;
private SongListAdapter songListAdapter;
private SilentBackgroundTask<Void> onProgressChangedTask;
private SilentBackgroundTask<Void> onCurrentChangedTask;
@@ -866,8 +867,8 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
}
if(startFlipped) {
- scrollToCurrent();
startFlipped = false;
+ scrollToCurrent();
}
onProgressChanged();
@@ -941,7 +942,6 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
}
onDownloadListChangedTask = new SilentBackgroundTask<Void>(context) {
- List<DownloadFile> list;
int currentPlayingIndex;
int size;
@@ -950,19 +950,19 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
currentPlayingIndex = downloadService.getCurrentPlayingIndex() + 1;
size = downloadService.size();
- list = new ArrayList<DownloadFile>();
- if(nowPlaying) {
- list.addAll(downloadService.getSongs());
- }
- else {
- list.addAll(downloadService.getBackgroundDownloads());
- }
-
return null;
}
@Override
protected void done(Void result) {
+ List<DownloadFile> list;
+ if(nowPlaying) {
+ list = downloadService.getSongs();
+ }
+ else {
+ list = downloadService.getBackgroundDownloads();
+ }
+
if(downloadService.isShufflePlayEnabled()) {
emptyTextView.setText(R.string.download_shuffle_loading);
}
@@ -971,6 +971,17 @@ public class DownloadFragment extends SubsonicFragment implements OnGestureListe
}
playlistView.setAdapter(songListAdapter = new SongListAdapter(list));
+
+ if(songListAdapter == null || refresh) {
+ songList = new ArrayList<DownloadFile>();
+ songList.addAll(list);
+ playlistView.setAdapter(songListAdapter = new SongListAdapter(songList));
+ } else {
+ songList.clear();
+ songList.addAll(list);
+ songListAdapter.notifyDataSetChanged();
+ }
+
emptyTextView.setVisibility(list.isEmpty() ? View.VISIBLE : View.GONE);
currentRevision = downloadService.getDownloadListUpdateRevision();