diff --git a/app/src/main/java/org/thoughtcrime/securesms/MediaGalleryAdapter.java b/app/src/main/java/org/thoughtcrime/securesms/MediaGalleryAdapter.java index 534127240f..aad4c17008 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/MediaGalleryAdapter.java +++ b/app/src/main/java/org/thoughtcrime/securesms/MediaGalleryAdapter.java @@ -26,7 +26,7 @@ import android.widget.TextView; import com.codewaves.stickyheadergrid.StickyHeaderGridAdapter; -import org.thoughtcrime.securesms.components.ThumbnailView; +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import org.thoughtcrime.securesms.database.MediaDatabase.MediaRecord; import org.thoughtcrime.securesms.database.loaders.BucketedThreadMediaLoader.BucketedThreadMedia; import org.thoughtcrime.securesms.mms.GlideRequests; diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/AlbumThumbnailView.java b/app/src/main/java/org/thoughtcrime/securesms/components/AlbumThumbnailView.java index 9f472fb069..1586ca6c52 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/AlbumThumbnailView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/AlbumThumbnailView.java @@ -11,6 +11,8 @@ import android.widget.FrameLayout; import android.widget.TextView; import network.loki.messenger.R; + +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.mms.Slide; diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java b/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java index 379b5c77a7..e41f641024 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/ConversationItemThumbnail.java @@ -12,6 +12,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.mms.Slide; @@ -27,7 +28,7 @@ import network.loki.messenger.R; public class ConversationItemThumbnail extends FrameLayout { - private ThumbnailView thumbnail; + private ThumbnailView thumbnail; private AlbumThumbnailView album; private ImageView shade; private ConversationItemFooter footer; diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java b/app/src/main/java/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java index 228ed97e46..df28984ab0 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/OutlinedThumbnailView.java @@ -5,6 +5,7 @@ import android.graphics.Canvas; import android.util.AttributeSet; import org.session.libsession.utilities.ThemeUtil; +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import network.loki.messenger.R; diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/StickerView.java b/app/src/main/java/org/thoughtcrime/securesms/components/StickerView.java index 3b8c30d31b..6214c58531 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/StickerView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/StickerView.java @@ -7,6 +7,7 @@ import android.util.AttributeSet; import android.view.View; import android.widget.FrameLayout; +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.mms.Slide; diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index b6f8dbf74b..2f2fb51bd2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -423,7 +423,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe // the view) so as to not interfere with all the other gestures. Do not add // onClickListeners directly to message content views. view.onContentClick() - DownloadDialog(thread).show(supportFragmentManager, "Blocked Dialog") } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/LinkPreviewView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/LinkPreviewView.kt index 356745328a..daf99b6bc1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/LinkPreviewView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/LinkPreviewView.kt @@ -14,11 +14,13 @@ import android.view.View import android.view.ViewOutlineProvider import android.widget.LinearLayout import androidx.core.content.res.ResourcesCompat +import androidx.core.view.isVisible import kotlinx.android.synthetic.main.view_link_preview.view.* import network.loki.messenger.R import org.thoughtcrime.securesms.database.model.MmsMessageRecord import org.thoughtcrime.securesms.loki.utilities.UiModeUtilities import org.thoughtcrime.securesms.mms.GlideRequests +import org.thoughtcrime.securesms.mms.ImageSlide class LinkPreviewView : LinearLayout { @@ -39,10 +41,9 @@ class LinkPreviewView : LinearLayout { mainLinkPreviewContainer.clipToOutline = true // Thumbnail val linkPreview = message.linkPreviews.first() - // TODO: Handle downloading state - val uri = linkPreview.thumbnail.get().dataUri ?: return - glide.load(uri).into(thumbnailImageView) - // TODO: Properly use glide and the actual thumbnail + if (linkPreview.getThumbnail().isPresent) { + thumbnailImageView.setImageResource(glide, ImageSlide(context, linkPreview.getThumbnail().get()), false, false) + } // Title titleTextView.text = linkPreview.title val textColorID = if (message.isOutgoing && UiModeUtilities.isDayUiMode(context)) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/ThumbnailView.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ThumbnailView.java similarity index 97% rename from app/src/main/java/org/thoughtcrime/securesms/components/ThumbnailView.java rename to app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ThumbnailView.java index 106fa45096..b2fe05b54a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/ThumbnailView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/ThumbnailView.java @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.components; +package org.thoughtcrime.securesms.conversation.v2.utilities; import android.content.Context; import android.content.res.TypedArray; @@ -24,6 +24,9 @@ import com.bumptech.glide.request.RequestOptions; import network.loki.messenger.R; +import org.thoughtcrime.securesms.components.GlideBitmapListeningTarget; +import org.thoughtcrime.securesms.components.GlideDrawableListeningTarget; +import org.thoughtcrime.securesms.components.TransferControlView; import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri; import org.thoughtcrime.securesms.mms.GlideRequest; import org.thoughtcrime.securesms.mms.GlideRequests; @@ -94,10 +97,9 @@ public class ThumbnailView extends FrameLayout { bounds[MAX_WIDTH] = typedArray.getDimensionPixelSize(R.styleable.ThumbnailView_maxWidth, 0); bounds[MIN_HEIGHT] = typedArray.getDimensionPixelSize(R.styleable.ThumbnailView_minHeight, 0); bounds[MAX_HEIGHT] = typedArray.getDimensionPixelSize(R.styleable.ThumbnailView_maxHeight, 0); - radius = typedArray.getDimensionPixelSize(R.styleable.ThumbnailView_thumbnail_radius, getResources().getDimensionPixelSize(R.dimen.thumbnail_default_radius)); typedArray.recycle(); } else { - radius = getResources().getDimensionPixelSize(R.dimen.message_corner_collapse_radius); + radius = 0; } } @@ -275,7 +277,7 @@ public class ThumbnailView extends FrameLayout { this.slide = slide; - this.captionIcon.setVisibility(slide.getCaption().isPresent() ? VISIBLE : GONE); + this.captionIcon.setVisibility(GONE); dimens[WIDTH] = naturalWidth; dimens[HEIGHT] = naturalHeight; @@ -398,6 +400,7 @@ public class ThumbnailView extends FrameLayout { } private class ThumbnailClickDispatcher implements View.OnClickListener { + @Override public void onClick(View view) { if (thumbnailClickListener != null && @@ -413,9 +416,9 @@ public class ThumbnailView extends FrameLayout { } private class DownloadClickDispatcher implements View.OnClickListener { + @Override public void onClick(View view) { - Log.i(TAG, "onClick() for download button"); if (downloadClickListener != null && slide != null) { downloadClickListener.onClick(view, Collections.singletonList(slide)); } else { diff --git a/app/src/main/java/org/thoughtcrime/securesms/mediapreview/MediaRailAdapter.java b/app/src/main/java/org/thoughtcrime/securesms/mediapreview/MediaRailAdapter.java index 7767d0d7ea..dd27c42502 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/mediapreview/MediaRailAdapter.java +++ b/app/src/main/java/org/thoughtcrime/securesms/mediapreview/MediaRailAdapter.java @@ -10,7 +10,7 @@ import android.view.ViewGroup; import network.loki.messenger.R; -import org.thoughtcrime.securesms.components.ThumbnailView; +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import org.thoughtcrime.securesms.mediasend.Media; import org.thoughtcrime.securesms.mms.GlideRequests; import org.thoughtcrime.securesms.util.StableIdGenerator; diff --git a/app/src/main/java/org/thoughtcrime/securesms/mms/AttachmentManager.java b/app/src/main/java/org/thoughtcrime/securesms/mms/AttachmentManager.java index dcac22909c..e2b7980ab6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/mms/AttachmentManager.java +++ b/app/src/main/java/org/thoughtcrime/securesms/mms/AttachmentManager.java @@ -41,7 +41,7 @@ import org.thoughtcrime.securesms.MediaPreviewActivity; import org.thoughtcrime.securesms.loki.views.MessageAudioView; import org.thoughtcrime.securesms.components.DocumentView; import org.thoughtcrime.securesms.components.RemovableEditableMediaView; -import org.thoughtcrime.securesms.components.ThumbnailView; +import org.thoughtcrime.securesms.conversation.v2.utilities.ThumbnailView; import org.session.libsignal.utilities.NoExternalStorageException; import org.thoughtcrime.securesms.giph.ui.GiphyActivity; import org.session.libsignal.utilities.Log; diff --git a/app/src/main/res/drawable/ic_link.xml b/app/src/main/res/drawable/ic_link.xml new file mode 100644 index 0000000000..56b2c2168c --- /dev/null +++ b/app/src/main/res/drawable/ic_link.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/album_thumbnail_2.xml b/app/src/main/res/layout/album_thumbnail_2.xml index 3fad6e678e..6ce179ea6a 100644 --- a/app/src/main/res/layout/album_thumbnail_2.xml +++ b/app/src/main/res/layout/album_thumbnail_2.xml @@ -7,13 +7,13 @@ android:layout_width="@dimen/album_total_width" android:layout_height="@dimen/album_2_total_height"> - - - - - - - - - - - - - - - - - - - - - - - - - + android:orientation="vertical" + xmlns:app="http://schemas.android.com/apk/res-auto"> - + android:layout_height="96dp"> + + + + + +