aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-01-18 19:09:21 -0800
committerScott Jackson <daneren2005@gmail.com>2013-01-18 19:09:21 -0800
commitfd568f11e052354e97fef2ba51c912f39caba2d3 (patch)
tree1c58c5b987b07e870d30cac095d86785cb23440c /subsonic-android/src/github/daneren2005
parent77d3088273dea71fe6fa79e3e57648dbf805eb89 (diff)
downloaddsub-fd568f11e052354e97fef2ba51c912f39caba2d3.tar.gz
dsub-fd568f11e052354e97fef2ba51c912f39caba2d3.tar.bz2
dsub-fd568f11e052354e97fef2ba51c912f39caba2d3.zip
Closes #92 Add public info/updating to playlists
Diffstat (limited to 'subsonic-android/src/github/daneren2005')
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java19
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/domain/Playlist.java11
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java4
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/MusicService.java2
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java2
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java4
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistsParser.java3
7 files changed, 33 insertions, 12 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java
index 90808a2e..d7deb610 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectPlaylistActivity.java
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.view.*;
import android.widget.AdapterView;
+import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import github.daneren2005.dsub.R;
@@ -229,12 +230,15 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt
}
private void displayPlaylistInfo(final Playlist playlist) {
+ String message = "Owner: " + playlist.getOwner() + "\nComments: " +
+ ((playlist.getComment() == null) ? "" : playlist.getComment()) +
+ "\nSong Count: " + playlist.getSongCount() +
+ ((playlist.getPublic() == null) ? "" : ("\nPublic: " + playlist.getPublic())) +
+ "\nCreation Date: " + playlist.getCreated().replace('T', ' ');
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', ' '))
+ .setMessage(message)
.show();
}
@@ -242,9 +246,16 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt
View dialogView = getLayoutInflater().inflate(R.layout.update_playlist, null);
final EditText nameBox = (EditText)dialogView.findViewById(R.id.get_playlist_name);
final EditText commentBox = (EditText)dialogView.findViewById(R.id.get_playlist_comment);
+ final CheckBox publicBox = (CheckBox)dialogView.findViewById(R.id.get_playlist_public);
nameBox.setText(playlist.getName());
commentBox.setText(playlist.getComment());
+ Boolean pub = playlist.getPublic();
+ if(pub == null) {
+ publicBox.setEnabled(false);
+ } else {
+ publicBox.setChecked(pub);
+ }
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
@@ -257,7 +268,7 @@ public class SelectPlaylistActivity extends SubsonicTabActivity implements Adapt
@Override
protected Void doInBackground() throws Throwable {
MusicService musicService = MusicServiceFactory.getMusicService(SelectPlaylistActivity.this);
- musicService.updatePlaylist(playlist.getId(), nameBox.getText().toString(), commentBox.getText().toString(), SelectPlaylistActivity.this, null);
+ musicService.updatePlaylist(playlist.getId(), nameBox.getText().toString(), commentBox.getText().toString(), publicBox.isChecked(), SelectPlaylistActivity.this, null);
return null;
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/domain/Playlist.java b/subsonic-android/src/github/daneren2005/dsub/domain/Playlist.java
index 14a068b8..c97659c7 100644
--- a/subsonic-android/src/github/daneren2005/dsub/domain/Playlist.java
+++ b/subsonic-android/src/github/daneren2005/dsub/domain/Playlist.java
@@ -31,18 +31,20 @@ public class Playlist implements Serializable {
private String comment;
private String songCount;
private String created;
+ private Boolean pub;
public Playlist(String id, String name) {
this.id = id;
this.name = name;
}
- public Playlist(String id, String name, String owner, String comment, String songCount, String created) {
+ public Playlist(String id, String name, String owner, String comment, String songCount, String created, String pub) {
this.id = id;
this.name = name;
this.owner = (owner == null) ? "" : owner;
this.comment = (comment == null) ? "" : comment;
this.songCount = (songCount == null) ? "" : songCount;
this.created = (created == null) ? "" : created;
+ this.pub = (pub == null) ? null : (pub.equals("true"));
}
public String getId() {
@@ -92,6 +94,13 @@ public class Playlist implements Serializable {
public void setCreated(String created) {
this.created = created;
}
+
+ public Boolean getPublic() {
+ return this.pub;
+ }
+ public void setPublic(Boolean pub) {
+ this.pub = pub;
+ }
@Override
public String toString() {
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java
index 4028b029..fe9b6b45 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/CachedMusicService.java
@@ -166,8 +166,8 @@ public class CachedMusicService implements MusicService {
}
@Override
- public void updatePlaylist(String id, String name, String comment, Context context, ProgressListener progressListener) throws Exception {
- musicService.updatePlaylist(id, name, comment, context, progressListener);
+ public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception {
+ musicService.updatePlaylist(id, name, comment, pub, context, progressListener);
}
@Override
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java
index 702b4aa7..15075d02 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/MusicService.java
@@ -67,7 +67,7 @@ public interface MusicService {
void removeFromPlaylist(String id, List<Integer> toRemove, Context context, ProgressListener progressListener) throws Exception;
- void updatePlaylist(String id, String name, String comment, Context context, ProgressListener progressListener) throws Exception;
+ void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception;
Lyrics getLyrics(String artist, String title, Context context, ProgressListener progressListener) throws Exception;
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 753f6016..5f643ccb 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -317,7 +317,7 @@ public class OfflineMusicService extends RESTMusicService {
}
@Override
- public void updatePlaylist(String id, String name, String comment, Context context, ProgressListener progressListener) throws Exception {
+ public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception {
throw new OfflineException("Updating playlist not available in offline mode");
}
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java
index 627ad915..c7413b54 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java
@@ -439,9 +439,9 @@ public class RESTMusicService implements MusicService {
}
@Override
- public void updatePlaylist(String id, String name, String comment, Context context, ProgressListener progressListener) throws Exception {
+ public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception {
checkServerVersion(context, "1.8", "Updating playlists is not supported.");
- Reader reader = getReader(context, progressListener, "updatePlaylist", null, Arrays.asList("playlistId", "name", "comment"), Arrays.<Object>asList(id, name, comment));
+ Reader reader = getReader(context, progressListener, "updatePlaylist", null, Arrays.asList("playlistId", "name", "comment", "public"), Arrays.<Object>asList(id, name, comment, pub));
try {
new ErrorParser(context).parse(reader);
} finally {
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistsParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistsParser.java
index 7d6a587f..a5bf2497 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistsParser.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/PlaylistsParser.java
@@ -56,7 +56,8 @@ public class PlaylistsParser extends AbstractParser {
String comment = get("comment");
String songCount = get("songCount");
String created = get("created");
- result.add(new Playlist(id, name, owner, comment, songCount, created));
+ String pub = get("public");
+ result.add(new Playlist(id, name, owner, comment, songCount, created, pub));
} else if ("error".equals(tag)) {
handleError();
}