pull/35/head^2
kunfei 5 years ago
parent 9dffaf39b4
commit 18e6d179a7
  1. 12
      app/src/main/java/io/legado/app/data/entities/RssArticle.kt
  2. 3
      app/src/main/java/io/legado/app/model/rss/RssParser.kt

@ -1,6 +1,7 @@
package io.legado.app.data.entities
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
@ -9,7 +10,7 @@ data class RssArticle(
var origin: String = "",
var time: Long = System.currentTimeMillis(),
@PrimaryKey
var guid: String? = null,
var guid: String = "",
var title: String? = null,
var author: String? = null,
var link: String? = null,
@ -17,5 +18,10 @@ data class RssArticle(
var description: String? = null,
var content: String? = null,
var image: String? = null,
var categories: MutableList<String> = mutableListOf()
)
var categories: String? = null
) {
@Ignore
var categoryList: MutableList<String> = mutableListOf()
}

@ -42,7 +42,7 @@ object RssParser {
xmlPullParser.name.equals(RSSKeywords.RSS_ITEM_AUTHOR, true) ->
if (insideItem) currentArticle.author = xmlPullParser.nextText().trim()
xmlPullParser.name.equals(RSSKeywords.RSS_ITEM_CATEGORY, true) ->
if (insideItem) currentArticle.categories.add(xmlPullParser.nextText().trim())
if (insideItem) currentArticle.categoryList.add(xmlPullParser.nextText().trim())
xmlPullParser.name.equals(RSSKeywords.RSS_ITEM_THUMBNAIL, true) ->
if (insideItem) currentArticle.image =
xmlPullParser.getAttributeValue(null, RSSKeywords.RSS_ITEM_URL)
@ -92,6 +92,7 @@ object RssParser {
) {
// The item is correctly parsed
insideItem = false
currentArticle.categories = currentArticle.categoryList.joinToString(",")
articleList.add(currentArticle)
currentArticle = RssArticle()
}

Loading…
Cancel
Save