diff --git a/src/org/xbmc/android/remote/presentation/controller/PlaylistController.java b/src/org/xbmc/android/remote/presentation/controller/PlaylistController.java index dab1a103..fe84c27c 100644 --- a/src/org/xbmc/android/remote/presentation/controller/PlaylistController.java +++ b/src/org/xbmc/android/remote/presentation/controller/PlaylistController.java @@ -59,6 +59,7 @@ import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AdapterView; +import android.widget.Toast; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; @@ -329,10 +330,10 @@ public void onItemChanged(ICurrentlyPlaying newItem) { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // be aware that this must be explicitly called by your activity! -/* final OneHolderholder = (OneHolder)((AdapterContextMenuInfo)menuInfo).targetView.getTag(); - menu.setHeaderTitle(holder.holderItem.filename); + final PlaylistItem playlistItem = (PlaylistItem)(mList.getAdapter().getItem(((AdapterContextMenuInfo)menuInfo).position)); + menu.setHeaderTitle(playlistItem.filename); menu.add(0, ITEM_CONTEXT_PLAY, 1, "Play"); - menu.add(0, ITEM_CONTEXT_REMOVE, 2, "Remove");*/ + menu.add(0, ITEM_CONTEXT_REMOVE, 2, "Remove"); } public void onContextItemSelected(MenuItem item) { @@ -352,12 +353,26 @@ public void onContextItemSelected(MenuItem item) { case ITEM_CONTEXT_REMOVE: switch (mPlayListId) { case MUSIC_PLAYLIST_ID: - mMusicManager.removeFromPlaylist(new DataResponse(), playlistItem.path, mActivity.getApplicationContext()); + mMusicManager.removeFromPlaylist(new DataResponse(){ + public void run() { + if (value == false) { + Toast.makeText(mActivity.getApplicationContext(), "Failed to remove song!", Toast.LENGTH_SHORT).show(); + } + updatePlaylist(); + } + }, playlistItem.path, mActivity.getApplicationContext()); break; case VIDEO_PLAYLIST_ID: - mVideoManager.removeFromPlaylist(new DataResponse(), playlistItem.path, mActivity.getApplicationContext()); + mVideoManager.removeFromPlaylist(new DataResponse(){ + public void run() { + if (value == false) { + Toast.makeText(mActivity.getApplicationContext(), "Failed to remove video!", Toast.LENGTH_SHORT).show(); + } + updatePlaylist(); + } + }, playlistItem.path, mActivity.getApplicationContext()); break; - } + } break; default: return; diff --git a/src/org/xbmc/httpapi/client/MusicClient.java b/src/org/xbmc/httpapi/client/MusicClient.java index d267eb0e..b234cee1 100644 --- a/src/org/xbmc/httpapi/client/MusicClient.java +++ b/src/org/xbmc/httpapi/client/MusicClient.java @@ -152,7 +152,7 @@ public boolean setPlaylistPosition(INotifiableManager manager, int position) { * @return True on success, false otherwise. */ public boolean removeFromPlaylist(INotifiableManager manager, int position) { - return mConnection.getBoolean(manager, "RemoveFromPlaylist", PLAYLIST_ID + ";" + position); + return mConnection.getBoolean(manager, "RemoveFromPlaylist", position + ";" + PLAYLIST_ID); } /** @@ -161,7 +161,7 @@ public boolean removeFromPlaylist(INotifiableManager manager, int position) { * @return True on success, false otherwise. */ public boolean removeFromPlaylist(INotifiableManager manager, String path) { - return mConnection.getBoolean(manager, "RemoveFromPlaylist", PLAYLIST_ID + ";" + path); + return mConnection.getBoolean(manager, "RemoveFromPlaylist", path + ";" + PLAYLIST_ID); } /** diff --git a/src/org/xbmc/httpapi/client/VideoClient.java b/src/org/xbmc/httpapi/client/VideoClient.java index 901ea235..b76ab8ad 100644 --- a/src/org/xbmc/httpapi/client/VideoClient.java +++ b/src/org/xbmc/httpapi/client/VideoClient.java @@ -539,6 +539,6 @@ public ArrayList getPlaylist(INotifiableManager manager) { * @return True on success, false otherwise. */ public boolean removeFromPlaylist(INotifiableManager manager, String path) { - return mConnection.getBoolean(manager, "RemoveFromPlaylist", PLAYLIST_ID + ";" + path); + return mConnection.getBoolean(manager, "RemoveFromPlaylist", path + ";" + PLAYLIST_ID); } } \ No newline at end of file