improve preview cards (#4782)
- new design thats more Material3-ish - support for the Mastodon 4.3 fediverse:creator feature and other new card attributes closes #4732 closes https://github.com/tuskyapp/Tusky/issues/3340 before: <img src="https://github.com/user-attachments/assets/6cd9ccfc-7f7d-459b-90d9-547cdca0d8c4" width="280"/> <img src="https://github.com/user-attachments/assets/286b5b19-49a3-4b2f-97a9-185fc1f31a8e" width="280"/> after: <img src="https://github.com/user-attachments/assets/b57acf74-e7d3-411e-9186-763de87fa9ca" width="280"/> <img src="https://github.com/user-attachments/assets/50684c30-b4bf-4f05-8b8e-e5fd2bf3d7b6" width="280"/>
This commit is contained in:
parent
d6b276d8df
commit
510e093456
16 changed files with 225 additions and 225 deletions
|
|
@ -17,13 +17,17 @@ package com.keylesspalace.tusky.entity
|
|||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import java.util.Date
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Card(
|
||||
data class PreviewCard(
|
||||
val url: String,
|
||||
val title: String,
|
||||
val description: String = "",
|
||||
@Json(name = "author_name") val authorName: String = "",
|
||||
val authors: List<PreviewCardAuthor> = emptyList(),
|
||||
@Json(name = "author_name") val authorName: String? = null,
|
||||
@Json(name = "provider_name") val providerName: String? = null,
|
||||
@Json(name = "published_at") val publishedAt: Date?,
|
||||
val image: String? = null,
|
||||
val type: String,
|
||||
val width: Int = 0,
|
||||
|
|
@ -35,7 +39,7 @@ data class Card(
|
|||
override fun hashCode() = url.hashCode()
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is Card) {
|
||||
if (other !is PreviewCard) {
|
||||
return false
|
||||
}
|
||||
return other.url == this.url
|
||||
|
|
@ -45,3 +49,10 @@ data class Card(
|
|||
const val TYPE_PHOTO = "photo"
|
||||
}
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class PreviewCardAuthor(
|
||||
val name: String,
|
||||
val url: String,
|
||||
val account: TimelineAccount?
|
||||
)
|
||||
|
|
@ -53,7 +53,7 @@ data class Status(
|
|||
val muted: Boolean = false,
|
||||
val poll: Poll? = null,
|
||||
/** Preview card for links included within status content. */
|
||||
val card: Card? = null,
|
||||
val card: PreviewCard? = null,
|
||||
/** ISO 639 language code for this status. */
|
||||
val language: String? = null,
|
||||
/** If the current token has an authorized user: The filter and keywords that matched this status.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue