Пример #1
0
 private Cursor getCursor() {
   if (mFeedIds != null) {
     return PodItemEntry.getEntrysForFeeds(mFeedIds);
   } else {
     return PodItemEntry.getAllEntrys();
   }
 }
Пример #2
0
  private static void readEntry(Feed feed, XmlPullParser parser)
      throws XmlPullParserException, IOException {
    parser.require(XmlPullParser.START_TAG, ns, "item");
    String title = null;
    String linkA = null;
    String linkB = null;
    String pubDate = null;
    String description = null;
    Date d = null;

    while (parser.next() != XmlPullParser.END_TAG) {
      if (parser.getEventType() != XmlPullParser.START_TAG) {
        continue;
      }
      String name = parser.getName();
      if (name.equals("title")) {
        title = readTitle(parser);
      } else if (name.equals("link")) {
        linkA = readLink(parser);
      } else if (name.equals("pubDate")) {
        pubDate = readTag(parser, "pubDate");
      } else if (name.equals("description")) {
        description = readTag(parser, "description");
      } else if (name.equals("enclosure")) {
        linkB = readEnclosureURL(parser);
      } else {
        skip(parser);
      }
    }

    if (pubDate != null) {
      try {
        d = rssDateBla.parse(pubDate);
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }

    try {
      if (linkA != null && linkA.endsWith("mp3"))
        PodItemEntry.createNewEntry(feed, title, linkA, d, description);
      else if (linkB != null && linkB.endsWith("mp3"))
        PodItemEntry.createNewEntry(feed, title, linkB, d, description);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }