Search in sources :

Example 1 with GlideRequest

use of org.thoughtcrime.securesms.mms.GlideRequest in project Signal-Android by WhisperSystems.

the class ThumbnailView method buildThumbnailGlideRequest.

private GlideRequest buildThumbnailGlideRequest(@NonNull GlideRequests glideRequests, @NonNull Slide slide) {
    GlideRequest request = applySizing(glideRequests.load(new DecryptableUri(slide.getUri())).diskCacheStrategy(DiskCacheStrategy.RESOURCE).transition(withCrossFade()), fit);
    boolean doNotShowMissingThumbnailImage = Build.VERSION.SDK_INT < 23;
    if (slide.isInProgress() || doNotShowMissingThumbnailImage)
        return request;
    else
        return request.apply(RequestOptions.errorOf(R.drawable.ic_missing_thumbnail_picture));
}
Also used : GlideRequest(org.thoughtcrime.securesms.mms.GlideRequest) DecryptableUri(org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri)

Example 2 with GlideRequest

use of org.thoughtcrime.securesms.mms.GlideRequest in project Signal-Android by WhisperSystems.

the class ThumbnailView method setImageResource.

public ListenableFuture<Boolean> setImageResource(@NonNull GlideRequests glideRequests, @NonNull Uri uri, int width, int height) {
    SettableFuture<Boolean> future = new SettableFuture<>();
    if (transferControls.isPresent())
        getTransferControls().setVisibility(View.GONE);
    GlideRequest request = glideRequests.load(new DecryptableUri(uri)).diskCacheStrategy(DiskCacheStrategy.NONE).transition(withCrossFade());
    if (width > 0 && height > 0) {
        request = request.override(width, height);
    }
    if (radius > 0) {
        request = request.transforms(new CenterCrop(), new RoundedCorners(radius));
    } else {
        request = request.transforms(new CenterCrop());
    }
    request.into(new GlideDrawableListeningTarget(image, future));
    blurhash.setImageDrawable(null);
    return future;
}
Also used : SettableFuture(org.thoughtcrime.securesms.util.concurrent.SettableFuture) GlideRequest(org.thoughtcrime.securesms.mms.GlideRequest) DecryptableUri(org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri) CenterCrop(com.bumptech.glide.load.resource.bitmap.CenterCrop) RoundedCorners(com.bumptech.glide.load.resource.bitmap.RoundedCorners)

Example 3 with GlideRequest

use of org.thoughtcrime.securesms.mms.GlideRequest in project Signal-Android by signalapp.

the class ThumbnailView method setImageResource.

public ListenableFuture<Boolean> setImageResource(@NonNull GlideRequests glideRequests, @NonNull Uri uri, int width, int height) {
    SettableFuture<Boolean> future = new SettableFuture<>();
    if (transferControls.isPresent())
        getTransferControls().setVisibility(View.GONE);
    GlideRequest request = glideRequests.load(new DecryptableUri(uri)).diskCacheStrategy(DiskCacheStrategy.NONE).transition(withCrossFade());
    if (width > 0 && height > 0) {
        request = request.override(width, height);
    }
    if (radius > 0) {
        request = request.transforms(new CenterCrop(), new RoundedCorners(radius));
    } else {
        request = request.transforms(new CenterCrop());
    }
    request.into(new GlideDrawableListeningTarget(image, future));
    blurhash.setImageDrawable(null);
    return future;
}
Also used : SettableFuture(org.thoughtcrime.securesms.util.concurrent.SettableFuture) GlideRequest(org.thoughtcrime.securesms.mms.GlideRequest) DecryptableUri(org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri) CenterCrop(com.bumptech.glide.load.resource.bitmap.CenterCrop) RoundedCorners(com.bumptech.glide.load.resource.bitmap.RoundedCorners)

Example 4 with GlideRequest

use of org.thoughtcrime.securesms.mms.GlideRequest in project Signal-Android by signalapp.

the class ThumbnailView method buildThumbnailGlideRequest.

private GlideRequest buildThumbnailGlideRequest(@NonNull GlideRequests glideRequests, @NonNull Slide slide) {
    GlideRequest request = applySizing(glideRequests.load(new DecryptableUri(slide.getUri())).diskCacheStrategy(DiskCacheStrategy.RESOURCE).transition(withCrossFade()), fit);
    boolean doNotShowMissingThumbnailImage = Build.VERSION.SDK_INT < 23;
    if (slide.isInProgress() || doNotShowMissingThumbnailImage)
        return request;
    else
        return request.apply(RequestOptions.errorOf(R.drawable.ic_missing_thumbnail_picture));
}
Also used : GlideRequest(org.thoughtcrime.securesms.mms.GlideRequest) DecryptableUri(org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri)

Aggregations

DecryptableUri (org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri)4 GlideRequest (org.thoughtcrime.securesms.mms.GlideRequest)4 CenterCrop (com.bumptech.glide.load.resource.bitmap.CenterCrop)2 RoundedCorners (com.bumptech.glide.load.resource.bitmap.RoundedCorners)2 SettableFuture (org.thoughtcrime.securesms.util.concurrent.SettableFuture)2