aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/layout/select_album_header.xml1
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java20
2 files changed, 17 insertions, 4 deletions
diff --git a/subsonic-android/res/layout/select_album_header.xml b/subsonic-android/res/layout/select_album_header.xml
index 6905d421..63e91887 100644
--- a/subsonic-android/res/layout/select_album_header.xml
+++ b/subsonic-android/res/layout/select_album_header.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/select_album_header"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
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