Skip to content

Instantly share code, notes, and snippets.

@enginebai
Created April 21, 2019 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enginebai/0c3a1627b82218b7db6cfeff57655cf1 to your computer and use it in GitHub Desktop.
Save enginebai/0c3a1627b82218b7db6cfeff57655cf1 to your computer and use it in GitHub Desktop.
data class Post(
@SerializedName("id")
val id: String,
@SerializedName("sender")
val sender: String?,
@SerializedName("caption")
val caption: String?,
@SerializedName("media")
val media: String?,
@SerializedName("timestamp")
val timestamp: Long?
)
object PostDiffUtils : DiffUtil.ItemCallback<Post>() {
override fun areItemsTheSame(oldItem: Post, newItem: Post): Boolean {
return oldItem.id == oldItem.id
}
override fun areContentsTheSame(oldItem: Post, newItem: Post): Boolean {
return oldItem == newItem
}
}
interface PostApiService {
@GET("/feed")
fun getFeed(): Call<Response<List<Post>>>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment