From 18e6d179a7f6173ad10ffcc99f8771159a60b8b8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 2 Oct 2019 17:14:40 +0800 Subject: [PATCH] up --- .../java/io/legado/app/data/entities/RssArticle.kt | 12 +++++++++--- .../main/java/io/legado/app/model/rss/RssParser.kt | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt index 4f24761e3..1c89ff8ca 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssArticle.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 = mutableListOf() -) \ No newline at end of file + var categories: String? = null +) { + + @Ignore + var categoryList: MutableList = mutableListOf() + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/rss/RssParser.kt b/app/src/main/java/io/legado/app/model/rss/RssParser.kt index 2696fb26a..accd22de0 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParser.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParser.kt @@ -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() }