From 3e323af296535bce43af37985392d18b68798718 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 2 Dec 2019 16:20:51 -0800 Subject: [PATCH] Update ImageUtil.kt --- .../eu/kanade/tachiyomi/util/ImageUtil.kt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/ImageUtil.kt index 48f2503860..d9b0ebd81c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/ImageUtil.kt @@ -151,8 +151,8 @@ object ImageUtil { botRightIsDark -> image.getPixel(right, bot) else -> blackPixel } - darkBG = true; - overallWhitePixels = 0; + darkBG = true + overallWhitePixels = 0 break@outer } blackStreak -> { @@ -164,7 +164,7 @@ object ImageUtil { else -> blackPixel } if (blackPixels > 18) { - overallWhitePixels = 0; + overallWhitePixels = 0 break@outer } } @@ -180,14 +180,11 @@ object ImageUtil { darkBG = true val whiteColor = android.R.attr.colorBackground if (darkBG) { - if (isWhite(image.getPixel(left, bot)) && isWhite(image.getPixel(right, bot))) - return GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, - intArrayOf(blackPixel, blackPixel, whiteColor, whiteColor)) - else if (isWhite(image.getPixel(left, top)) && isWhite(image.getPixel(right, top))) - return GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, - intArrayOf(whiteColor, whiteColor, blackPixel, blackPixel)) - else - return ColorDrawable(blackPixel) + return if (isWhite(image.getPixel(left, bot)) && isWhite(image.getPixel(right, bot))) GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, + intArrayOf(blackPixel, blackPixel, whiteColor, whiteColor)) + else if (isWhite(image.getPixel(left, top)) && isWhite(image.getPixel(right, top))) GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, + intArrayOf(whiteColor, whiteColor, blackPixel, blackPixel)) + else ColorDrawable(blackPixel) } if (topIsBlackStreak || (topLeftIsDark && topRightIsDark && isDark(image.getPixel(left - offsetX, top)) && isDark(image.getPixel(right + offsetX, top))