aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2012-10-06 12:42:40 -0700
committerScott Jackson <daneren2005@gmail.com>2012-10-06 12:42:40 -0700
commitafd5890663fb626c1cd0726c2665f9c3c5b796c4 (patch)
tree70388874db8dcb751f47b45835e7a51e03265311
parent9bb3ff579898ec0ee1d9e38bb973abf6e53b4782 (diff)
downloaddsub-afd5890663fb626c1cd0726c2665f9c3c5b796c4.tar.gz
dsub-afd5890663fb626c1cd0726c2665f9c3c5b796c4.tar.bz2
dsub-afd5890663fb626c1cd0726c2665f9c3c5b796c4.zip
New option to toggle between Now Playing and Downloading
-rw-r--r--subsonic-android/res/menu/nowplaying.xml4
-rw-r--r--subsonic-android/res/values/strings.xml2
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java28
3 files changed, 29 insertions, 5 deletions
diff --git a/subsonic-android/res/menu/nowplaying.xml b/subsonic-android/res/menu/nowplaying.xml
index a880438e..c8097bf0 100644
--- a/subsonic-android/res/menu/nowplaying.xml
+++ b/subsonic-android/res/menu/nowplaying.xml
@@ -24,4 +24,8 @@
android:icon="@drawable/action_screen_on_off"
android:title="@string/download.menu_screen_on"
android:showAsAction="ifRoom|withText"/>
+
+ <item
+ android:id="@+id/menu_toggle_now_playing"
+ android:title="@string/download.show_downloading"/>
</menu>
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml
index a71f896a..a134c0b3 100644
--- a/subsonic-android/res/values/strings.xml
+++ b/subsonic-android/res/values/strings.xml
@@ -119,6 +119,8 @@
<string name="download.jukebox_server_too_old">Remote control is not supported. Please upgrade your Subsonic server.</string>
<string name="download.jukebox_offline">Remote control is not available in offline mode.</string>
<string name="download.jukebox_not_authorized">Remote control is not allowed. Please enable jukebox mode in <b>Users &gt; Settings</b> on your Subsonic server.</string>
+ <string name="download.show_downloading">Show Downloading</string>
+ <string name="download.show_now_playing">Show Now Playing</string>
<string name="starring_content_starred">Starred \"%s\"</string>
<string name="starring_content_unstarred">Unstarred \"%s\"</string>
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
index add80021..98c75678 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/DownloadActivity.java
@@ -116,6 +116,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
private int swipeDistance;
private int swipeVelocity;
private VisualizerView visualizerView;
+ private boolean nowPlaying = true;
/**
* Called when the activity is first created.
@@ -123,7 +124,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setTitle("Now Playing");
+ setTitle(nowPlaying ? "Now Playing" : "Downloading");
setContentView(R.layout.download);
getSupportActionBar().hide();
@@ -504,15 +505,18 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem savePlaylist = menu.findItem(R.id.menu_save_playlist);
- boolean savePlaylistEnabled = !Util.isOffline(this);
- savePlaylist.setEnabled(savePlaylistEnabled);
- savePlaylist.setVisible(savePlaylistEnabled);
+ boolean enabled = !Util.isOffline(this);
+ savePlaylist.setEnabled(enabled);
+ savePlaylist.setVisible(enabled);
MenuItem screenOption = menu.findItem(R.id.menu_screen_on_off);
if (getDownloadService() != null && getDownloadService().getKeepScreenOn()) {
screenOption.setTitle(R.string.download_menu_screen_off);
} else {
screenOption.setTitle(R.string.download_menu_screen_on);
}
+ MenuItem togglePlaying = menu.findItem(R.id.menu_toggle_now_playing);
+ togglePlaying.setVisible(enabled);
+ togglePlaying.setTitle(nowPlaying ? R.string.download_show_downloading : R.string.download_show_now_playing);
return super.onPrepareOptionsMenu(menu);
}
@@ -533,6 +537,7 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
menu.findItem(R.id.menu_lyrics).setVisible(false);
menu.findItem(R.id.menu_save_playlist).setVisible(false);
menu.findItem(R.id.menu_star).setVisible(false);
+ menu.findItem(R.id.menu_toggle_now_playing).setVisible(false);
} else {
menu.findItem(R.id.menu_star).setTitle(downloadFile.getSong().isStarred() ? R.string.common_unstar : R.string.common_star);
}
@@ -600,6 +605,9 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
case R.id.menu_star:
toggleStarred(song.getSong());
return true;
+ case R.id.menu_toggle_now_playing:
+ toggleNowPlaying();
+ return true;
default:
return false;
}
@@ -693,7 +701,11 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
return;
}
- List<DownloadFile> list = downloadService.getSongs();
+ List<DownloadFile> list;
+ if(nowPlaying)
+ list = downloadService.getSongs();
+ else
+ list = downloadService.getBackgroundDownloads();
playlistView.setAdapter(new SongListAdapter(list));
emptyTextView.setVisibility(list.isEmpty() ? View.VISIBLE : View.GONE);
@@ -878,6 +890,12 @@ public class DownloadActivity extends SubsonicTabActivity implements OnGestureLi
return false;
}
+
+ private void toggleNowPlaying() {
+ nowPlaying = !nowPlaying;
+ setTitle(nowPlaying ? "Now Playing" : "Downloading");
+ onDownloadListChanged();
+ }
@Override
public void onLongPress(MotionEvent e) {