mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 11:51:10 +01:00
Remove old MediaPreviewActivity.
This commit is contained in:
@@ -6,6 +6,9 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment
|
||||
import org.thoughtcrime.securesms.database.MediaDatabase
|
||||
import org.thoughtcrime.securesms.database.MediaDatabase.MediaRecord
|
||||
|
||||
object MediaIntentFactory {
|
||||
private const val ARGS_KEY = "args"
|
||||
@@ -34,7 +37,7 @@ object MediaIntentFactory {
|
||||
val hideAllMedia: Boolean = false,
|
||||
val showThread: Boolean = false,
|
||||
val allMediaInRail: Boolean = false,
|
||||
val sorting: Int,
|
||||
val sorting: MediaDatabase.Sorting,
|
||||
val isVideoGif: Boolean
|
||||
) : Parcelable
|
||||
|
||||
@@ -45,4 +48,26 @@ object MediaIntentFactory {
|
||||
fun create(context: Context, args: MediaPreviewArgs): Intent {
|
||||
return Intent(context, MediaPreviewV2Activity::class.java).putExtra(ARGS_KEY, args)
|
||||
}
|
||||
|
||||
fun intentFromMediaRecord(
|
||||
context: Context,
|
||||
mediaRecord: MediaRecord,
|
||||
leftIsRecent: Boolean
|
||||
): Intent {
|
||||
val attachment: DatabaseAttachment = mediaRecord.attachment!!
|
||||
return create(
|
||||
context,
|
||||
MediaPreviewArgs(
|
||||
mediaRecord.threadId,
|
||||
mediaRecord.date,
|
||||
attachment.uri!!,
|
||||
attachment.contentType,
|
||||
attachment.size,
|
||||
attachment.caption,
|
||||
leftIsRecent,
|
||||
sorting = MediaDatabase.Sorting.Newest,
|
||||
isVideoGif = attachment.isVideoGif
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
||||
}.show()
|
||||
}
|
||||
viewModel.initialize(args.showThread, args.allMediaInRail, args.leftIsRecent)
|
||||
val sorting = MediaDatabase.Sorting.deserialize(args.sorting)
|
||||
val sorting = MediaDatabase.Sorting.deserialize(args.sorting.ordinal)
|
||||
viewModel.fetchAttachments(PartAuthority.requireAttachmentId(args.initialMediaUri), args.threadId, sorting)
|
||||
}
|
||||
|
||||
@@ -442,5 +442,10 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
||||
|
||||
companion object {
|
||||
const val ARGS_KEY: String = "args"
|
||||
|
||||
@JvmStatic
|
||||
fun isContentTypeSupported(contentType: String?): Boolean {
|
||||
return MediaUtil.isImageType(contentType) || MediaUtil.isVideoType(contentType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user