forked from melod1n/fast-messenger
reworked chat materials screen and some fixes
This commit is contained in:
@@ -1,75 +1,78 @@
|
||||
package dev.meloda.fast.model.api.data
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
import dev.meloda.fast.model.api.domain.VkVideoDomain
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class VkVideoData(
|
||||
val id: Int,
|
||||
val title: String,
|
||||
val width: Int?,
|
||||
val height: Int?,
|
||||
val duration: Int,
|
||||
val date: Int,
|
||||
val comments: Int?,
|
||||
val description: String?,
|
||||
val player: String?,
|
||||
val added: Int?,
|
||||
val type: String,
|
||||
val views: Int,
|
||||
val access_key: String?,
|
||||
val owner_id: Int,
|
||||
val is_favorite: Boolean?,
|
||||
val image: List<Image>?,
|
||||
val first_frame: List<FirstFrame>?,
|
||||
val files: File?
|
||||
@Json(name = "id") val id: Int,
|
||||
@Json(name = "title") val title: String,
|
||||
@Json(name = "width") val width: Int?,
|
||||
@Json(name = "height") val height: Int?,
|
||||
@Json(name = "duration") val duration: Int,
|
||||
@Json(name = "date") val date: Int,
|
||||
@Json(name = "comments") val comments: Int?,
|
||||
@Json(name = "description") val description: String?,
|
||||
@Json(name = "player") val player: String?,
|
||||
@Json(name = "added") val added: Int?,
|
||||
@Json(name = "type") val type: String,
|
||||
@Json(name = "views") val views: Int,
|
||||
@Json(name = "access_key") val accessKey: String?,
|
||||
@Json(name = "owner_id") val ownerId: Int,
|
||||
@Json(name = "is_favorite") val isFavorite: Boolean?,
|
||||
@Json(name = "image") val image: List<Image>?,
|
||||
@Json(name = "first_frame") val firstFrame: List<FirstFrame>?,
|
||||
@Json(name = "files") val files: File?
|
||||
) : VkAttachmentData {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Image(
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
val url: String,
|
||||
val with_padding: Int?
|
||||
@Json(name = "width") val width: Int,
|
||||
@Json(name = "height") val height: Int,
|
||||
@Json(name = "url") val url: String,
|
||||
@Json(name = "with_padding") val withPadding: Int?
|
||||
) {
|
||||
|
||||
fun asVideoImage() = VkVideoDomain.VideoImage(
|
||||
width = width,
|
||||
height = height,
|
||||
url = url,
|
||||
withPadding = with_padding == 1
|
||||
withPadding = withPadding == 1
|
||||
)
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class FirstFrame(
|
||||
val height: Int,
|
||||
val width: Int,
|
||||
val url: String
|
||||
@Json(name = "height") val height: Int,
|
||||
@Json(name = "width") val width: Int,
|
||||
@Json(name = "url") val url: String
|
||||
)
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class File(
|
||||
val mp4_240: String?,
|
||||
val mp4_360: String?,
|
||||
val mp4_480: String?,
|
||||
val mp4_720: String?,
|
||||
val mp4_1080: String?,
|
||||
val mp4_1440: String?,
|
||||
val hls: String?,
|
||||
val dash_uni: String?,
|
||||
val dash_sep: String?,
|
||||
val hls_ondemand: String?,
|
||||
val dash_ondemand: String?,
|
||||
val failover_host: String?
|
||||
@Json(name = "mp4_240") val mp4240: String?,
|
||||
@Json(name = "mp4_360") val mp4360: String?,
|
||||
@Json(name = "mp4_480") val mp4480: String?,
|
||||
@Json(name = "mp4_720") val mp4720: String?,
|
||||
@Json(name = "mp4_1080") val mp41080: String?,
|
||||
@Json(name = "mp4_1440") val mp41440: String?,
|
||||
@Json(name = "hls") val hls: String?,
|
||||
@Json(name = "dash_uni") val dashUni: String?,
|
||||
@Json(name = "dash_sep") val dashSep: String?,
|
||||
@Json(name = "hls_ondemand") val hlsOnDemand: String?,
|
||||
@Json(name = "dash_ondemand") val dashOnDemand: String?,
|
||||
@Json(name = "failover_host") val failOverHost: String?
|
||||
)
|
||||
|
||||
fun toDomain() = VkVideoDomain(
|
||||
id = id,
|
||||
ownerId = owner_id,
|
||||
ownerId = ownerId,
|
||||
images = image.orEmpty().map { it.asVideoImage() },
|
||||
firstFrames = first_frame,
|
||||
accessKey = access_key,
|
||||
title = title
|
||||
firstFrames = firstFrame,
|
||||
accessKey = accessKey,
|
||||
title = title,
|
||||
views = views,
|
||||
duration = duration
|
||||
)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ data class VkVideoDomain(
|
||||
val firstFrames: List<VkVideoData.FirstFrame>?,
|
||||
val accessKey: String?,
|
||||
val title: String,
|
||||
val views: Int,
|
||||
val duration: Int
|
||||
) : VkAttachment {
|
||||
|
||||
override val type: AttachmentType = AttachmentType.VIDEO
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M9 13V5C9 3.9 9.9 3 11 3H20C21.1 3 22 3.9 22 5V11H18.57L17.29 9.26C17.23 9.17 17.11 9.17 17.05 9.26L15.06 12C15 12.06 14.88 12.07 14.82 12L13.39 10.25C13.33 10.18 13.22 10.18 13.16 10.25L11.05 12.91C10.97 13 11.04 13.15 11.16 13.15H17.5V15H11C9.89 15 9 14.11 9 13M6 22V21H4V22H2V2H4V3H6V2H8.39C7.54 2.74 7 3.8 7 5V13C7 15.21 8.79 17 11 17H15.7C14.67 17.83 14 19.08 14 20.5C14 21.03 14.11 21.53 14.28 22H6M4 7H6V5H4V7M4 11H6V9H4V11M4 15H6V13H4V15M6 19V17H4V19H6M23 13V15H21V20.5C21 21.88 19.88 23 18.5 23S16 21.88 16 20.5 17.12 18 18.5 18C18.86 18 19.19 18.07 19.5 18.21V13H23Z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M8,6.82v10.36c0,0.79 0.87,1.27 1.54,0.84l8.14,-5.18c0.62,-0.39 0.62,-1.29 0,-1.69L9.54,5.98C8.87,5.55 8,6.03 8,6.82z" />
|
||||
|
||||
</vector>
|
||||
@@ -218,4 +218,15 @@
|
||||
<string name="title_create_chat">Создать чат</string>
|
||||
<string name="action_create">Создать</string>
|
||||
<string name="create_chat_title">Название</string>
|
||||
<string name="chat_materials_title">Вложения чата</string>
|
||||
<string name="chat_materials_action_title">Вложения</string>
|
||||
<string name="friends_order_priority">Приоритет</string>
|
||||
<string name="friends_order_name">Имя</string>
|
||||
<string name="friends_order_random">Случайно</string>
|
||||
<string name="friends_order_by_title">Упорядочить по</string>
|
||||
<string name="chat_attachment_photos">Фото</string>
|
||||
<string name="chat_attachment_videos">Видео</string>
|
||||
<string name="chat_attachment_music">Музыка</string>
|
||||
<string name="chat_attachment_files">Файлы</string>
|
||||
<string name="chat_attachment_links">Ссылки</string>
|
||||
</resources>
|
||||
|
||||
@@ -283,4 +283,17 @@
|
||||
<string name="title_create_chat">Create chat</string>
|
||||
<string name="action_create">Create</string>
|
||||
<string name="create_chat_title">Title</string>
|
||||
<string name="chat_materials_title">Chat materials</string>
|
||||
<string name="chat_materials_action_title">Materials</string>
|
||||
<string name="friends_order_priority">Priority</string>
|
||||
<string name="friends_order_name">Name</string>
|
||||
<string name="friends_order_random">Random</string>
|
||||
<string name="friends_order_mobile" translatable="false">Mobile</string>
|
||||
<string name="friends_order_smart" translatable="false">Smart</string>
|
||||
<string name="friends_order_by_title">Order by</string>
|
||||
<string name="chat_attachment_photos">Photos</string>
|
||||
<string name="chat_attachment_videos">Videos</string>
|
||||
<string name="chat_attachment_music">Music</string>
|
||||
<string name="chat_attachment_files">Files</string>
|
||||
<string name="chat_attachment_links">Links</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user