|
|
|
@ -3,15 +3,16 @@ package org.thoughtcrime.securesms.components;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.res.TypedArray;
|
|
|
|
|
import android.graphics.Canvas;
|
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
import android.widget.ProgressBar;
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.ColorInt;
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
import androidx.annotation.UiThread;
|
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
|
import android.widget.ImageView;
|
|
|
|
|
|
|
|
|
|
import network.loki.messenger.R;
|
|
|
|
|
import org.thoughtcrime.securesms.attachments.Attachment;
|
|
|
|
|
import org.thoughtcrime.securesms.mms.GlideRequests;
|
|
|
|
|
import org.thoughtcrime.securesms.mms.Slide;
|
|
|
|
@ -21,12 +22,15 @@ import org.thoughtcrime.securesms.util.ThemeUtil;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import network.loki.messenger.R;
|
|
|
|
|
|
|
|
|
|
public class ConversationItemThumbnail extends FrameLayout {
|
|
|
|
|
|
|
|
|
|
private ThumbnailView thumbnail;
|
|
|
|
|
private AlbumThumbnailView album;
|
|
|
|
|
private ImageView shade;
|
|
|
|
|
private ConversationItemFooter footer;
|
|
|
|
|
private ProgressBar loadIndicator;
|
|
|
|
|
private CornerMask cornerMask;
|
|
|
|
|
private Outliner outliner;
|
|
|
|
|
private boolean borderless;
|
|
|
|
@ -49,12 +53,13 @@ public class ConversationItemThumbnail extends FrameLayout {
|
|
|
|
|
private void init(@Nullable AttributeSet attrs) {
|
|
|
|
|
inflate(getContext(), R.layout.conversation_item_thumbnail, this);
|
|
|
|
|
|
|
|
|
|
this.thumbnail = findViewById(R.id.conversation_thumbnail_image);
|
|
|
|
|
this.album = findViewById(R.id.conversation_thumbnail_album);
|
|
|
|
|
this.shade = findViewById(R.id.conversation_thumbnail_shade);
|
|
|
|
|
this.footer = findViewById(R.id.conversation_thumbnail_footer);
|
|
|
|
|
this.cornerMask = new CornerMask(this);
|
|
|
|
|
this.outliner = new Outliner();
|
|
|
|
|
this.thumbnail = findViewById(R.id.conversation_thumbnail_image);
|
|
|
|
|
this.album = findViewById(R.id.conversation_thumbnail_album);
|
|
|
|
|
this.shade = findViewById(R.id.conversation_thumbnail_shade);
|
|
|
|
|
this.footer = findViewById(R.id.conversation_thumbnail_footer);
|
|
|
|
|
this.loadIndicator = findViewById(R.id.conversation_thumbnail_load_indicator);
|
|
|
|
|
this.cornerMask = new CornerMask(this);
|
|
|
|
|
this.outliner = new Outliner();
|
|
|
|
|
|
|
|
|
|
outliner.setColor(ThemeUtil.getThemedColor(getContext(), R.attr.conversation_item_image_outline_color));
|
|
|
|
|
|
|
|
|
@ -136,6 +141,18 @@ public class ConversationItemThumbnail extends FrameLayout {
|
|
|
|
|
album.setSlides(glideRequests, slides, showControls);
|
|
|
|
|
setTouchDelegate(album.getTouchDelegate());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Display loading indicator if any attachment is in loading state.
|
|
|
|
|
{
|
|
|
|
|
boolean anyLoading = false;
|
|
|
|
|
for (int i = 0; i < slides.size(); i++) {
|
|
|
|
|
if (slides.get(i).asAttachment().isInProgress()) {
|
|
|
|
|
anyLoading = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
loadIndicator.setVisibility(anyLoading ? VISIBLE : GONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setConversationColor(@ColorInt int color) {
|
|
|
|
|