Align taskbar so that it does not overlap with nav buttons.
Fixes: 275510698
Bug: 259712417
Test: View device where taskbar should be start aligned
Update Display size to make everything bigger
Observe that taskbar icons never overlap nav buttons
Flag: ENABLE_TRANSIENT_TASKBAR true
Change-Id: I246374518f21c4b92d3e02e5582c929a471d9305
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index b7d5993..87df5b0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -92,7 +92,7 @@
private float mTransientTaskbarAllAppsButtonTranslationXOffset;
- private final boolean mStartAlignTaskbar;
+ private final boolean mShouldTryStartAlign;
public TaskbarView(@NonNull Context context) {
this(context, null);
@@ -121,7 +121,7 @@
resources.getDimension(isTransientTaskbar
? R.dimen.transient_taskbar_all_apps_button_translation_x_offset
: R.dimen.taskbar_all_apps_button_translation_x_offset);
- mStartAlignTaskbar = mActivityContext.isThreeButtonNav()
+ mShouldTryStartAlign = mActivityContext.isThreeButtonNav()
&& resources.getBoolean(R.bool.start_align_taskbar);
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
@@ -353,12 +353,10 @@
}
int navSpaceNeeded = deviceProfile.hotseatBarEndOffset;
boolean layoutRtl = isLayoutRtl();
- int iconEnd = right - (right - left - spaceNeeded) / 2;
- boolean needMoreSpaceForNav = layoutRtl ?
- navSpaceNeeded > (iconEnd - spaceNeeded) :
- iconEnd > (right - navSpaceNeeded);
+ int centerAlignIconEnd = right - (right - left - spaceNeeded) / 2;
+ int iconEnd;
- if (mStartAlignTaskbar) {
+ if (mShouldTryStartAlign) {
// Taskbar is aligned to the start
int startSpacingPx = deviceProfile.inlineNavButtonsEndSpacingPx;
@@ -367,13 +365,20 @@
} else {
iconEnd = startSpacingPx + spaceNeeded;
}
- } else if (needMoreSpaceForNav) {
+ } else {
+ iconEnd = centerAlignIconEnd;
+ }
+
+ boolean needMoreSpaceForNav = layoutRtl
+ ? navSpaceNeeded > (iconEnd - spaceNeeded)
+ : iconEnd > (right - navSpaceNeeded);
+ if (needMoreSpaceForNav) {
// Add offset to account for nav bar when taskbar is centered
int offset = layoutRtl
- ? navSpaceNeeded - (iconEnd - spaceNeeded)
- : (right - navSpaceNeeded) - iconEnd;
+ ? navSpaceNeeded - (centerAlignIconEnd - spaceNeeded)
+ : (right - navSpaceNeeded) - centerAlignIconEnd;
- iconEnd += offset;
+ iconEnd = centerAlignIconEnd + offset;
}
sTmpRect.set(mIconLayoutBounds);