diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/camilstaps/taize/Podcast.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/app/src/main/java/com/camilstaps/taize/Podcast.java b/app/src/main/java/com/camilstaps/taize/Podcast.java index ef55cdf..d6fd6cd 100644 --- a/app/src/main/java/com/camilstaps/taize/Podcast.java +++ b/app/src/main/java/com/camilstaps/taize/Podcast.java @@ -7,7 +7,9 @@ import org.json.JSONException; import org.json.JSONObject; /** - * Created by camilstaps on 15-4-15. + * A Podcast is linked to a Date and has a title and a URL + * The title and the URL are held together in a JSON-encoded string, so that this class can extend DatedString + * @author Camil Staps */ public class Podcast extends DatedString implements Comparable<Podcast> { @@ -15,6 +17,10 @@ public class Podcast extends DatedString implements Comparable<Podcast> { super(date, (new JSONObject()).put("title", title).put("url", url).toString()); } + /** + * Get the JSON object from the string + * @return + */ private JSONObject getJSONObject() { try { return new JSONObject(getString()); @@ -23,6 +29,10 @@ public class Podcast extends DatedString implements Comparable<Podcast> { } } + /** + * Get the title of the podcast + * @return + */ public String getTitle() { try { return getJSONObject().getString("title"); @@ -31,6 +41,10 @@ public class Podcast extends DatedString implements Comparable<Podcast> { } } + /** + * Get the URL of the podcast + * @return + */ public String getUrl() { try { return getJSONObject().getString("url"); @@ -39,6 +53,11 @@ public class Podcast extends DatedString implements Comparable<Podcast> { } } + /** + * Compare with another podcast by date + * @param another + * @return + */ @Override public int compareTo(Podcast another) { return getDate().compareTo(another.getDate()); |