From 1563ab4ff8237dde23b97db39132306d248072da Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Wed, 21 Aug 2013 17:39:01 +0200 Subject: Added classes for accessing gpodder.net service Directory + Subscription upload/download --- .../antennapod/gpoddernet/model/GpodnetDevice.java | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java (limited to 'src/de/danoeh/antennapod/gpoddernet/model/GpodnetDevice.java') 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; + } + +} -- cgit v1.2.3