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