diff options
3 files changed, 45 insertions, 31 deletions
diff --git a/subsonic-android/res/menu/select_playlist_context.xml b/subsonic-android/res/menu/select_playlist_context.xml index b6a20c95..a376ec58 100644 --- a/subsonic-android/res/menu/select_playlist_context.xml +++ b/subsonic-android/res/menu/select_playlist_context.xml @@ -1,5 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/playlist_info" + android:title="@string/common.info" + /> <item android:id="@+id/playlist_menu_play_now" diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml index fa3fcefd..bf2f448a 100644 --- a/subsonic-android/res/values/strings.xml +++ b/subsonic-android/res/values/strings.xml @@ -14,6 +14,7 @@ <string name="common.delete">Delete</string>
<string name="common.star">Star</string>
<string name="common.unstar">Unstar</string>
+ <string name="common.info">Info</string>
<string name="button_bar.home">DSub home</string>
<string name="button_bar.browse">Media library</string>
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java index ef9c8003..2249f0ec 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java @@ -27,6 +27,7 @@ import android.view.*; import android.widget.AdapterView; import android.widget.ListView; import github.daneren2005.dsub.R; +import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.Playlist; import github.daneren2005.dsub.service.MusicServiceFactory; import github.daneren2005.dsub.service.MusicService; @@ -37,12 +38,6 @@ import github.daneren2005.dsub.util.*; import java.util.List; public class SelectPlaylistActivity extends SubsonicTabActivity implements AdapterView.OnItemClickListener { - - private static final int MENU_ITEM_PLAY_ALL = 1; - private static final int MENU_ITEM_PLAY_SHUFFLED = 2; - private static final int MENU_ITEM_DOWNLOAD = 3; - private static final int MENU_ITEM_CACHE = 4; - private ListView list; private View emptyTextView; @@ -161,6 +156,9 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt case R.id.playlist_menu_delete: deletePlaylist(playlist); break; + case R.id.playlist_info: + displayPlaylistInfo(playlist); + break; default: return super.onContextItemSelected(menuItem); } @@ -178,7 +176,7 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt Util.startActivityWithoutTransition(SelectPlaylistActivity.this, intent); } - private void deletePlaylist(final Playlist playlist) { + private void deletePlaylist(final Playlist playlist) { new AlertDialog.Builder(this) .setIcon(android.R.drawable.ic_dialog_alert) .setTitle("Confirm") @@ -187,35 +185,45 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt @Override public void onClick(DialogInterface dialog, int which) { new TabActivityBackgroundTask<Void>(SelectPlaylistActivity.this) { - @Override - protected Void doInBackground() throws Throwable { - MusicService musicService = MusicServiceFactory.getMusicService(SelectPlaylistActivity.this); - musicService.deletePlaylist(playlist.getId(), SelectPlaylistActivity.this, null); - return null; - } - - @Override - protected void done(Void result) { - refresh(); - Util.toast(SelectPlaylistActivity.this, getResources().getString(R.string.menu_deleted_playlist, playlist.getName())); - } - - @Override - protected void error(Throwable error) { - String msg; - if (error instanceof OfflineException || error instanceof ServerTooOldException) { - msg = getErrorMessage(error); - } else { - msg = getResources().getString(R.string.menu_deleted_playlist_error, playlist.getName()) + " " + getErrorMessage(error); + @Override + protected Void doInBackground() throws Throwable { + MusicService musicService = MusicServiceFactory.getMusicService(SelectPlaylistActivity.this); + musicService.deletePlaylist(playlist.getId(), SelectPlaylistActivity.this, null); + return null; } - Util.toast(SelectPlaylistActivity.this, msg, false); - } - }.execute(); - } + @Override + protected void done(Void result) { + refresh(); + Util.toast(SelectPlaylistActivity.this, getResources().getString(R.string.menu_deleted_playlist, playlist.getName())); + } + + @Override + protected void error(Throwable error) { + String msg; + if (error instanceof OfflineException || error instanceof ServerTooOldException) { + msg = getErrorMessage(error); + } else { + msg = getResources().getString(R.string.menu_deleted_playlist_error, playlist.getName()) + " " + getErrorMessage(error); + } + + Util.toast(SelectPlaylistActivity.this, msg, false); + } + }.execute(); + } }) .setNegativeButton("Cancel", null) .show(); } + + private void displayPlaylistInfo(final Playlist playlist) { + new AlertDialog.Builder(this) + .setIcon(android.R.drawable.ic_dialog_alert) + .setTitle(playlist.getName()) + .setMessage("Owner: " + playlist.getOwner() + "\nComments: " + + ((playlist.getComment() == null) ? "" : playlist.getComment()) + + "\nSong Count: " + playlist.getSongCount() + "\nCreation Date: " + playlist.getCreated().replace('T', ' ')) + .show(); + } }
\ No newline at end of file |