From c843e77183ffeed80db442ecd53376a6a3d8fa51 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Wed, 23 Sep 2020 15:20:25 +0300 Subject: [PATCH] Made notification thumbnail smaller --- .../java/org/schabi/newpipe/player/BasePlayer.java | 11 +++++++++-- app/src/main/res/values/dimens.xml | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java index 813a1cdf4..9d1306e5c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java @@ -497,12 +497,19 @@ public abstract class BasePlayer implements @Override public void onLoadingComplete(final String imageUri, final View view, final Bitmap loadedImage) { + final float width = Math.min( + context.getResources().getDimension(R.dimen.player_notification_thumbnail_width), + loadedImage.getWidth()); + currentThumbnail = Bitmap.createScaledBitmap(loadedImage, + (int) width, + (int) (loadedImage.getHeight() / (loadedImage.getWidth() / width)), true); if (DEBUG) { Log.d(TAG, "Thumbnail - onLoadingComplete() called with: " + "imageUri = [" + imageUri + "], view = [" + view + "], " - + "loadedImage = [" + loadedImage + "]"); + + "loadedImage = [" + loadedImage + "], " + + loadedImage.getWidth() + "x" + loadedImage.getHeight() + + ", scaled width = " + width); } - currentThumbnail = loadedImage; } @Override diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d1eeaddde..c5320ef43 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -48,6 +48,7 @@ 6dp 1dp 40dp + 200dp 180dp