diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-09 20:48:19 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-09 20:48:19 -0700 |
commit | 9b81170e0bc2ffe6fa635e52563f4509546b0d26 (patch) | |
tree | bc9fb7ef4c5f220f5da28f143cc8bf2a11b0d19e /subsonic-android/src/github | |
parent | b3248e922289cc66bf68b010380bfdabaa663695 (diff) | |
download | dsub-9b81170e0bc2ffe6fa635e52563f4509546b0d26.tar.gz dsub-9b81170e0bc2ffe6fa635e52563f4509546b0d26.tar.bz2 dsub-9b81170e0bc2ffe6fa635e52563f4509546b0d26.zip |
Don't create a new header each time list is reloaded
Diffstat (limited to 'subsonic-android/src/github')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 192f5ea0..1e4bfc07 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -355,7 +355,10 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter if (songCount > 0) {
if(showHeader) {
- entryList.addHeaderView(createHeader(entries), null, false);
+ View header = createHeader(entries);
+ if(header != null) {
+ entryList.addHeaderView(header, null, false);
+ }
}
} else {
showHeader = false;
@@ -620,8 +623,13 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
private View createHeader(List<MusicDirectory.Entry> entries) {
- View header = LayoutInflater.from(context).inflate(R.layout.select_album_header, entryList, false);
-
+ View header = entryList.findViewById(R.id.select_album_header);
+ boolean add = false;
+ if(header == null) {
+ header = LayoutInflater.from(context).inflate(R.layout.select_album_header, entryList, false);
+ add = true;
+ }
+
View coverArtView = header.findViewById(R.id.select_album_art);
getImageLoader().loadImage(coverArtView, entries.get(random.nextInt(entries.size())), true, true);
@@ -656,6 +664,10 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter String s = context.getResources().getQuantityString(R.plurals.select_album_n_songs, songCount, songCount);
songCountView.setText(s.toUpperCase());
- return header;
+ if(add) {
+ return header;
+ } else {
+ return null;
+ }
}
}
\ No newline at end of file |