diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-10-02 18:58:06 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-10-02 18:58:06 -0700 |
commit | 6daacadaffd59f14606f0f9110802ae18e0aa086 (patch) | |
tree | 98c4273143332adaba5d36e7469d8694eadc61b2 /src/github/daneren2005 | |
parent | 146491ac63dc7beba308997f2c744bdaaed1bc7f (diff) | |
download | dsub-6daacadaffd59f14606f0f9110802ae18e0aa086.tar.gz dsub-6daacadaffd59f14606f0f9110802ae18e0aa086.tar.bz2 dsub-6daacadaffd59f14606f0f9110802ae18e0aa086.zip |
Fix menu items not being updated
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index 2dbf3535..d2e20b18 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -40,6 +40,7 @@ import android.view.MenuItem; import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
+import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
@@ -169,7 +170,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo, Object selected) {
MenuInflater inflater = context.getMenuInflater();
-
+
if(selected instanceof Entry) {
Entry entry = (Entry) selected;
if(entry instanceof PodcastEpisode && !entry.isVideo()) {
@@ -208,8 +209,9 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR }
// If we are looking at a standard song view, get downloadFile to cache what options to show
- if(view instanceof SongView) {
- SongView songView = (SongView) view;
+ AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
+ if(info.targetView instanceof SongView) {
+ SongView songView = (SongView) info.targetView;
DownloadFile downloadFile = songView.getDownloadFile();
try {
@@ -224,7 +226,7 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR menu.removeItem(R.id.song_menu_download);
} else {
// Remove delete option if nothing to delete
- menu.removeItem(R.id.menu_delete);
+ menu.removeItem(R.id.song_menu_delete);
}
}
} catch(Exception e) {
|