From 212e8893b9213dab5b77b300244534a352d41e4d Mon Sep 17 00:00:00 2001 From: Grishka Date: Wed, 26 Oct 2022 03:01:39 +0300 Subject: [PATCH] Fix editing --- mastodon/build.gradle | 2 +- .../android/fragments/ComposeFragment.java | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/mastodon/build.gradle b/mastodon/build.gradle index f87a1411..4eeede96 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -9,7 +9,7 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 33 - versionCode 41 + versionCode 42 versionName "1.1.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 566a8d55..1002788b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -880,13 +880,17 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr private View createMediaAttachmentView(DraftMediaAttachment draft){ View thumb=getActivity().getLayoutInflater().inflate(R.layout.compose_media_thumb, attachmentsView, false); ImageView img=thumb.findViewById(R.id.thumb); - if(draft.mimeType.startsWith("image/")){ - ViewImageLoader.load(img, null, new UrlImageLoaderRequest(draft.uri, V.dp(250), V.dp(250))); - }else if(draft.mimeType.startsWith("video/")){ - loadVideoThumbIntoView(img, draft.uri); + if(draft.serverAttachment!=null){ + ViewImageLoader.load(img, draft.serverAttachment.blurhashPlaceholder, new UrlImageLoaderRequest(draft.serverAttachment.previewUrl, V.dp(250), V.dp(250))); + }else{ + if(draft.mimeType.startsWith("image/")){ + ViewImageLoader.load(img, null, new UrlImageLoaderRequest(draft.uri, V.dp(250), V.dp(250))); + }else if(draft.mimeType.startsWith("video/")){ + loadVideoThumbIntoView(img, draft.uri); + } } TextView fileName=thumb.findViewById(R.id.file_name); - fileName.setText(UiUtils.getFileName(draft.uri)); + fileName.setText(UiUtils.getFileName(draft.serverAttachment!=null ? Uri.parse(draft.serverAttachment.url) : draft.uri)); draft.view=thumb; draft.imageView=img;