summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2013-08-21 17:39:01 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2013-08-21 17:39:01 +0200
commit1563ab4ff8237dde23b97db39132306d248072da (patch)
tree6fffdc31074ac961f67f765fb42861975ccaf7bc /src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java
parent1e35a88194b295e5feae02331dc9e34f7947e114 (diff)
downloadAntennaPod-1563ab4ff8237dde23b97db39132306d248072da.zip
Added classes for accessing gpodder.net service
Directory + Subscription upload/download
Diffstat (limited to 'src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java')
-rw-r--r--src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java b/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java
new file mode 100644
index 000000000..ae7199fcc
--- /dev/null
+++ b/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java
@@ -0,0 +1,72 @@
+package de.danoeh.antennapod.gpoddernet.model;
+
+public class GpodnetDevice {
+
+ private String id;
+ private String caption;
+ private DeviceType type;
+ private int subscriptions;
+
+ public GpodnetDevice(String id, String caption, String type,
+ int subscriptions) {
+ if (id == null) {
+ throw new IllegalArgumentException("ID must not be null");
+ }
+
+ this.id = id;
+ this.caption = caption;
+ this.type = DeviceType.fromString(type);
+ this.subscriptions = subscriptions;
+ }
+
+ @Override
+ public String toString() {
+ return "GpodnetDevice [id=" + id + ", caption=" + caption + ", type="
+ + type + ", subscriptions=" + subscriptions + "]";
+ }
+
+ public static enum DeviceType {
+ DESKTOP, LAPTOP, MOBILE, SERVER, OTHER;
+
+ static DeviceType fromString(String s) {
+ if (s == null) {
+ return OTHER;
+ }
+
+ if (s.equals("desktop")) {
+ return DESKTOP;
+ } else if (s.equals("laptop")) {
+ return LAPTOP;
+ } else if (s.equals("mobile")) {
+ return MOBILE;
+ } else if (s.equals("server")) {
+ return SERVER;
+ } else {
+ return OTHER;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return super.toString().toLowerCase();
+ }
+
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public DeviceType getType() {
+ return type;
+ }
+
+ public int getSubscriptions() {
+ return subscriptions;
+ }
+
+}