aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-07-09 22:03:54 -0700
committerScott Jackson <daneren2005@gmail.com>2014-07-09 22:03:54 -0700
commitea1204acc79201c9b366f982207e34e0ab3d1236 (patch)
tree7590a0176ee9a39eeb15daef072b32816c9d540b /src
parent103e8d074f6b6ef6c57cb5a2a2b38a7630926a3a (diff)
downloaddsub-ea1204acc79201c9b366f982207e34e0ab3d1236.tar.gz
dsub-ea1204acc79201c9b366f982207e34e0ab3d1236.tar.bz2
dsub-ea1204acc79201c9b366f982207e34e0ab3d1236.zip
Fix new simple grid views not being clickable
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index aa8293f9..fea3d44c 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -164,28 +164,8 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
setupScrollList(albumList);
}
- albumList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- MusicDirectory.Entry entry = (MusicDirectory.Entry) parent.getItemAtPosition(position);
- SubsonicFragment fragment = new SelectDirectoryFragment();
- Bundle args = new Bundle();
- args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
- args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
- if ("newest".equals(albumListType)) {
- args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
- }
- if(entry.getArtist() == null && entry.getParent() == null) {
- args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
- }
- fragment.setArguments(args);
-
- replaceFragment(fragment, true);
- }
- });
-
registerForContextMenu(entryList);
- registerForContextMenu(albumList);
+ setupAlbumList();
if(entries == null) {
if(primaryFragment || secondaryFragment) {
@@ -662,15 +642,16 @@ 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(addAlbumHeader) {
- if(showHeader) {
+ if(entries.size() > 0) {
entryList.addHeaderView(albumList);
} else {
ViewGroup rootGroup = (ViewGroup) rootView.findViewById(R.id.select_album_layout);
- albumList = (GridView) inflater.inflate(R.layout.grid_view, rootGroup, false);
+ albumList = (GridView) context.getLayoutInflater().inflate(R.layout.grid_view, rootGroup, false);
rootGroup.removeView(entryList);
rootGroup.addView(albumList);
setupScrollList(albumList);
+ setupAlbumList();
}
addAlbumHeader = false;
}
@@ -727,6 +708,31 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
}
}
+ private void setupAlbumList() {
+ albumList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ MusicDirectory.Entry entry = (MusicDirectory.Entry) parent.getItemAtPosition(position);
+ SubsonicFragment fragment = new SelectDirectoryFragment();
+ Bundle args = new Bundle();
+ args.putString(Constants.INTENT_EXTRA_NAME_ID, entry.getId());
+ args.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.getTitle());
+ if ("newest".equals(albumListType)) {
+ args.putBoolean(Constants.INTENT_EXTRA_REFRESH_LISTINGS, true);
+ }
+ if(entry.getArtist() == null && entry.getParent() == null) {
+ args.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true);
+ }
+ fragment.setArguments(args);
+
+ replaceFragment(fragment, true);
+ }
+ });
+
+ registerForContextMenu(entryList);
+ registerForContextMenu(albumList);
+ }
+
private void playNow(final boolean shuffle, final boolean append) {
playNow(shuffle, append, false);
}