Pages in Pager mode no longer overlaps cutout areas

Zooming in is still edge to edge, but the padding will make sure the top of the page is under the cutout area

If you can't tell I have a phone with a cutout now
This commit is contained in:
Jays2Kings 2020-09-16 02:42:17 -04:00
parent 99010acc24
commit e5dbc3cbd7
2 changed files with 11 additions and 1 deletions

View File

@ -87,7 +87,7 @@ androidExtensions {
dependencies { dependencies {
// Modified dependencies // Modified dependencies
implementation("com.github.inorichi:subsampling-scale-image-view:ac0dae7") implementation("com.github.jays2kings:subsampling-scale-image-view:78f9664")
implementation("com.github.inorichi:junrar-android:634c1f5") implementation("com.github.inorichi:junrar-android:634c1f5")
// Android X libraries // Android X libraries

View File

@ -13,6 +13,7 @@ import android.view.MotionEvent
import android.view.ViewGroup import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.view.WindowInsets
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
@ -365,6 +366,15 @@ class PagerPageHolder(
setMinimumDpi(90) setMinimumDpi(90)
setMinimumTileDpi(180) setMinimumTileDpi(180)
setCropBorders(config.imageCropBorders) setCropBorders(config.imageCropBorders)
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
val insets: WindowInsets? = viewer.activity.window.decorView.rootWindowInsets
setExtraSpace(
0f,
insets?.displayCutout?.boundingRectTop?.height()?.toFloat() ?: 0f,
0f,
insets?.displayCutout?.boundingRectBottom?.height()?.toFloat() ?: 0f
)
}
setOnImageEventListener( setOnImageEventListener(
object : SubsamplingScaleImageView.DefaultOnImageEventListener() { object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
override fun onReady() { override fun onReady() {