Close #9827: Support display cutouts
parent
7f1ef17d8b
commit
c9141c9ae5
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.browser
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
@ -436,6 +437,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
sessionManager,
|
sessionManager,
|
||||||
SessionUseCases(sessionManager),
|
SessionUseCases(sessionManager),
|
||||||
customTabSessionId,
|
customTabSessionId,
|
||||||
|
::viewportFitChange,
|
||||||
::fullScreenChanged
|
::fullScreenChanged
|
||||||
),
|
),
|
||||||
owner = this,
|
owner = this,
|
||||||
|
@ -817,6 +819,14 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
||||||
pipFeature?.onPictureInPictureModeChanged(enabled)
|
pipFeature?.onPictureInPictureModeChanged(enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun viewportFitChange(layoutInDisplayCutoutMode: Int) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
|
val layoutParams = activity?.window?.attributes
|
||||||
|
layoutParams?.layoutInDisplayCutoutMode = layoutInDisplayCutoutMode
|
||||||
|
activity?.window?.attributes = layoutParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun fullScreenChanged(inFullScreen: Boolean) {
|
private fun fullScreenChanged(inFullScreen: Boolean) {
|
||||||
if (inFullScreen) {
|
if (inFullScreen) {
|
||||||
FenixSnackbar.make(
|
FenixSnackbar.make(
|
||||||
|
|
Loading…
Reference in New Issue