From 718acb505930e4a7d2dbd7b3840b73677f5512bb Mon Sep 17 00:00:00 2001 From: TobiGr Date: Thu, 2 Jan 2020 15:00:22 +0100 Subject: [PATCH] Code improvements --- .../newpipe/player/helper/MediaSessionManager.java | 11 ++--------- .../java/org/schabi/newpipe/util/BitmapUtils.java | 4 ++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java b/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java index 51684f506..8b9369613 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/MediaSessionManager.java @@ -50,15 +50,8 @@ public class MediaSessionManager { } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - public void setLockScreenArt( - NotificationCompat.Builder builder, - @Nullable Bitmap thumbnailBitmap - ) { - if (thumbnailBitmap == null) { - return; - } - - if (!mediaSession.isActive()) { + public void setLockScreenArt(NotificationCompat.Builder builder, @Nullable Bitmap thumbnailBitmap) { + if (thumbnailBitmap == null || !mediaSession.isActive()) { return; } diff --git a/app/src/main/java/org/schabi/newpipe/util/BitmapUtils.java b/app/src/main/java/org/schabi/newpipe/util/BitmapUtils.java index a0e7de4ac..7ad71eb5c 100644 --- a/app/src/main/java/org/schabi/newpipe/util/BitmapUtils.java +++ b/app/src/main/java/org/schabi/newpipe/util/BitmapUtils.java @@ -22,11 +22,11 @@ public class BitmapUtils { float newYScale; if (yScale > xScale) { - newXScale = (1.0f / yScale) * xScale; + newXScale = xScale / yScale; newYScale = 1.0f; } else { newXScale = 1.0f; - newYScale = (1.0f / xScale) * yScale; + newYScale = yScale / xScale; } float scaledWidth = newXScale * sourceWidth;