mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 04:11:52 +01:00
Reader Smart BG no longer does gradient backgrounds in landscape
This commit is contained in:
parent
c68053d74c
commit
9eaea6507d
@ -724,7 +724,7 @@ class PagerPageHolder(
|
|||||||
fun getBGType(readerTheme: Int, context: Context): Int {
|
fun getBGType(readerTheme: Int, context: Context): Int {
|
||||||
return if (readerTheme == 3) {
|
return if (readerTheme == 3) {
|
||||||
if (context.isInNightMode()) 2 else 1
|
if (context.isInNightMode()) 2 else 1
|
||||||
} else 0
|
} else 0 + (context.resources.configuration?.orientation ?: 0) * 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.util.system
|
package eu.kanade.tachiyomi.util.system
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
@ -203,32 +204,37 @@ object ImageUtil {
|
|||||||
if (topIsBlackStreak && bottomIsBlackStreak) {
|
if (topIsBlackStreak && bottomIsBlackStreak) {
|
||||||
darkBG = true
|
darkBG = true
|
||||||
}
|
}
|
||||||
|
val isLandscape = context.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||||
if (darkBG) {
|
if (darkBG) {
|
||||||
return if (isWhite(image.getPixel(left, bot)) && isWhite(image.getPixel(right, bot))) GradientDrawable(
|
return if (!isLandscape && isWhite(image.getPixel(left, bot)) && isWhite(image.getPixel(right, bot))) GradientDrawable(
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM,
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
intArrayOf(blackPixel, blackPixel, backgroundColor, backgroundColor)
|
intArrayOf(blackPixel, blackPixel, backgroundColor, backgroundColor)
|
||||||
)
|
)
|
||||||
else if (isWhite(image.getPixel(left, top)) && isWhite(image.getPixel(right, top))) GradientDrawable(
|
else if (!isLandscape && isWhite(image.getPixel(left, top)) && isWhite(image.getPixel(right, top))) GradientDrawable(
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM,
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
intArrayOf(backgroundColor, backgroundColor, blackPixel, blackPixel)
|
intArrayOf(backgroundColor, backgroundColor, blackPixel, blackPixel)
|
||||||
)
|
)
|
||||||
else ColorDrawable(blackPixel)
|
else ColorDrawable(blackPixel)
|
||||||
}
|
}
|
||||||
if (topIsBlackStreak || (
|
if (!isLandscape && (
|
||||||
|
topIsBlackStreak || (
|
||||||
topLeftIsDark && topRightIsDark &&
|
topLeftIsDark && topRightIsDark &&
|
||||||
isDark(image.getPixel(left - offsetX, top)) && isDark(image.getPixel(right + offsetX, top)) &&
|
isDark(image.getPixel(left - offsetX, top)) && isDark(image.getPixel(right + offsetX, top)) &&
|
||||||
(topMidIsDark || overallBlackPixels > 9)
|
(topMidIsDark || overallBlackPixels > 9)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return GradientDrawable(
|
return GradientDrawable(
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM,
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
intArrayOf(blackPixel, blackPixel, backgroundColor, backgroundColor)
|
intArrayOf(blackPixel, blackPixel, backgroundColor, backgroundColor)
|
||||||
)
|
)
|
||||||
} else if (bottomIsBlackStreak || (
|
} else if (!isLandscape && (
|
||||||
|
bottomIsBlackStreak || (
|
||||||
botLeftIsDark && botRightIsDark &&
|
botLeftIsDark && botRightIsDark &&
|
||||||
isDark(image.getPixel(left - offsetX, bot)) && isDark(image.getPixel(right + offsetX, bot)) &&
|
isDark(image.getPixel(left - offsetX, bot)) && isDark(image.getPixel(right + offsetX, bot)) &&
|
||||||
(isDark(image.getPixel(midX, bot)) || overallBlackPixels > 9)
|
(isDark(image.getPixel(midX, bot)) || overallBlackPixels > 9)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return GradientDrawable(
|
return GradientDrawable(
|
||||||
GradientDrawable.Orientation.TOP_BOTTOM,
|
GradientDrawable.Orientation.TOP_BOTTOM,
|
||||||
|
Loading…
Reference in New Issue
Block a user