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 image: String? = null,
var read: Boolean = false var read: Boolean = false
) { ) {
override fun hashCode(): Int { override fun hashCode() = link.hashCode()
return link.hashCode()
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other == null) { other ?: return false
return false return if (other is RssArticle) origin == other.origin && link == other.link else 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
)
} }
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