Search in sources :

Example 11 with RoundedCorners

use of com.bumptech.glide.load.resource.bitmap.RoundedCorners 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 12 with RoundedCorners

use of com.bumptech.glide.load.resource.bitmap.RoundedCorners in project Signal-Android by WhisperSystems.

the class ThumbnailView method applySizing.

private GlideRequest applySizing(@NonNull GlideRequest request, @NonNull BitmapTransformation fitting) {
    int[] size = new int[2];
    fillTargetDimensions(size, dimens, bounds);
    if (size[WIDTH] == 0 && size[HEIGHT] == 0) {
        size[WIDTH] = getDefaultWidth();
        size[HEIGHT] = getDefaultHeight();
    }
    request = request.override(size[WIDTH], size[HEIGHT]);
    if (radius > 0) {
        return request.transforms(fitting, new RoundedCorners(radius));
    } else {
        return request.transforms(fitting);
    }
}
Also used : RoundedCorners(com.bumptech.glide.load.resource.bitmap.RoundedCorners)

Example 13 with RoundedCorners

use of com.bumptech.glide.load.resource.bitmap.RoundedCorners in project AntennaPod by AntennaPod.

the class CoverFragment method displayCoverImage.

private void displayCoverImage() {
    RequestOptions options = new RequestOptions().diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).dontAnimate().transforms(new FitCenter(), new RoundedCorners((int) (16 * getResources().getDisplayMetrics().density)));
    RequestBuilder<Drawable> cover = Glide.with(this).load(media.getImageLocation()).error(Glide.with(this).load(ImageResourceUtils.getFallbackImageLocation(media)).apply(options)).apply(options);
    if (displayedChapterIndex == -1 || media == null || media.getChapters() == null || TextUtils.isEmpty(media.getChapters().get(displayedChapterIndex).getImageUrl())) {
        cover.into(imgvCover);
    } else {
        Glide.with(this).load(EmbeddedChapterImage.getModelFor(media, displayedChapterIndex)).apply(options).thumbnail(cover).error(cover).into(imgvCover);
    }
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions) Drawable(android.graphics.drawable.Drawable) FitCenter(com.bumptech.glide.load.resource.bitmap.FitCenter) RoundedCorners(com.bumptech.glide.load.resource.bitmap.RoundedCorners)

Example 14 with RoundedCorners

use of com.bumptech.glide.load.resource.bitmap.RoundedCorners in project AntennaPod by AntennaPod.

the class ItemFragment method updateAppearance.

private void updateAppearance() {
    if (item == null) {
        Log.d(TAG, "updateAppearance item is null");
        return;
    }
    txtvPodcast.setText(item.getFeed().getTitle());
    txtvTitle.setText(item.getTitle());
    if (item.getPubDate() != null) {
        String pubDateStr = DateFormatter.formatAbbrev(getActivity(), item.getPubDate());
        txtvPublished.setText(pubDateStr);
        txtvPublished.setContentDescription(DateFormatter.formatForAccessibility(getContext(), item.getPubDate()));
    }
    RequestOptions options = new RequestOptions().error(R.color.light_gray).diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY).transforms(new FitCenter(), new RoundedCorners((int) (4 * getResources().getDisplayMetrics().density))).dontAnimate();
    Glide.with(getActivity()).load(item.getImageLocation()).error(Glide.with(getActivity()).load(ImageResourceUtils.getFallbackImageLocation(item)).apply(options)).apply(options).into(imgvCover);
    updateButtons();
}
Also used : RequestOptions(com.bumptech.glide.request.RequestOptions) FitCenter(com.bumptech.glide.load.resource.bitmap.FitCenter) RoundedCorners(com.bumptech.glide.load.resource.bitmap.RoundedCorners)

Example 15 with RoundedCorners

use of com.bumptech.glide.load.resource.bitmap.RoundedCorners in project Signal-Android by signalapp.

the class ThumbnailView method applySizing.

private GlideRequest applySizing(@NonNull GlideRequest request, @NonNull BitmapTransformation fitting) {
    int[] size = new int[2];
    fillTargetDimensions(size, dimens, bounds);
    if (size[WIDTH] == 0 && size[HEIGHT] == 0) {
        size[WIDTH] = getDefaultWidth();
        size[HEIGHT] = getDefaultHeight();
    }
    request = request.override(size[WIDTH], size[HEIGHT]);
    if (radius > 0) {
        return request.transforms(fitting, new RoundedCorners(radius));
    } else {
        return request.transforms(fitting);
    }
}
Also used : RoundedCorners(com.bumptech.glide.load.resource.bitmap.RoundedCorners)

Aggregations

RoundedCorners (com.bumptech.glide.load.resource.bitmap.RoundedCorners)15 FitCenter (com.bumptech.glide.load.resource.bitmap.FitCenter)5 RequestOptions (com.bumptech.glide.request.RequestOptions)5 Bitmap (android.graphics.Bitmap)3 Drawable (android.graphics.drawable.Drawable)3 Test (org.junit.Test)3 CenterCrop (com.bumptech.glide.load.resource.bitmap.CenterCrop)2 DecryptableUri (org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri)2 GlideRequest (org.thoughtcrime.securesms.mms.GlideRequest)2 SettableFuture (org.thoughtcrime.securesms.util.concurrent.SettableFuture)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 NonNull (androidx.annotation.NonNull)1 NotificationCompat (androidx.core.app.NotificationCompat)1 NotificationManagerCompat (androidx.core.app.NotificationManagerCompat)1 RemoteInput (androidx.core.app.RemoteInput)1