Merge "Fix task bar crash in gesture nav mode with task bar / nav bar unification on" into main

This commit is contained in:
Tracy Zhou
2023-10-05 23:38:13 +00:00
committed by Android (Google) Code Review
9 changed files with 48 additions and 31 deletions

View File

@@ -46,7 +46,7 @@ abstract class AbstractNavButtonLayoutter(
protected val startContextualContainer: ViewGroup,
protected val imeSwitcher: ImageView?,
protected val rotationButton: RotationButton?,
protected val a11yButton: ImageView
protected val a11yButton: ImageView?
) : NavButtonLayoutter {
protected val homeButton: ImageView? = navButtonContainer.findViewById(R.id.home)
protected val recentsButton: ImageView? = navButtonContainer.findViewById(R.id.recent_apps)

View File

@@ -35,7 +35,7 @@ class KidsNavLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView
a11yButton: ImageView?
) :
AbstractNavButtonLayoutter(
resources,
@@ -114,7 +114,9 @@ class KidsNavLayoutter(
startContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
endContextualContainer.addView(a11yButton)
if (a11yButton != null) {
endContextualContainer.addView(a11yButton)
}
if (rotationButton != null) {
endContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()

View File

@@ -58,7 +58,7 @@ class NavButtonLayoutFactory {
navButtonsView: FrameLayout,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView,
a11yButton: ImageView?,
resources: Resources,
isKidsMode: Boolean,
isInSetup: Boolean,

View File

@@ -31,7 +31,7 @@ class PhoneGestureLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView
a11yButton: ImageView?
) :
AbstractNavButtonLayoutter(
resources,

View File

@@ -36,7 +36,7 @@ open class PhoneLandscapeNavLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView,
a11yButton: ImageView?,
) :
AbstractNavButtonLayoutter(
resources,
@@ -113,7 +113,9 @@ open class PhoneLandscapeNavLayoutter(
startContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
startContextualContainer.addView(a11yButton)
if (a11yButton != null) {
startContextualContainer.addView(a11yButton)
}
if (rotationButton != null) {
startContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()

View File

@@ -35,7 +35,7 @@ class PhonePortraitNavLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView,
a11yButton: ImageView?,
) :
AbstractNavButtonLayoutter(
resources,
@@ -111,7 +111,9 @@ class PhonePortraitNavLayoutter(
endContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
endContextualContainer.addView(a11yButton)
if (a11yButton != null) {
endContextualContainer.addView(a11yButton)
}
if (rotationButton != null) {
endContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()

View File

@@ -31,7 +31,7 @@ class PhoneSeascapeNavLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView
a11yButton: ImageView?
) :
PhoneLandscapeNavLayoutter(
resources,
@@ -63,7 +63,9 @@ class PhoneSeascapeNavLayoutter(
endContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
endContextualContainer.addView(a11yButton)
if (a11yButton != null) {
endContextualContainer.addView(a11yButton)
}
if (rotationButton != null) {
endContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()

View File

@@ -32,7 +32,7 @@ class SetupNavLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView
a11yButton: ImageView?
) :
AbstractNavButtonLayoutter(
resources,
@@ -72,7 +72,9 @@ class SetupNavLayoutter(
startContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
endContextualContainer.addView(a11yButton)
if (a11yButton != null) {
endContextualContainer.addView(a11yButton)
}
if (rotationButton != null) {
endContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()

View File

@@ -26,7 +26,10 @@ import com.android.launcher3.DeviceProfile
import com.android.launcher3.R
import com.android.systemui.shared.rotation.RotationButton
/** Layoutter for showing 3 button navigation on large screen */
/**
* Layoutter for rendering task bar in large screen. {@param isContextualButtonShowing} is true in
* 3-button mode.
*/
class TaskbarNavLayoutter(
resources: Resources,
navBarContainer: LinearLayout,
@@ -34,7 +37,7 @@ class TaskbarNavLayoutter(
startContextualContainer: ViewGroup,
imeSwitcher: ImageView?,
rotationButton: RotationButton?,
a11yButton: ImageView
a11yButton: ImageView?
) :
AbstractNavButtonLayoutter(
resources,
@@ -89,24 +92,28 @@ class TaskbarNavLayoutter(
endContextualContainer.removeAllViews()
startContextualContainer.removeAllViews()
val endContextualContainerParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL
endContextualContainer.layoutParams = endContextualContainerParams
if (isContextualButtonShowing) {
val endContextualContainerParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL
endContextualContainer.layoutParams = endContextualContainerParams
val startContextualContainerParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL
startContextualContainer.layoutParams = startContextualContainerParams
val startContextualContainerParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
startContextualContainerParams.gravity = Gravity.START or Gravity.CENTER_VERTICAL
startContextualContainer.layoutParams = startContextualContainerParams
if (imeSwitcher != null) {
startContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
endContextualContainer.addView(a11yButton)
if (rotationButton != null) {
endContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()
if (imeSwitcher != null) {
startContextualContainer.addView(imeSwitcher)
imeSwitcher.layoutParams = getParamsToCenterView()
}
if (a11yButton != null) {
endContextualContainer.addView(a11yButton)
}
if (rotationButton != null) {
endContextualContainer.addView(rotationButton.currentView)
rotationButton.currentView.layoutParams = getParamsToCenterView()
}
}
}
}