mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Merge branch 'ui' of https://github.com/oxen-io/session-android into ui
This commit is contained in:
commit
3c293f9d2b
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.conversation.v2
|
|||||||
|
|
||||||
import android.animation.FloatEvaluator
|
import android.animation.FloatEvaluator
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
|
import android.content.Intent
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
@ -51,14 +52,17 @@ import org.thoughtcrime.securesms.database.DatabaseFactory
|
|||||||
import org.thoughtcrime.securesms.database.DraftDatabase
|
import org.thoughtcrime.securesms.database.DraftDatabase
|
||||||
import org.thoughtcrime.securesms.database.DraftDatabase.Drafts
|
import org.thoughtcrime.securesms.database.DraftDatabase.Drafts
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||||
|
import org.thoughtcrime.securesms.giph.ui.GiphyActivity
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository
|
import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel
|
import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel.LinkPreviewState
|
import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel.LinkPreviewState
|
||||||
import org.thoughtcrime.securesms.loki.utilities.toPx
|
import org.thoughtcrime.securesms.loki.utilities.toPx
|
||||||
import org.thoughtcrime.securesms.mms.AttachmentManager
|
import org.thoughtcrime.securesms.mediasend.Media
|
||||||
import org.thoughtcrime.securesms.mms.GlideApp
|
import org.thoughtcrime.securesms.mediasend.MediaSendActivity
|
||||||
|
import org.thoughtcrime.securesms.mms.*
|
||||||
import org.thoughtcrime.securesms.notifications.MarkReadReceiver
|
import org.thoughtcrime.securesms.notifications.MarkReadReceiver
|
||||||
import org.thoughtcrime.securesms.util.DateUtils
|
import org.thoughtcrime.securesms.util.DateUtils
|
||||||
|
import org.thoughtcrime.securesms.util.MediaUtil
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
||||||
@ -680,6 +684,46 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
override fun onAttachmentChanged() {
|
override fun onAttachmentChanged() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, intent)
|
||||||
|
intent ?: return
|
||||||
|
when (requestCode) {
|
||||||
|
PICK_DOCUMENT -> {
|
||||||
|
val data = intent.data ?: return
|
||||||
|
}
|
||||||
|
TAKE_PHOTO -> {
|
||||||
|
val uri = attachmentManager.captureUri ?: return
|
||||||
|
}
|
||||||
|
PICK_GIF -> {
|
||||||
|
val data = intent.data ?: return
|
||||||
|
val type = AttachmentManager.MediaType.GIF
|
||||||
|
val width = intent.getIntExtra(GiphyActivity.EXTRA_WIDTH, 0)
|
||||||
|
val height = intent.getIntExtra(GiphyActivity.EXTRA_HEIGHT, 0)
|
||||||
|
}
|
||||||
|
PICK_FROM_LIBRARY -> {
|
||||||
|
val message = intent.getStringExtra(MediaSendActivity.EXTRA_MESSAGE)
|
||||||
|
val media = intent.getParcelableArrayListExtra<Media>(MediaSendActivity.EXTRA_MEDIA) ?: return
|
||||||
|
val slideDeck = SlideDeck()
|
||||||
|
for (item in media) {
|
||||||
|
when {
|
||||||
|
MediaUtil.isVideoType(item.mimeType) -> {
|
||||||
|
slideDeck.addSlide(VideoSlide(this, item.uri, 0, item.caption.orNull()))
|
||||||
|
}
|
||||||
|
MediaUtil.isGif(item.mimeType) -> {
|
||||||
|
slideDeck.addSlide(GifSlide(this, item.uri, 0, item.width, item.height, item.caption.orNull()))
|
||||||
|
}
|
||||||
|
MediaUtil.isImageType(item.mimeType) -> {
|
||||||
|
slideDeck.addSlide(ImageSlide(this, item.uri, 0, item.width, item.height, item.caption.orNull()))
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
Log.d("Loki", "Asked to send an unexpected media type: '" + item.mimeType + "'. Skipping.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region General
|
// region General
|
||||||
|
Loading…
x
Reference in New Issue
Block a user