aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-04-27 15:34:34 -0700
committerScott Jackson <daneren2005@gmail.com>2014-04-27 15:34:34 -0700
commitec7e2d1638ec2742b3ce4598150a79acf7b0e632 (patch)
tree9f7be50555c6603f08ee63015a099e8bc9f4222f
parent4aebaf640b685b42767ef1077178dc5d2084e731 (diff)
downloaddsub-ec7e2d1638ec2742b3ce4598150a79acf7b0e632.tar.gz
dsub-ec7e2d1638ec2742b3ce4598150a79acf7b0e632.tar.bz2
dsub-ec7e2d1638ec2742b3ce4598150a79acf7b0e632.zip
Fix issues with genre lists
-rw-r--r--res/layout/grid_view.xml3
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java42
2 files changed, 26 insertions, 19 deletions
diff --git a/res/layout/grid_view.xml b/res/layout/grid_view.xml
index e2bcd49f..17b2f8aa 100644
--- a/res/layout/grid_view.xml
+++ b/res/layout/grid_view.xml
@@ -2,7 +2,8 @@
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dip"
+ android:layout_weight="1.0"
android:numColumns="auto_fit"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index abbf95c8..73a67592 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -135,22 +135,24 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
entryList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
entryList.setOnItemClickListener(this);
- if(albumListType == null || "starred".equals(albumListType)) {
- albumList = (GridView) inflater.inflate(R.layout.unscrollable_grid_view, entryList, false);
+ entryList.setOnScrollListener(new AbsListView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(AbsListView view, int scrollState) {}
- entryList.setOnScrollListener(new AbsListView.OnScrollListener() {
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {}
+ @Override
+ public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
+ int topRowVerticalPosition = (entryList.getChildCount() == 0) ? 0 : entryList.getChildAt(0).getTop();
+ refreshLayout.setEnabled(topRowVerticalPosition >= 0);
+ }
+ });
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- int topRowVerticalPosition = (entryList.getChildCount() == 0) ? 0 : entryList.getChildAt(0).getTop();
- refreshLayout.setEnabled(topRowVerticalPosition >= 0);
- }
- });
+ if(albumListType == null || "starred".equals(albumListType)) {
+ 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);
+ rootGroup.removeView(entryList);
rootGroup.addView(albumList);
albumList.setOnScrollListener(new AbsListView.OnScrollListener() {
@@ -183,11 +185,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
replaceFragment(fragment, true);
}
});
- if(albumListType == null || "starred".equals(albumListType)) {
- entryList.addHeaderView(albumList);
- } else {
- entryList.setVisibility(View.GONE);
- }
emptyView = rootView.findViewById(R.id.select_album_empty);
@@ -602,7 +599,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
SelectDirectoryFragment.this.albumListType = "genres-songs";
result = service.getSongsByGenre(albumListExtra, size, 0, context, this);
}
- } else if("genres".equals(albumListType)) {
+ } else if("genres".equals(albumListType) || "genres-songs".equals(albumListType)) {
result = service.getSongsByGenre(albumListExtra, size, 0, context, this);
} else {
result = service.getAlbumList(albumListType, size, 0, context, this);
@@ -664,7 +661,16 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
emptyView.setVisibility((entries.isEmpty() && albums.isEmpty()) ? View.VISIBLE : View.GONE);
entryAdapter = new EntryAdapter(context, getImageLoader(), entries, (podcastId == null));
entryList.setAdapter(entryAdapter);
- if(albumListType == null || "starred".equals(albumListType)) {
+ if("genres-songs".equals(albumListType)) {
+ ViewGroup rootGroup = (ViewGroup) rootView.findViewById(R.id.select_album_layout);
+ if(rootGroup.findViewById(R.id.gridview) != null) {
+ rootGroup.removeView(albumList);
+ rootGroup.addView(entryList);
+ }
+
+ entryList.setAdapter(new AlbumListAdapter(context, entryAdapter, albumListType, albumListExtra, albumListSize));
+ }
+ else if(albumListType == null || "starred".equals(albumListType)) {
albumList.setAdapter(new AlbumGridAdapter(context, getImageLoader(), albums));
} else {
albumList.setAdapter(new AlbumListAdapter(context, new AlbumGridAdapter(context, getImageLoader(), albums), albumListType, albumListExtra, albumListSize));