mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Align taskbar to the left/right in 3 button nav for certain devices.
Otherwise we position the taskbar in the center.
Bug: 259712417
Fixes: 267997547
Test: transient taskbar unaffected
persistent taskbar
- test on small tablet
- test on large tablet
- test LTR and RTL
Change-Id: Ieb0a304d9963ebf583bc4ef2deaab747019e8d6d
This commit is contained in:
@@ -91,6 +91,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
private float mTransientTaskbarAllAppsButtonTranslationXOffset;
|
||||
|
||||
private final boolean mStartAlignTaskbar;
|
||||
|
||||
public TaskbarView(@NonNull Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -118,6 +120,8 @@ 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()
|
||||
&& resources.getBoolean(R.bool.start_align_taskbar);
|
||||
|
||||
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
|
||||
int actualIconSize = mActivityContext.getDeviceProfile().iconSizePx;
|
||||
@@ -343,10 +347,22 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
boolean needMoreSpaceForNav = layoutRtl ?
|
||||
navSpaceNeeded > (iconEnd - spaceNeeded) :
|
||||
iconEnd > (right - navSpaceNeeded);
|
||||
if (needMoreSpaceForNav) {
|
||||
int offset = layoutRtl ?
|
||||
navSpaceNeeded - (iconEnd - spaceNeeded) :
|
||||
(right - navSpaceNeeded) - iconEnd;
|
||||
|
||||
if (mStartAlignTaskbar) {
|
||||
// Taskbar is aligned to the start
|
||||
int startSpacingPx = deviceProfile.inlineNavButtonsEndSpacingPx;
|
||||
|
||||
if (layoutRtl) {
|
||||
iconEnd = right - startSpacingPx;
|
||||
} else {
|
||||
iconEnd = startSpacingPx + spaceNeeded;
|
||||
}
|
||||
} else if (needMoreSpaceForNav) {
|
||||
// Add offset to account for nav bar when taskbar is centered
|
||||
int offset = layoutRtl
|
||||
? navSpaceNeeded - (iconEnd - spaceNeeded)
|
||||
: (right - navSpaceNeeded) - iconEnd;
|
||||
|
||||
iconEnd += offset;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user