mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Change AllApps padding to use a Rect
AllApps uses different values for left and right padding in some places (e.g. ActivityAllAppsContainerView uses workspacePadding.left/right), and this change is the first step into moving those values into DeviceProfile. Bug: 269632571 Test: NexusLauncherTest Flag: NONE Change-Id: I14c4edf55ca74f256b1aaa336fff246a0c78e25d
This commit is contained in:
@@ -117,12 +117,13 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
View parent = (View) getParent();
|
||||
int allAppsLeftRightPadding = mActivityContext.getDeviceProfile().allAppsLeftRightPadding;
|
||||
boolean isRtl = Utilities.isRtl(getResources());
|
||||
Rect allAppsPadding = mActivityContext.getDeviceProfile().allAppsPadding;
|
||||
int size = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight()
|
||||
- 2 * allAppsLeftRightPadding;
|
||||
- (allAppsPadding.left + allAppsPadding.right);
|
||||
int tabWidth = getTabWidth(getContext(), size);
|
||||
int shift = (size - tabWidth) / 2 + allAppsLeftRightPadding;
|
||||
setTranslationX(Utilities.isRtl(getResources()) ? shift : -shift);
|
||||
int shift = (size - tabWidth) / 2 + (isRtl ? allAppsPadding.left : allAppsPadding.right);
|
||||
setTranslationX(isRtl ? shift : -shift);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user