- Add FeedItem, Feed, FeedSubscription models with Moshi JSON support - Add SearchResult, SearchFilters models with sealed classes for enums - Add NotificationPreferences, ReadingPreferences models - Add Room Entity annotations for database readiness - Add TypeConverters for Date and List<String> serialization - Add Parcelize for passing models between Activities/Fragments - Write comprehensive unit tests for serialization/deserialization - Write tests for copy(), equals/hashCode, and toString functionality
68 lines
1.5 KiB
Kotlin
68 lines
1.5 KiB
Kotlin
package com.rssuper.models
|
|
|
|
import android.os.Parcelable
|
|
import androidx.room.Entity
|
|
import androidx.room.PrimaryKey
|
|
import androidx.room.TypeConverters
|
|
import com.rssuper.converters.DateConverter
|
|
import com.rssuper.converters.StringListConverter
|
|
import kotlinx.parcelize.Parcelize
|
|
import com.squareup.moshi.Json
|
|
import com.squareup.moshi.JsonClass
|
|
import java.util.Date
|
|
|
|
@JsonClass(generateAdapter = true)
|
|
@Parcelize
|
|
@TypeConverters(DateConverter::class, StringListConverter::class)
|
|
@Entity(tableName = "feed_items")
|
|
data class FeedItem(
|
|
@PrimaryKey
|
|
val id: String,
|
|
|
|
@Json(name = "title")
|
|
val title: String,
|
|
|
|
@Json(name = "link")
|
|
val link: String? = null,
|
|
|
|
@Json(name = "description")
|
|
val description: String? = null,
|
|
|
|
@Json(name = "content")
|
|
val content: String? = null,
|
|
|
|
@Json(name = "author")
|
|
val author: String? = null,
|
|
|
|
@Json(name = "published")
|
|
val published: Date? = null,
|
|
|
|
@Json(name = "updated")
|
|
val updated: Date? = null,
|
|
|
|
@Json(name = "categories")
|
|
val categories: List<String>? = null,
|
|
|
|
@Json(name = "enclosure")
|
|
val enclosure: Enclosure? = null,
|
|
|
|
@Json(name = "guid")
|
|
val guid: String? = null,
|
|
|
|
@Json(name = "subscriptionTitle")
|
|
val subscriptionTitle: String? = null
|
|
) : Parcelable
|
|
|
|
@JsonClass(generateAdapter = true)
|
|
@Parcelize
|
|
data class Enclosure(
|
|
@Json(name = "url")
|
|
val url: String,
|
|
|
|
@Json(name = "type")
|
|
val type: String,
|
|
|
|
@Json(name = "length")
|
|
val length: Long? = null
|
|
) : Parcelable
|