mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-20 19:51:30 +00:00
parent
e83827ab75
commit
946c43940b
@ -160,6 +160,7 @@ public class ThumbnailView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GenericRequestBuilder buildThumbnailGlideRequest(@NonNull Slide slide, @NonNull MasterSecret masterSecret) {
|
private GenericRequestBuilder buildThumbnailGlideRequest(@NonNull Slide slide, @NonNull MasterSecret masterSecret) {
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
DrawableRequestBuilder<DecryptableUri> builder = Glide.with(getContext()).load(new DecryptableUri(masterSecret, slide.getThumbnailUri()))
|
DrawableRequestBuilder<DecryptableUri> builder = Glide.with(getContext()).load(new DecryptableUri(masterSecret, slide.getThumbnailUri()))
|
||||||
.crossFade()
|
.crossFade()
|
||||||
.transform(new RoundedCorners(getContext(), true, radius, backgroundColorHint));
|
.transform(new RoundedCorners(getContext(), true, radius, backgroundColorHint));
|
||||||
|
@ -129,7 +129,7 @@ public class AttachmentDatabase extends Database {
|
|||||||
try {
|
try {
|
||||||
InputStream generatedStream = thumbnailExecutor.submit(new ThumbnailFetchCallable(masterSecret, attachmentId)).get();
|
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;
|
else return generatedStream;
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
throw new AssertionError("interrupted");
|
throw new AssertionError("interrupted");
|
||||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.mms;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.data.DataFetcher;
|
import com.bumptech.glide.load.data.DataFetcher;
|
||||||
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
||||||
@ -51,13 +52,29 @@ public class AttachmentStreamUriLoader implements StreamModelLoader<AttachmentMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class AttachmentModel {
|
public static class AttachmentModel {
|
||||||
public File attachment;
|
public @NonNull File attachment;
|
||||||
public byte[] key;
|
public @NonNull byte[] key;
|
||||||
|
|
||||||
public AttachmentModel(File attachment, byte[] key) {
|
public AttachmentModel(@NonNull File attachment, @NonNull byte[] key) {
|
||||||
this.attachment = attachment;
|
this.attachment = attachment;
|
||||||
this.key = key;
|
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.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.load.data.DataFetcher;
|
import com.bumptech.glide.load.data.DataFetcher;
|
||||||
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
import com.bumptech.glide.load.model.GenericLoaderFactory;
|
||||||
@ -48,13 +49,29 @@ public class DecryptableStreamUriLoader implements StreamModelLoader<Decryptable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class DecryptableUri {
|
public static class DecryptableUri {
|
||||||
public MasterSecret masterSecret;
|
public @NonNull MasterSecret masterSecret;
|
||||||
public Uri uri;
|
public @NonNull Uri uri;
|
||||||
|
|
||||||
public DecryptableUri(MasterSecret masterSecret, Uri uri) {
|
public DecryptableUri(@NonNull MasterSecret masterSecret, @NonNull Uri uri) {
|
||||||
this.masterSecret = masterSecret;
|
this.masterSecret = masterSecret;
|
||||||
this.uri = uri;
|
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