TypeGetter is now setting type attribute of feed

This commit is contained in:
daniel oeh 2012-07-26 18:05:50 +02:00
parent 02b2ec56c8
commit 9da07b8e72
3 changed files with 6 additions and 2 deletions

View File

@ -10,8 +10,8 @@ import java.util.Date;
* *
*/ */
public class Feed extends FeedFile { public class Feed extends FeedFile {
private static final String TYPE_RSS2 = "rss"; public static final String TYPE_RSS2 = "rss";
private static final String TYPE_ATOM1 = "atom"; public static final String TYPE_ATOM1 = "atom";
private String title; private String title;
/** Link to the website. */ /** Link to the website. */

View File

@ -361,7 +361,9 @@ public class FeedManager {
markItemRead(context, item, false); markItemRead(context, item, false);
} }
} }
// update attributes
savedFeed.setLastUpdate(newFeed.getLastUpdate()); savedFeed.setLastUpdate(newFeed.getLastUpdate());
savedFeed.setType(newFeed.getType());
setFeed(context, savedFeed); setFeed(context, savedFeed);
return savedFeed; return savedFeed;
} }

View File

@ -40,12 +40,14 @@ public class TypeGetter {
if (eventType == XmlPullParser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
String tag = xpp.getName(); String tag = xpp.getName();
if (tag.equals(ATOM_ROOT)) { if (tag.equals(ATOM_ROOT)) {
feed.setType(Feed.TYPE_ATOM1);
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Recognized type Atom"); Log.d(TAG, "Recognized type Atom");
return Type.ATOM; return Type.ATOM;
} else if (tag.equals(RSS_ROOT) } else if (tag.equals(RSS_ROOT)
&& (xpp.getAttributeValue(null, "version") && (xpp.getAttributeValue(null, "version")
.equals("2.0"))) { .equals("2.0"))) {
feed.setType(Feed.TYPE_RSS2);
if (AppConfig.DEBUG) if (AppConfig.DEBUG)
Log.d(TAG, "Recognized type RSS 2.0"); Log.d(TAG, "Recognized type RSS 2.0");
return Type.RSS20; return Type.RSS20;