diff --git a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java index 948343be2..2060d67c4 100644 --- a/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java +++ b/app/src/main/java/org/schabi/newpipe/player/NotificationUtil.java @@ -6,7 +6,6 @@ import android.app.Service; import android.content.Intent; import android.content.pm.ServiceInfo; import android.graphics.Bitmap; -import android.graphics.Matrix; import android.os.Build; import android.util.Log; @@ -366,16 +365,13 @@ public final class NotificationUtil { } private Bitmap getBitmapWithSquareAspectRatio(final Bitmap bitmap) { - return getResizedBitmap(bitmap, bitmap.getWidth(), bitmap.getWidth()); - } - - private Bitmap getResizedBitmap(final Bitmap bitmap, final int newWidth, final int newHeight) { - final int width = bitmap.getWidth(); - final int height = bitmap.getHeight(); - final float scaleWidth = ((float) newWidth) / width; - final float scaleHeight = ((float) newHeight) / height; - final Matrix matrix = new Matrix(); - matrix.postScale(scaleWidth, scaleHeight); - return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, false); + // Find the smaller dimension and then take a center portion of the image that + // has that size. + final int w = bitmap.getWidth(); + final int h = bitmap.getHeight(); + final int dstSize = Math.min(w, h); + final int x = (w - dstSize) / 2; + final int y = (h - dstSize) / 2; + return Bitmap.createBitmap(bitmap, x, y, dstSize, dstSize); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1d65b6fba..cedb01b20 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -50,8 +50,8 @@ Show \"Play with Kodi\" option Display an option to play a video via Kodi media center Crash the player - Scale thumbnail to 1:1 aspect ratio - Scale the video thumbnail shown in the notification from 16:9 to 1:1 aspect ratio (may introduce distortions) + Crop thumbnail to 1:1 aspect ratio + Crop the video thumbnail shown in the notification from 16:9 to 1:1 aspect ratio First action button Second action button Third action button