diff options
author | Halzyn | 2015-05-20 12:14:19 +0200 |
---|---|---|
committer | Halzyn | 2015-05-20 12:14:32 +0200 |
commit | ae0b2655a7cd7acb55c304459cdc690ede844e76 (patch) | |
tree | f6e1bd6e28d0f9cb725ea8eee5eb673dc84aafb5 /app/src/main/java/org | |
parent | FeedLoaderAndSorter added (diff) |
JavaDoc
Speciaal voor de haters
Diffstat (limited to 'app/src/main/java/org')
-rw-r--r-- | app/src/main/java/org/rssin/rss/FeedLoader.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/src/main/java/org/rssin/rss/FeedLoader.java b/app/src/main/java/org/rssin/rss/FeedLoader.java index bf24c0b..726cbac 100644 --- a/app/src/main/java/org/rssin/rss/FeedLoader.java +++ b/app/src/main/java/org/rssin/rss/FeedLoader.java @@ -28,10 +28,16 @@ public class FeedLoader { this.urlString = url; } + /** + * parses an XML file and saves all information in the feed. + * @param myParser the parser in question. + */ public void parseXMLAndStoreIt(XmlPullParser myParser) { int event; FeedItem post = null; - boolean chan = true; + boolean chan = true; //as long as the first item hasn't been reached, all + //information is saved in the feed itself, rather than + //in separate items. try { event = myParser.getEventType(); while (event != XmlPullParser.END_DOCUMENT) { @@ -42,7 +48,8 @@ public class FeedLoader { case "item": post = new FeedItem(null, null, null, null, null, null, new LinkedList<String>(), null, null, null); - chan = false; + chan = false; //this starts collection information for the + //separate items. break; case "image": imageTagParse(myParser); @@ -59,7 +66,7 @@ public class FeedLoader { break; case XmlPullParser.END_TAG: assert post != null; - if (!chan) { + if (!chan) { //this saves all the item-related information. switch (name) { case "guid": post.setGuid(text); @@ -95,7 +102,7 @@ public class FeedLoader { getFeed().addPost(post); break; } - } else { + } else { //this saves all the feed-related information. switch (name) { case "category": getFeed().setCategory(text); @@ -168,6 +175,11 @@ public class FeedLoader { } } + /** + * This function parses the child elements of the <image>tag. + * @param myParser XML parser. + * @throws XmlPullParserException + */ public void imageTagParse(XmlPullParser myParser) throws XmlPullParserException { int event; boolean imageloop = true; @@ -199,6 +211,9 @@ public class FeedLoader { } } + /** + * Retrieves the XML and parses it. + */ public void fetchXML(){ Thread thread = new Thread(new Runnable(){ @Override |