cleanup entity classes and ViewThreadFragment (#1302)

* cleanup entity classes and ViewThreadFragment

* fix tests
This commit is contained in:
Konrad Pozniak 2019-06-02 21:23:18 +02:00 committed by GitHub
commit 2b2212e951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 52 additions and 132 deletions

View file

@ -26,13 +26,12 @@ import kotlinx.android.parcel.Parcelize
@Parcelize
data class Attachment(
var id: String,
var url: String,
val id: String,
val url: String,
@SerializedName("preview_url") val previewUrl: String,
@SerializedName("text_url") val textUrl: String?,
val meta: MetaData?,
var type: Type,
var description: String?
val type: Type,
val description: String?
) : Parcelable {
@JsonAdapter(MediaTypeDeserializer::class)

View file

@ -20,4 +20,7 @@ package com.keylesspalace.tusky.entity
* Created by charlag on 1/4/18.
*/
data class MastoList(val id: String, val title: String)
data class MastoList(
val id: String,
val title: String
)

View file

@ -31,8 +31,8 @@ data class Status(
val emojis: List<Emoji>,
@SerializedName("reblogs_count") val reblogsCount: Int,
@SerializedName("favourites_count") val favouritesCount: Int,
var reblogged: Boolean = false,
var favourited: Boolean = false,
var reblogged: Boolean,
var favourited: Boolean,
var sensitive: Boolean,
@SerializedName("spoiler_text") val spoilerText: String,
val visibility: Visibility,
@ -40,7 +40,8 @@ data class Status(
val mentions: Array<Mention>,
val application: Application?,
var pinned: Boolean?,
val poll: Poll?
val poll: Poll?,
val card: Card?
) {
val actionableId: String
@ -120,45 +121,17 @@ data class Status(
}
class Mention {
var id: String? = null
data class Mention (
val id: String,
val url: String,
@SerializedName("acct") val username: String,
@SerializedName("username") val localUsername: String
)
var url: String? = null
@SerializedName("acct")
var username: String? = null
@SerializedName("username")
var localUsername: String? = null
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Mention
if (id != other.id) return false
if (url != other.url) return false
if (username != other.username) return false
if (localUsername != other.localUsername) return false
return true
}
override fun hashCode(): Int {
var result = id?.hashCode() ?: 0
result = 31 * result + (url?.hashCode() ?: 0)
result = 31 * result + (username?.hashCode() ?: 0)
result = 31 * result + (localUsername?.hashCode() ?: 0)
return result
}
}
class Application {
var name: String? = null
var website: String? = null
}
data class Application (
val name: String,
val website: String
)
companion object {
const val MAX_MEDIA_ATTACHMENTS = 4