summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormueller-ma <mueller-ma@users.noreply.github.com>2023-05-18 10:33:02 +0200
committerGitHub <noreply@github.com>2023-05-18 10:33:02 +0200
commit3da7fcf8f0b17113c204375bfb09a084a4a04e82 (patch)
tree2f6dba97ee2e496ea0120c28e1fc827737145469
parent194067deeae66145331a6f70cdf1ddb346a04ba3 (diff)
downloadAntennaPod-3da7fcf8f0b17113c204375bfb09a084a4a04e82.zip
Rounded corners of cover in widget (#6483)
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java10
-rw-r--r--core/src/main/res/values/dimens.xml1
2 files changed, 11 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java
index b27325cf8..3d4cdbcf2 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java
@@ -13,6 +13,9 @@ import android.view.View;
import android.widget.RemoteViews;
import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.resource.bitmap.FitCenter;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.bumptech.glide.request.RequestOptions;
import java.util.concurrent.TimeUnit;
@@ -83,10 +86,16 @@ public abstract class WidgetUpdater {
views.setOnClickPendingIntent(R.id.imgvCover, startMediaPlayer);
views.setOnClickPendingIntent(R.id.butPlaybackSpeed, startPlaybackSpeedDialog);
+ int radius = context.getResources().getDimensionPixelSize(R.dimen.widget_inner_radius);
+ RequestOptions options = new RequestOptions()
+ .dontAnimate()
+ .transform(new FitCenter(), new RoundedCorners(radius));
+
try {
icon = Glide.with(context)
.asBitmap()
.load(widgetState.media.getImageLocation())
+ .apply(options)
.submit(iconSize, iconSize)
.get(500, TimeUnit.MILLISECONDS);
views.setImageViewBitmap(R.id.imgvCover, icon);
@@ -95,6 +104,7 @@ public abstract class WidgetUpdater {
icon = Glide.with(context)
.asBitmap()
.load(ImageResourceUtils.getFallbackImageLocation(widgetState.media))
+ .apply(options)
.submit(iconSize, iconSize)
.get(500, TimeUnit.MILLISECONDS);
views.setImageViewBitmap(R.id.imgvCover, icon);
diff --git a/core/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml
index dc8047acb..cddff1c47 100644
--- a/core/src/main/res/values/dimens.xml
+++ b/core/src/main/res/values/dimens.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="widget_margin">0dp</dimen>
+ <dimen name="widget_inner_radius">4dp</dimen>
<dimen name="external_player_height">64dp</dimen>
<dimen name="text_size_micro">12sp</dimen>
<dimen name="text_size_small">14sp</dimen>