mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
fix: Use getFilename() instead of the actual filename on disk (#3521)
* fix: Use msg.getFilename() instead of the file's name in some cases * fix: Use msg.getFilename() instead of the file's name in initializeDraft() * fix: Use msg.getFilename() instead of the file's name in MediaItem * fix: Use the correct file name in MediaView * refactor: `msg` param of `getManuallyCalculatedSlideInfo()` was always null * Improve comment * Revert "refactor: `msg` param of `getManuallyCalculatedSlideInfo()` was always null" We will unfortunately need getManuallyCalculatedSlideInfo() with `msg` param This reverts commit60e8248db3
. * fix: Fix drafting images This fixes a bug introduced in14f69f87e8
: When you drafted an image, pressed Back, and opened the chat again, then the height of the drafted image was wrong and tapping the image opened a preview for the wrong image. I do think that theoretically it would be nicer to use getSlideForMsg here, because we already have a DcMsg, but this didn't work because a) the width and height wasn't gotten from the msg and instead 0 was passed and b) the code tries to save a msgId instead of the message instead, and loading the message from the database fails later since it's just a draft. I didn't want to try and fix these things, because they might be bigger refactorings and I don't know the code. * fix: Use the original message's filemime if there is one ...instead of trying to guess the mimetype from the uri
This commit is contained in:
parent
923227a0e8
commit
8e55a3dbf3
10 changed files with 60 additions and 46 deletions
|
@ -3,10 +3,10 @@ package org.thoughtcrime.securesms.components;
|
|||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
@ -55,6 +55,7 @@ public class MediaView extends FrameLayout {
|
|||
public void set(@NonNull GlideRequests glideRequests,
|
||||
@NonNull Window window,
|
||||
@NonNull Uri source,
|
||||
@Nullable String fileName,
|
||||
@NonNull String mediaType,
|
||||
long size,
|
||||
boolean autoplay)
|
||||
|
@ -68,7 +69,7 @@ public class MediaView extends FrameLayout {
|
|||
imageView.setVisibility(View.GONE);
|
||||
videoView.get().setVisibility(View.VISIBLE);
|
||||
videoView.get().setWindow(window);
|
||||
videoView.get().setVideoSource(new VideoSlide(getContext(), source, size), autoplay);
|
||||
videoView.get().setVideoSource(new VideoSlide(getContext(), source, fileName, size), autoplay);
|
||||
} else {
|
||||
throw new IOException("Unsupported media type: " + mediaType);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue