From 11a50d0ac4282111c67f0f7815c279119bf9d5f7 Mon Sep 17 00:00:00 2001 From: ourfor Date: Tue, 10 Dec 2024 20:14:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20fix=20image=20corner=20radius=20?= =?UTF-8?q?(Android=2011)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/top/ourfor/app/iplayx/page/home/MediaViewCell.java | 4 ++++ .../java/top/ourfor/app/iplayx/page/login/SiteViewCell.java | 5 +++++ .../java/top/ourfor/app/iplayx/view/EpisodeCellView.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/page/home/MediaViewCell.java b/android/app/src/main/java/top/ourfor/app/iplayx/page/home/MediaViewCell.java index 8d78b722..a426af89 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/page/home/MediaViewCell.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/page/home/MediaViewCell.java @@ -11,7 +11,9 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; +import com.bumptech.glide.request.RequestOptions; import lombok.val; import top.ourfor.app.iplayx.R; @@ -26,6 +28,7 @@ import top.ourfor.app.iplayx.view.infra.TextView; public class MediaViewCell extends ConstraintLayout implements UpdateModelAction { + private static final RequestOptions options = new RequestOptions().transform(new RoundedCorners(DeviceUtil.dpToPx(8))); private MediaModel model; private MediaCellBinding binding; private TextView nameLabel; @@ -64,6 +67,7 @@ public void updateModel(T object) { .load(imageUrl) .placeholder(isAlbum ? R.drawable.hand_drawn_3 : R.drawable.abstract_3) .transition(DrawableTransitionOptions.withCrossFade()) + .apply(options) .into(coverImage); if (model instanceof EmbyMediaModel media) { if (media.getUserData() != null && media.getUserData().getUnplayedItemCount() != null) { diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java b/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java index 0e3a18d8..1976a99c 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/page/login/SiteViewCell.java @@ -9,6 +9,9 @@ import androidx.annotation.NonNull; import androidx.constraintlayout.widget.ConstraintLayout; +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; +import com.bumptech.glide.request.RequestOptions; + import lombok.extern.slf4j.Slf4j; import lombok.val; import top.ourfor.app.iplayx.R; @@ -24,6 +27,7 @@ @Slf4j public class SiteViewCell extends ConstraintLayout implements UpdateModelAction { + private static final RequestOptions options = new RequestOptions().transform(new RoundedCorners(DeviceUtil.dpToPx(24))); private SiteModel model; SiteCellBinding binding = null; @@ -60,6 +64,7 @@ public void updateModel(T object) { GlideApp.with(this) .load(model.avatarUrl()) .placeholder(R.drawable.avatar) + .apply(options) .into(binding.siteImage); } diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/view/EpisodeCellView.java b/android/app/src/main/java/top/ourfor/app/iplayx/view/EpisodeCellView.java index 52f73563..d3a2c469 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/view/EpisodeCellView.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/view/EpisodeCellView.java @@ -19,7 +19,7 @@ import top.ourfor.app.iplayx.model.EmbyMediaModel; public class EpisodeCellView extends ConstraintLayout implements UpdateModelAction { - private static RequestOptions options = new RequestOptions().transform(new RoundedCorners(DeviceUtil.dpToPx(5))); + private static final RequestOptions options = new RequestOptions().transform(new RoundedCorners(DeviceUtil.dpToPx(5))); EpisodeCellBinding binding = null; public EpisodeCellView(@NonNull Context context) {