aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-08-26 16:38:33 -0700
committerScott Jackson <daneren2005@gmail.com>2014-08-26 16:38:33 -0700
commit037b71baa58e30093aa9d021bcf9fc16f23c4008 (patch)
treeef7d9505fcb609e5fbce41aff5a5c6460f9298ec
parent45d5ccfdb68d61ec56919a1e19c9816127726948 (diff)
downloaddsub-037b71baa58e30093aa9d021bcf9fc16f23c4008.tar.gz
dsub-037b71baa58e30093aa9d021bcf9fc16f23c4008.tar.bz2
dsub-037b71baa58e30093aa9d021bcf9fc16f23c4008.zip
Fix issue with context items referencing wrong entry
-rw-r--r--src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index bb3c061a..a8b1f96b 100644
--- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -342,19 +342,19 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
Object selectedItem;
+ int headers = entryList.getHeaderViewsCount();
if(albumContext) {
- selectedItem = albums.get(showHeader ? (info.position - 1) : info.position);
+ selectedItem = albums.get(info.position);
} else {
if(info.position == 0) {
return false;
}
- info.position--;
- selectedItem = entries.get(showHeader ? (info.position - 1) : info.position);
+ selectedItem = entries.get(info.position - headers);
}
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>();
- Iterator it = entries.listIterator(info.position - 1);
+ Iterator it = entries.listIterator(info.position - headers);
while(it.hasNext()) {
songs.add((MusicDirectory.Entry) it.next());
}
@@ -369,7 +369,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
switch (menuItem.getItemId()) {
case R.id.song_menu_remove_playlist:
- removeFromPlaylist(playlistId, playlistName, Arrays.<Integer>asList(info.position - 1));
+ removeFromPlaylist(playlistId, playlistName, Arrays.<Integer>asList(info.position - headers));
break;
case R.id.song_menu_server_download:
downloadPodcastEpisode((PodcastEpisode)selectedItem);