1
0
Fork 0

Close #9827: Support display cutouts

master
Roger Yang 2020-04-09 12:31:47 -04:00 committed by Emily Kager
parent 7f1ef17d8b
commit c9141c9ae5
1 changed files with 10 additions and 0 deletions

View File

@ -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(