aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 2edb38ac..d0cde823 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -150,7 +150,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if(albumListType == null || "starred".equals(albumListType) || !largeAlbums) {
albumList = (GridView) inflater.inflate(R.layout.unscrollable_grid_view, entryList, false);
- entryList.addHeaderView(albumList);
} else {
ViewGroup rootGroup = (ViewGroup) rootView.findViewById(R.id.select_album_layout);
albumList = (GridView) inflater.inflate(R.layout.grid_view, rootGroup, false);
@@ -644,9 +643,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
if(showHeader) {
View header = createHeader(entries);
if(header != null && entryList != null) {
- entryList.removeHeaderView(albumList);
entryList.addHeaderView(header, null, false);
- entryList.addHeaderView(albumList);
}
}
} else {
@@ -656,6 +653,11 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
}
+ // Needs to be added here, GB crashes if you to try to remove the header view before adapter is set
+ if(albumListType == null || "starred".equals(albumListType) || !largeAlbums) {
+ entryList.addHeaderView(albumList);
+ }
+
emptyView.setVisibility((entries.isEmpty() && albums.isEmpty()) ? View.VISIBLE : View.GONE);
entryAdapter = new EntryAdapter(context, getImageLoader(), entries, (podcastId == null));
entryList.setAdapter(entryAdapter);