Merge "Fix nav buttons in task bar disppearing when unfolding from landscape small screen" into udc-qpr-dev

This commit is contained in:
Tracy Zhou
2023-08-09 17:46:27 +00:00
committed by Android (Google) Code Review
3 changed files with 9 additions and 12 deletions

View File

@@ -42,16 +42,15 @@ open class PhoneLandscapeNavLayoutter(
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
// TODO(b/230395757): Polish pending, this is just to make it usable
val navContainerParams = navButtonContainer.layoutParams as FrameLayout.LayoutParams
val endStartMargins = resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
val taskbarDimensions = DimensionUtils.getTaskbarPhoneDimensions(dp, resources,
TaskbarManager.isPhoneMode(dp))
navButtonContainer.removeAllViews()
navButtonContainer.orientation = LinearLayout.VERTICAL
val navContainerParams = FrameLayout.LayoutParams(
taskbarDimensions.x, ViewGroup.LayoutParams.MATCH_PARENT)
navContainerParams.apply {
width = taskbarDimensions.x
height = ViewGroup.LayoutParams.MATCH_PARENT
topMargin = endStartMargins
bottomMargin = endStartMargins
marginEnd = 0
@@ -64,7 +63,7 @@ open class PhoneLandscapeNavLayoutter(
navButtonContainer.addView(backButton)
navButtonContainer.layoutParams = navContainerParams
navButtonContainer.gravity = Gravity.CENTER_HORIZONTAL
navButtonContainer.gravity = Gravity.CENTER
// Add the spaces in between the nav buttons
val spaceInBetween: Int =

View File

@@ -41,7 +41,6 @@ class PhonePortraitNavLayoutter(
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
// TODO(b/230395757): Polish pending, this is just to make it usable
val navContainerParams = navButtonContainer.layoutParams as FrameLayout.LayoutParams
val taskbarDimensions =
DimensionUtils.getTaskbarPhoneDimensions(dp, resources,
TaskbarManager.isPhoneMode(dp))
@@ -51,9 +50,9 @@ class PhonePortraitNavLayoutter(
navButtonContainer.removeAllViews()
navButtonContainer.orientation = LinearLayout.HORIZONTAL
val navContainerParams = FrameLayout.LayoutParams(
taskbarDimensions.x, ViewGroup.LayoutParams.MATCH_PARENT)
navContainerParams.apply {
width = taskbarDimensions.x
height = ViewGroup.LayoutParams.MATCH_PARENT
topMargin = 0
bottomMargin = 0
marginEnd = endStartMargins
@@ -66,7 +65,7 @@ class PhonePortraitNavLayoutter(
navButtonContainer.addView(recentsButton)
navButtonContainer.layoutParams = navContainerParams
navButtonContainer.gravity = Gravity.CENTER_VERTICAL
navButtonContainer.gravity = Gravity.CENTER
// Add the spaces in between the nav buttons
val spaceInBetween =

View File

@@ -40,7 +40,6 @@ class TaskbarNavLayoutter(
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
// Add spacing after the end of the last nav button
val navButtonParams = navButtonContainer.layoutParams as FrameLayout.LayoutParams
var navMarginEnd = resources.getDimension(dp.inv.inlineNavButtonsEndSpacing).toInt()
val contextualWidth = endContextualContainer.width
// If contextual buttons are showing, we check if the end margin is enough for the
@@ -50,10 +49,10 @@ class TaskbarNavLayoutter(
navMarginEnd += resources.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing) / 2
}
val navButtonParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
navButtonParams.apply {
gravity = Gravity.END
width = FrameLayout.LayoutParams.WRAP_CONTENT
height = ViewGroup.LayoutParams.MATCH_PARENT
gravity = Gravity.END or Gravity.CENTER_VERTICAL
marginEnd = navMarginEnd
}
navButtonContainer.orientation = LinearLayout.HORIZONTAL