mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Align taskbar so that it does not overlap with nav buttons." into tm-qpr-dev
This commit is contained in:
@@ -92,7 +92,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
private float mTransientTaskbarAllAppsButtonTranslationXOffset;
|
||||
|
||||
private final boolean mStartAlignTaskbar;
|
||||
private final boolean mShouldTryStartAlign;
|
||||
|
||||
public TaskbarView(@NonNull Context context) {
|
||||
this(context, null);
|
||||
@@ -121,7 +121,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
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 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
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 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
} 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);
|
||||
|
||||
Reference in New Issue
Block a user