Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcae0e86 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Center taskbar nav buttons in small screen

Bug: 288311605
Test: All the buttons are in centered in all orientations
Change-Id: Ibb9dc57e38a2e61c426f1edfbf771634d5e3cbb1
parent a6bf4c25
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ open class PhoneLandscapeNavLayoutter(
        navContainerParams.apply {
            width = taskbarDimensions.x
            height = ViewGroup.LayoutParams.MATCH_PARENT
            gravity = Gravity.CENTER
            topMargin = endStartMargins
            bottomMargin = endStartMargins
            marginEnd = 0
@@ -65,6 +64,7 @@ open class PhoneLandscapeNavLayoutter(
        navButtonContainer.addView(backButton)

        navButtonContainer.layoutParams = navContainerParams
        navButtonContainer.gravity = Gravity.CENTER_HORIZONTAL

        // Add the spaces in between the nav buttons
        val spaceInBetween: Int =
+11 −7
Original line number Diff line number Diff line
@@ -46,23 +46,27 @@ class PhonePortraitNavLayoutter(
            DimensionUtils.getTaskbarPhoneDimensions(dp, resources,
                    TaskbarManager.isPhoneMode(dp))
        val endStartMargins = resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
        navContainerParams.width = taskbarDimensions.x
        navContainerParams.height = ViewGroup.LayoutParams.MATCH_PARENT
        navContainerParams.gravity = Gravity.CENTER_VERTICAL

        // Ensure order of buttons is correct
        navButtonContainer.removeAllViews()
        navButtonContainer.orientation = LinearLayout.HORIZONTAL
        navContainerParams.topMargin = 0
        navContainerParams.bottomMargin = 0
        navContainerParams.marginEnd = endStartMargins
        navContainerParams.marginStart = endStartMargins

        navContainerParams.apply {
            width = taskbarDimensions.x
            height = ViewGroup.LayoutParams.MATCH_PARENT
            topMargin = 0
            bottomMargin = 0
            marginEnd = endStartMargins
            marginStart = endStartMargins
        }

        // Swap recents and back button in case we were landscape prior to this
        navButtonContainer.addView(backButton)
        navButtonContainer.addView(homeButton)
        navButtonContainer.addView(recentsButton)

        navButtonContainer.layoutParams = navContainerParams
        navButtonContainer.gravity = Gravity.CENTER_VERTICAL

        // Add the spaces in between the nav buttons
        val spaceInBetween =