feat:调整特权卡-视频选择限制提醒方式

This commit is contained in:
Max
2023-11-07 20:03:49 +08:00
parent 3defba88a5
commit cf2490b9e2

View File

@@ -205,8 +205,8 @@ class CreatePrivilegeCardDialog : BaseDialog<DialogCreatePrivilegeCardBinding>()
this, this,
canChooseGif = true, canChooseGif = true,
resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER,
maxFileSize = 1024 * 1024 * 20, // maxFileSize = 1024 * 1024 * 20,
videoMaxSecond = 15, // videoMaxSecond = 15,
showVideoType = "mp4" showVideoType = "mp4"
) )
} }
@@ -484,6 +484,14 @@ class CreatePrivilegeCardDialog : BaseDialog<DialogCreatePrivilegeCardBinding>()
val path = photo.path val path = photo.path
Log.d(TAG, "onPhotoResult path:$path") Log.d(TAG, "onPhotoResult path:$path")
if (path.endsWith("mp4") || photo.type.endsWith(Type.VIDEO)) { if (path.endsWith("mp4") || photo.type.endsWith(Type.VIDEO)) {
if (photo.duration > 15 * 1000) {
SingleToastUtil.showToast("视频时长不能超过15秒")
return
}
if (photo.size > (1024 * 1024 * 20)) {
SingleToastUtil.showToast("上传文件最大不能超过20M")
return
}
uploadVideo(photo) uploadVideo(photo)
} else if (photo.path.endsWith(Type.GIF) || photo.type.endsWith(Type.GIF)) { } else if (photo.path.endsWith(Type.GIF) || photo.type.endsWith(Type.GIF)) {
uploadGif(path) uploadGif(path)