From aea0ce8ac28c32e14f91a5efc3558072788794e0 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 30 Sep 2012 16:42:14 -0700 Subject: Moved playlist context to context_menu + added download/cache items to it --- .../dsub/activity/SelectPlaylistActivity.java | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'subsonic-android/src/github') diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java index f515d5be..6afefc5b 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java @@ -21,12 +21,8 @@ package github.daneren2005.dsub.activity; import android.content.Intent; import android.os.Bundle; -import android.view.ContextMenu; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; +import android.view.*; import android.widget.AdapterView; -import android.widget.ImageButton; import android.widget.ListView; import github.daneren2005.dsub.R; import github.daneren2005.dsub.domain.Playlist; @@ -44,6 +40,8 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt 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; @@ -123,8 +121,9 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt @Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, view, menuInfo); - menu.add(Menu.NONE, MENU_ITEM_PLAY_ALL, MENU_ITEM_PLAY_ALL, R.string.common_play_now); - menu.add(Menu.NONE, MENU_ITEM_PLAY_SHUFFLED, MENU_ITEM_PLAY_SHUFFLED, R.string.common_play_shuffled); + + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.select_playlist_context, menu); } @Override @@ -134,14 +133,20 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt Intent intent; switch (menuItem.getItemId()) { - case MENU_ITEM_PLAY_ALL: + case R.id.playlist_menu_download: + downloadRecursively(playlist.getId(), false, true, false, false, true); + break; + case R.id.playlist_menu_pin: + downloadRecursively(playlist.getId(), true, true, false, false, true); + break; + case R.id.playlist_menu_play_now: intent = new Intent(SelectPlaylistActivity.this, SelectAlbumActivity.class); intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId()); intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName()); intent.putExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true); Util.startActivityWithoutTransition(SelectPlaylistActivity.this, intent); break; - case MENU_ITEM_PLAY_SHUFFLED: + case R.id.playlist_menu_play_shuffled: intent = new Intent(SelectPlaylistActivity.this, SelectAlbumActivity.class); intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId()); intent.putExtra(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName()); -- cgit v1.2.3