RssArticle.kt: Modify functions into assigning style

Signed-off-by: 1552980358 <1552980358@qq.com>
pull/369/head
1552980358 4 years ago
parent 66e24bc1c4
commit 011b7c8255
  1. 43
      app/src/main/java/io/legado/app/data/entities/RssArticle.kt

@ -19,32 +19,23 @@ data class RssArticle(
var image: String? = null,
var read: Boolean = false
) {
override fun hashCode(): Int {
return link.hashCode()
}
override fun hashCode() = link.hashCode()
override fun equals(other: Any?): Boolean {
if (other == null) {
return false
}
if (other is RssArticle) {
return origin == other.origin && link == other.link
}
return false
}
fun toStar(): RssStar {
return RssStar(
origin = origin,
sort = sort,
title = title,
starTime = System.currentTimeMillis(),
link = link,
pubDate = pubDate,
description = description,
content = content,
image = image
)
other ?: return false
return if (other is RssArticle) origin == other.origin && link == other.link else false
}
fun toStar() = RssStar(
origin = origin,
sort = sort,
title = title,
starTime = System.currentTimeMillis(),
link = link,
pubDate = pubDate,
description = description,
content = content,
image = image
)
}
Loading…
Cancel
Save