diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-04-23 22:21:12 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-04-23 22:21:12 -0700 |
commit | 161b1ae1823091ee1eb7b03b340dc7576ecd4cfa (patch) | |
tree | 1c33edc062cfe54b180a454fcd39bc0a87f89b17 /src | |
parent | 3e6eb652b371946ca40863114f42f655a96920a2 (diff) | |
download | dsub-161b1ae1823091ee1eb7b03b340dc7576ecd4cfa.tar.gz dsub-161b1ae1823091ee1eb7b03b340dc7576ecd4cfa.tar.bz2 dsub-161b1ae1823091ee1eb7b03b340dc7576ecd4cfa.zip |
Fix issues with album lists
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index fb03f325..c4151220 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -61,6 +61,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter private EntryAdapter entryAdapter;
private List<MusicDirectory.Entry> albums;
private List<MusicDirectory.Entry> entries;
+ private boolean albumContext = false;
String id;
String name;
@@ -124,6 +125,17 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
});
+ albumList.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 = (albumList.getChildCount() == 0) ? 0 : albumList.getChildAt(0).getTop();
+ refreshLayout.setEnabled(topRowVerticalPosition >= 0);
+ }
+ });
+
entryList = (DragSortListView) rootView.findViewById(R.id.select_album_entries);
entryList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
entryList.setOnItemClickListener(this);
@@ -142,13 +154,13 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
});
- albumList.setOnScrollListener(new AbsListView.OnScrollListener() {
+ 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 = (albumList.getChildCount() == 0) ? 0 : albumList.getChildAt(0).getTop();
+ int topRowVerticalPosition = (entryList.getChildCount() == 0) ? 0 : entryList.getChildAt(0).getTop();
refreshLayout.setEnabled(topRowVerticalPosition >= 0);
}
});
@@ -156,6 +168,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter emptyView = rootView.findViewById(R.id.select_album_empty);
registerForContextMenu(entryList);
+ registerForContextMenu(albumList);
Bundle args = getArguments();
if(args != null) {
@@ -309,7 +322,15 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
- MusicDirectory.Entry entry = (MusicDirectory.Entry) entryList.getItemAtPosition(info.position);
+ MusicDirectory.Entry entry;
+ if(view.getId() == R.id.select_album_entries) {
+ entry = (MusicDirectory.Entry) entryList.getItemAtPosition(info.position);
+ albumContext = false;
+ } else {
+ entry = (MusicDirectory.Entry) albumList.getItemAtPosition(info.position);
+ albumContext = true;
+ }
+
onCreateContextMenu(menu, view, menuInfo, entry);
if(!entry.isVideo() && !Util.isOffline(context) && playlistId == null && (podcastId == null || Util.isOffline(context) && podcastId != null)) {
menu.removeItem(R.id.song_menu_remove_playlist);
@@ -335,7 +356,12 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
- Object selectedItem = entries.get(showHeader ? (info.position - 1) : info.position);
+ Object selectedItem;
+ if(albumContext) {
+ selectedItem = albums.get(showHeader ? (info.position - 1) : info.position);
+ } else {
+ selectedItem = entries.get(showHeader ? (info.position - 1) : info.position);
+ }
if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PLAY_NOW_AFTER, false) && menuItem.getItemId() == R.id.song_menu_play_now) {
List<MusicDirectory.Entry> songs = new ArrayList<MusicDirectory.Entry>();
|