mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
drop complicated is-thumbnail-preview calculation that is discarded at the end
This commit is contained in:
@@ -424,20 +424,16 @@ public class ConversationItem extends LinearLayout
|
||||
if (documentViewStub.resolved()) documentViewStub.get().setVisibility(View.GONE);
|
||||
|
||||
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,
|
||||
slide,
|
||||
showControls,
|
||||
isPreview,
|
||||
messageRecord.getWidth(100),
|
||||
messageRecord.getHeight(100));
|
||||
mediaThumbnailStub.get().setThumbnailClickListener(new ThumbnailClickListener());
|
||||
|
||||
@@ -111,7 +111,7 @@ class MediaGalleryAdapter extends StickyHeaderGridAdapter {
|
||||
Slide slide = MediaUtil.getSlideForMsg(context, mediaRecord);
|
||||
|
||||
if (slide != null) {
|
||||
thumbnailView.setImageResource(glideRequests, slide, false, false);
|
||||
thumbnailView.setImageResource(glideRequests, slide, false);
|
||||
}
|
||||
|
||||
thumbnailView.setOnClickListener(view -> itemClickListener.onMediaClicked(mediaRecord));
|
||||
|
||||
@@ -165,17 +165,17 @@ public class ConversationItemThumbnail extends FrameLayout {
|
||||
|
||||
@UiThread
|
||||
public void setImageResource(@NonNull GlideRequests glideRequests, @NonNull Slide slide,
|
||||
boolean showControls, boolean isPreview)
|
||||
boolean showControls)
|
||||
{
|
||||
refreshSlideAttachmentState(thumbnail.setImageResource(glideRequests, slide, showControls, isPreview), slide);
|
||||
refreshSlideAttachmentState(thumbnail.setImageResource(glideRequests, slide, showControls), slide);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void setImageResource(@NonNull GlideRequests glideRequests, @NonNull Slide slide,
|
||||
boolean showControls, boolean isPreview, int naturalWidth,
|
||||
boolean showControls, int naturalWidth,
|
||||
int naturalHeight)
|
||||
{
|
||||
refreshSlideAttachmentState(thumbnail.setImageResource(glideRequests, slide, showControls, isPreview, naturalWidth, naturalHeight), slide);
|
||||
refreshSlideAttachmentState(thumbnail.setImageResource(glideRequests, slide, showControls, naturalWidth, naturalHeight), slide);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ThreadPhotoRailView extends FrameLayout {
|
||||
Slide slide = MediaUtil.getSlideForAttachment(getContext(), mediaRecord.getAttachment());
|
||||
|
||||
if (slide != null) {
|
||||
imageView.setImageResource(glideRequests, slide, false, false);
|
||||
imageView.setImageResource(glideRequests, slide, false);
|
||||
}
|
||||
|
||||
imageView.setOnClickListener(v -> {
|
||||
|
||||
@@ -212,18 +212,17 @@ public class ThumbnailView extends FrameLayout {
|
||||
|
||||
@UiThread
|
||||
public ListenableFuture<Boolean> setImageResource(@NonNull GlideRequests glideRequests, @NonNull Slide slide,
|
||||
boolean showControls, boolean isPreview)
|
||||
boolean showControls)
|
||||
{
|
||||
return setImageResource(glideRequests, slide, showControls, isPreview, 0, 0);
|
||||
return setImageResource(glideRequests, slide, showControls, 0, 0);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public ListenableFuture<Boolean> setImageResource(@NonNull GlideRequests glideRequests, @NonNull Slide slide,
|
||||
boolean showControls, boolean isPreview, int naturalWidth,
|
||||
boolean showControls, int naturalWidth,
|
||||
int naturalHeight)
|
||||
{
|
||||
if (slide.getThumbnailUri() != null && slide.hasPlayOverlay() &&
|
||||
(slide.getTransferState() == AttachmentDatabase.TRANSFER_PROGRESS_DONE || isPreview))
|
||||
if (slide.getThumbnailUri() != null && slide.hasPlayOverlay())
|
||||
{
|
||||
this.playOverlay.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
||||
@@ -281,7 +281,7 @@ public class AttachmentManager {
|
||||
result.set(true);
|
||||
} else {
|
||||
Attachment attachment = slide.asAttachment();
|
||||
result.deferTo(thumbnail.setImageResource(glideRequests, slide, false, true, attachment.getWidth(), attachment.getHeight()));
|
||||
result.deferTo(thumbnail.setImageResource(glideRequests, slide, false, attachment.getWidth(), attachment.getHeight()));
|
||||
removableMediaView.display(thumbnail, mediaType == MediaType.IMAGE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user