mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
parent
65ac2b3e18
commit
82b74e8ce7
@ -21,7 +21,6 @@ import android.widget.ImageView;
|
||||
import com.bumptech.glide.DrawableTypeRequest;
|
||||
import com.bumptech.glide.GenericRequestBuilder;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||
import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable;
|
||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
@ -32,11 +31,11 @@ import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.jobs.PartProgressEvent;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri;
|
||||
import org.thoughtcrime.securesms.mms.RoundedCorners;
|
||||
import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.util.FutureTaskListener;
|
||||
import org.thoughtcrime.securesms.util.ListenableFutureTask;
|
||||
import org.thoughtcrime.securesms.mms.RoundedCorners;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
@ -245,7 +244,8 @@ public class ThumbnailView extends FrameLayout {
|
||||
public void onSuccess(final SlideDeck slideDeck) {
|
||||
if (slideDeck == null) return;
|
||||
|
||||
final Slide slide = slideDeck.getThumbnailSlide(getContext());
|
||||
final Slide slide = slideDeck.getThumbnailSlide();
|
||||
|
||||
if (slide != null) {
|
||||
Util.runOnMain(new Runnable() {
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@ package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@ -89,7 +90,7 @@ public class SlideDeck {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Slide getThumbnailSlide(Context context) {
|
||||
public @Nullable Slide getThumbnailSlide() {
|
||||
for (Slide slide : slides) {
|
||||
if (slide.hasImage()) {
|
||||
return slide;
|
||||
|
@ -21,6 +21,7 @@ import com.bumptech.glide.Glide;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader;
|
||||
import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.mms.SlideDeck;
|
||||
import org.thoughtcrime.securesms.preferences.NotificationPrivacyPreference;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
@ -167,12 +168,17 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
|
||||
private boolean hasBigPictureSlide(@Nullable ListenableFutureTask<SlideDeck> slideDeck) {
|
||||
try {
|
||||
return masterSecret != null &&
|
||||
slideDeck != null &&
|
||||
Build.VERSION.SDK_INT >= 16 &&
|
||||
slideDeck.get().getThumbnailSlide(context).hasImage() &&
|
||||
!slideDeck.get().getThumbnailSlide(context).isInProgress() &&
|
||||
slideDeck.get().getThumbnailSlide(context).getThumbnailUri() != null;
|
||||
if (masterSecret == null || slideDeck == null || Build.VERSION.SDK_INT < 16) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Slide thumbnailSlide = slideDeck.get().getThumbnailSlide();
|
||||
|
||||
return thumbnailSlide != null &&
|
||||
thumbnailSlide.hasImage() &&
|
||||
!thumbnailSlide.isInProgress() &&
|
||||
thumbnailSlide.getThumbnailUri() != null;
|
||||
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
Log.w(TAG, e);
|
||||
return false;
|
||||
@ -183,7 +189,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
@NonNull ListenableFutureTask<SlideDeck> slideDeck)
|
||||
{
|
||||
try {
|
||||
Uri uri = slideDeck.get().getThumbnailSlide(context).getThumbnailUri();
|
||||
Uri uri = slideDeck.get().getThumbnailSlide().getThumbnailUri();
|
||||
|
||||
return Glide.with(context)
|
||||
.load(new DecryptableStreamUriLoader.DecryptableUri(masterSecret, uri))
|
||||
|
Loading…
x
Reference in New Issue
Block a user