Correct signal for showing contextual buttons for taskbar

Apparently isContextualButtonShowing is not the right signal. Checking on dp.isGestureMode instead

Fixes: 300849078
Test: manual
Change-Id: Iac44bb4adbbdd5faf52100c88c2a4a6d95d58b98
This commit is contained in:
Tracy Zhou
2023-10-10 23:42:09 -07:00
parent 0dbcbfc08f
commit f11604ee49
8 changed files with 13 additions and 14 deletions

View File

@@ -471,7 +471,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
/**
* @return {@code true} if A11y is showing in 3 button nav taskbar
*/
private boolean isContextualButtonShowing() {
private boolean isA11yButtonPersistent() {
return mContext.isThreeButtonNav() && (mState & FLAG_A11Y_VISIBLE) != 0;
}
@@ -742,7 +742,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
mA11yButton, res, isInKidsMode, isInSetup, isThreeButtonNav,
TaskbarManager.isPhoneMode(dp),
mWindowManagerProxy.getRotation(mContext));
navButtonLayoutter.layoutButtons(dp, isContextualButtonShowing());
navButtonLayoutter.layoutButtons(dp, isA11yButtonPersistent());
updateNavButtonColor();
return;
}
@@ -838,7 +838,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
int contextualWidth = mEndContextualContainer.getWidth();
// If contextual buttons are showing, we check if the end margin is enough for the
// contextual button to be showing - if not, move the nav buttons over a smidge
if (isContextualButtonShowing() && navMarginEnd < contextualWidth) {
if (isA11yButtonPersistent() && navMarginEnd < contextualWidth) {
// Additional spacing, eat up half of space between last icon and nav button
navMarginEnd += res.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing) / 2;
}

View File

@@ -47,7 +47,7 @@ class KidsNavLayoutter(
a11yButton
) {
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) {
val iconSize: Int = resources.getDimensionPixelSize(DIMEN_TASKBAR_ICON_SIZE_KIDS)
val buttonWidth: Int = resources.getDimensionPixelSize(DIMEN_TASKBAR_NAV_BUTTONS_WIDTH_KIDS)
val buttonHeight: Int =

View File

@@ -162,6 +162,6 @@ class NavButtonLayoutFactory {
/** Lays out and provides access to the home, recents, and back buttons for various mischief */
interface NavButtonLayoutter {
fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean)
fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean)
}
}

View File

@@ -43,7 +43,7 @@ class PhoneGestureLayoutter(
a11yButton
) {
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) {
endContextualContainer.removeAllViews()
startContextualContainer.removeAllViews()
}

View File

@@ -48,7 +48,7 @@ open class PhoneLandscapeNavLayoutter(
a11yButton
) {
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) {
// TODO(b/230395757): Polish pending, this is just to make it usable
val endStartMargins = resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
val taskbarDimensions = DimensionUtils.getTaskbarPhoneDimensions(dp, resources,

View File

@@ -47,7 +47,7 @@ class PhonePortraitNavLayoutter(
a11yButton
) {
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) {
// TODO(b/230395757): Polish pending, this is just to make it usable
val taskbarDimensions =
DimensionUtils.getTaskbarPhoneDimensions(dp, resources,

View File

@@ -44,7 +44,7 @@ class SetupNavLayoutter(
a11yButton
) {
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) {
// Since setup wizard only has back button enabled, it looks strange to be
// end-aligned, so start-align instead.
val navButtonsLayoutParams = navButtonContainer.layoutParams as FrameLayout.LayoutParams

View File

@@ -27,8 +27,7 @@ import com.android.launcher3.R
import com.android.systemui.shared.rotation.RotationButton
/**
* Layoutter for rendering task bar in large screen. {@param isContextualButtonShowing} is true in
* 3-button mode.
* Layoutter for rendering task bar in large screen, both in 3-button and gesture nav mode.
*/
class TaskbarNavLayoutter(
resources: Resources,
@@ -49,13 +48,13 @@ class TaskbarNavLayoutter(
a11yButton
) {
override fun layoutButtons(dp: DeviceProfile, isContextualButtonShowing: Boolean) {
override fun layoutButtons(dp: DeviceProfile, isA11yButtonPersistent: Boolean) {
// Add spacing after the end of the last nav button
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
// contextual button to be showing - if not, move the nav buttons over a smidge
if (isContextualButtonShowing && navMarginEnd < contextualWidth) {
if (isA11yButtonPersistent && navMarginEnd < contextualWidth) {
// Additional spacing, eat up half of space between last icon and nav button
navMarginEnd += resources.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing) / 2
}
@@ -92,7 +91,7 @@ class TaskbarNavLayoutter(
endContextualContainer.removeAllViews()
startContextualContainer.removeAllViews()
if (isContextualButtonShowing) {
if (!dp.isGestureMode) {
val endContextualContainerParams = FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
endContextualContainerParams.gravity = Gravity.END or Gravity.CENTER_VERTICAL