forked from upstream-mirrors/quik
#1012 - Show video attachments
This commit is contained in:
@@ -25,7 +25,6 @@ import android.telephony.PhoneNumberUtils
|
||||
import android.telephony.SmsMessage
|
||||
import android.view.KeyEvent
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.net.toUri
|
||||
import com.mlsdev.rximagepicker.RxImagePicker
|
||||
import com.mlsdev.rximagepicker.Sources
|
||||
import com.moez.QKSMS.R
|
||||
@@ -323,7 +322,7 @@ class ComposeViewModel(intent: Intent) : QkViewModel<ComposeView, ComposeState>(
|
||||
}
|
||||
|
||||
menuForward.actionId -> {
|
||||
val images = message.parts.filter { it.isImage() }.mapNotNull { it.image?.toUri() }
|
||||
val images = message.parts.filter { it.isImage() }.mapNotNull { it.getUri() }
|
||||
navigator.showCompose(message.body, images)
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import kotlinx.android.synthetic.main.message_list_item_in.view.*
|
||||
import model.Conversation
|
||||
import model.Message
|
||||
import model.Recipient
|
||||
import util.extensions.isImage
|
||||
import util.extensions.hasThumbnails
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -139,7 +139,7 @@ class MessagesAdapter @Inject constructor(
|
||||
view.subject.setVisible(view.subject.text.isNotBlank())
|
||||
|
||||
view.body.text = message.getText()
|
||||
view.body.setVisible(message.isSms() || view.body.text.isNotEmpty() || message.parts.all { it.image == null })
|
||||
view.body.setVisible(message.isSms() || view.body.text.isNotEmpty() || message.parts.all { !it.hasThumbnails() })
|
||||
|
||||
view.timestamp.text = dateFormatter.getMessageTimestamp(message.date)
|
||||
|
||||
@@ -219,7 +219,7 @@ class MessagesAdapter @Inject constructor(
|
||||
}
|
||||
|
||||
// If we're showing any thumbnails, set clipToOutline to true
|
||||
val hasImages = message.parts.filter { it.isImage() }.any()
|
||||
val hasImages = message.parts.filter { it.hasThumbnails() }.any()
|
||||
view.messageBackground.clipToOutline = hasImages
|
||||
|
||||
// setClipToOutline doesn't work unless all of the corners have the same radius, so we have
|
||||
|
||||
@@ -57,7 +57,7 @@ class ConversationMediaAdapter @Inject constructor(
|
||||
val view = holder.itemView
|
||||
|
||||
GlideApp.with(context)
|
||||
.load(part.image)
|
||||
.load(part.getUri())
|
||||
.fitCenter()
|
||||
.into(view.thumbnail)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class GalleryActivity : QkActivity<GalleryViewModel>(), GalleryView {
|
||||
|
||||
if (image.drawable == null) {
|
||||
GlideApp.with(this)
|
||||
.load(state.imagePath)
|
||||
.load(state.imageUri)
|
||||
.dontAnimate()
|
||||
.listener(GlideCompletionListener {
|
||||
startPostponedEnterTransition()
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
*/
|
||||
package feature.gallery
|
||||
|
||||
import android.net.Uri
|
||||
|
||||
data class GalleryState(
|
||||
val navigationVisible: Boolean = true,
|
||||
val title: String = "",
|
||||
val imagePath: String = ""
|
||||
val imageUri: Uri? = null
|
||||
)
|
||||
@@ -49,8 +49,8 @@ class GalleryViewModel(intent: Intent) : QkViewModel<GalleryView, GalleryState>(
|
||||
|
||||
disposables += partIdFlowable
|
||||
.mapNotNull { partId -> messageRepo.getPart(partId) }
|
||||
.mapNotNull { part -> part.image }
|
||||
.subscribe { path -> newState { it.copy(imagePath = path) } }
|
||||
.mapNotNull { part -> part.getUri() }
|
||||
.subscribe { uri -> newState { it.copy(imageUri = uri) } }
|
||||
|
||||
disposables += partIdFlowable
|
||||
.mapNotNull { partId -> messageRepo.getMessageForPart(partId) }
|
||||
|
||||
Reference in New Issue
Block a user