mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
make video playback work, closes #152
This commit is contained in:
@@ -55,6 +55,7 @@ import org.thoughtcrime.securesms.mms.DocumentSlide;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideClickListener;
|
||||
import org.thoughtcrime.securesms.mms.VideoSlide;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.LongClickCopySpan;
|
||||
@@ -417,11 +418,21 @@ public class ConversationItem extends LinearLayout
|
||||
if (audioViewStub.resolved()) audioViewStub.get().setVisibility(View.GONE);
|
||||
if (documentViewStub.resolved()) documentViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
Slide slide;
|
||||
boolean isPreview;
|
||||
if (messageRecord.getType()==DcMsg.DC_MSG_VIDEO) {
|
||||
slide = new VideoSlide(context, messageRecord);
|
||||
isPreview = true;
|
||||
}
|
||||
else {
|
||||
slide = new DocumentSlide(context, messageRecord);
|
||||
isPreview = false;
|
||||
}
|
||||
|
||||
mediaThumbnailStub.get().setImageResource(glideRequests,
|
||||
new DocumentSlide(context, messageRecord),
|
||||
slide,
|
||||
showControls,
|
||||
false,
|
||||
isPreview,
|
||||
messageRecord.getWidth(100),
|
||||
messageRecord.getHeight(100));
|
||||
mediaThumbnailStub.get().setThumbnailClickListener(new ThumbnailClickListener());
|
||||
|
||||
@@ -58,7 +58,7 @@ public class BucketedThreadMediaLoader extends AsyncTaskLoader<BucketedThreadMed
|
||||
public BucketedThreadMedia loadInBackground() {
|
||||
BucketedThreadMedia result = new BucketedThreadMedia(getContext());
|
||||
DcContext context = DcHelper.getContext(getContext());
|
||||
int[] messages = context.getChatMedia(address.getDcChatId(), DcMsg.DC_MSG_GIF, DcMsg.DC_MSG_IMAGE);
|
||||
int[] messages = context.getChatMedia(address.getDcChatId(), DcMsg.DC_MSG_IMAGE, DcMsg.DC_MSG_VIDEO);
|
||||
for(int nextId : messages) {
|
||||
result.add(context.getMsg(nextId));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PagingMediaLoader extends AsyncLoader<DcMediaGalleryElement> {
|
||||
@Override
|
||||
public DcMediaGalleryElement loadInBackground() {
|
||||
DcContext context = DcHelper.getContext(getContext());
|
||||
int[] mediaMessages = context.getChatMedia(msg.getChatId(), DcMsg.DC_MSG_GIF, DcMsg.DC_MSG_IMAGE);
|
||||
int[] mediaMessages = context.getChatMedia(msg.getChatId(), DcMsg.DC_MSG_IMAGE, DcMsg.DC_MSG_VIDEO);
|
||||
// first id is the oldest message.
|
||||
int currentIndex = -1;
|
||||
for(int ii = 0; ii < mediaMessages.length; ii++) {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class VideoSlide extends Slide {
|
||||
|
||||
public VideoSlide(Context context, DcMsg dcMsg) {
|
||||
super(context, new DcAttachment(dcMsg));
|
||||
dcMsgId = dcMsg.getId();
|
||||
}
|
||||
|
||||
public VideoSlide(Context context, Attachment attachment) {
|
||||
|
||||
Reference in New Issue
Block a user