summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java
diff options
context:
space:
mode:
authorTom Hennen <tom.hennen@gmail.com>2013-09-09 18:20:15 -0400
committerTom Hennen <tom.hennen@gmail.com>2013-09-09 18:20:15 -0400
commitc960a65189014fddbf7336c028385b350fdca504 (patch)
tree482ce1490a92d738b16aff8c9bec5ba189872a68 /src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java
parentd538e3899c65992870e1866b1d27fc7cd5385ce7 (diff)
parent02926a6e5ffa968d08efeae5012a0ecf41a6f33a (diff)
downloadAntennaPod-c960a65189014fddbf7336c028385b350fdca504.zip
Merge branch 'develop' of https://github.com/danieloeh/AntennaPod into pause-on-interrupt
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;
+ }
+
+}