Commit 686facff authored by Emily Kager's avatar Emily Kager Committed by Emily Kager
Browse files

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

parent dcb39b0a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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.
+0 −5
Original line number Diff line number Diff line
@@ -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,
+2 −6
Original line number Diff line number Diff line
@@ -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