1
0
Fork 0

For #6946 - Get engine margins without assuming top/bottom toolbar

master
Emily Kager 2019-12-12 13:27:16 -08:00 committed by Emily Kager
parent dcb39b0a44
commit 686facffc6
3 changed files with 9 additions and 12 deletions

View File

@ -593,7 +593,13 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
/**
* Returns the top and bottom margins.
*/
protected abstract fun getEngineMargins(): Pair<Int, Int>
private fun getEngineMargins(): Pair<Int, Int> =
if (context?.settings()?.shouldUseBottomToolbar == true) {
val toolbarSize = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
0 to toolbarSize
} else {
0 to 0
}
/**
* Returns the layout [android.view.Gravity] for the quick settings and ETP dialog.

View File

@ -190,11 +190,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
}
}
override fun getEngineMargins(): Pair<Int, Int> {
val toolbarSize = resources.getDimensionPixelSize(R.dimen.browser_toolbar_height)
return 0 to toolbarSize
}
private fun themeReaderViewControlsForPrivateMode(view: View) = with(view) {
listOf(
R.id.mozac_feature_readerview_font_size_decrease,

View File

@ -71,7 +71,8 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
isPrivate = (activity as HomeActivity).browsingModeManager.mode.isPrivate
),
owner = this,
view = view)
view = view
)
windowFeature.set(
feature = CustomTabWindowFeature(
@ -186,11 +187,6 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
}
}
override fun getEngineMargins(): Pair<Int, Int> {
// Since the top toolbar is dynamic we don't want any margins
return 0 to 0
}
override fun getContextMenuCandidates(
context: Context,
view: View