mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Loading indicator for message thumbnail view.
This commit is contained in:
parent
4b57114f25
commit
f3bb40e024
@ -42,7 +42,18 @@
|
||||
android:layout_marginStart="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginEnd="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
||||
app:footer_text_color="@color/core_white"
|
||||
app:footer_icon_color="@color/core_white"/>
|
||||
app:footer_text_color="@android:color/white"
|
||||
app:footer_icon_color="@android:color/white"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/conversation_thumbnail_load_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:maxWidth="48dp"
|
||||
android:maxHeight="48dp"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</merge>
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user