mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 20:08:27 +00:00
parent
e83827ab75
commit
946c43940b
@ -160,9 +160,10 @@ public class ThumbnailView extends FrameLayout {
|
||||
}
|
||||
|
||||
private GenericRequestBuilder buildThumbnailGlideRequest(@NonNull Slide slide, @NonNull MasterSecret masterSecret) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
DrawableRequestBuilder<DecryptableUri> builder = Glide.with(getContext()).load(new DecryptableUri(masterSecret, slide.getThumbnailUri()))
|
||||
.crossFade()
|
||||
.transform(new RoundedCorners(getContext(), true, radius, backgroundColorHint));
|
||||
.crossFade()
|
||||
.transform(new RoundedCorners(getContext(), true, radius, backgroundColorHint));
|
||||
|
||||
if (slide.isInProgress()) return builder;
|
||||
else return builder.error(R.drawable.ic_missing_thumbnail_picture);
|
||||
|
@ -129,7 +129,7 @@ public class AttachmentDatabase extends Database {
|
||||
try {
|
||||
InputStream generatedStream = thumbnailExecutor.submit(new ThumbnailFetchCallable(masterSecret, attachmentId)).get();
|
||||
|
||||
if (generatedStream == null) throw new IOException("No thumbnail stream available: " + attachmentId);
|
||||
if (generatedStream == null) throw new FileNotFoundException("No thumbnail stream available: " + attachmentId);
|
||||
else return generatedStream;
|
||||
} catch (InterruptedException ie) {
|
||||
throw new AssertionError("interrupted");
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
||||
@ -51,13 +52,29 @@ public class AttachmentStreamUriLoader implements StreamModelLoader<AttachmentMo
|
||||
}
|
||||
|
||||
public static class AttachmentModel {
|
||||
public File attachment;
|
||||
public byte[] key;
|
||||
public @NonNull File attachment;
|
||||
public @NonNull byte[] key;
|
||||
|
||||
public AttachmentModel(File attachment, byte[] key) {
|
||||
public AttachmentModel(@NonNull File attachment, @NonNull byte[] key) {
|
||||
this.attachment = attachment;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
AttachmentModel that = (AttachmentModel)o;
|
||||
|
||||
return attachment.equals(that.attachment);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return attachment.hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
||||
@ -48,13 +49,29 @@ public class DecryptableStreamUriLoader implements StreamModelLoader<Decryptable
|
||||
}
|
||||
|
||||
public static class DecryptableUri {
|
||||
public MasterSecret masterSecret;
|
||||
public Uri uri;
|
||||
public @NonNull MasterSecret masterSecret;
|
||||
public @NonNull Uri uri;
|
||||
|
||||
public DecryptableUri(MasterSecret masterSecret, Uri uri) {
|
||||
public DecryptableUri(@NonNull MasterSecret masterSecret, @NonNull Uri uri) {
|
||||
this.masterSecret = masterSecret;
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
DecryptableUri that = (DecryptableUri)o;
|
||||
|
||||
return uri.equals(that.uri);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return uri.hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user