mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Fixing tab width and panner not aligned with the all-apps icons
Bug: 234008165 Test: Verified on device Change-Id: Ibec3eed4aef730439d79b086d6ae23b63b66361e
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TURN_OFF_WORK_APPS_TAP;
|
||||
import static com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.getTabWidth;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Insets;
|
||||
@@ -96,7 +97,6 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
}
|
||||
|
||||
DeviceProfile dp = ActivityContext.lookupContext(getContext()).getDeviceProfile();
|
||||
lp.rightMargin = lp.leftMargin = dp.allAppsLeftRightPadding;
|
||||
if (!dp.isGestureMode) {
|
||||
if (dp.isTaskbarPresent) {
|
||||
bottomMargin += dp.taskbarSize;
|
||||
@@ -109,6 +109,18 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
DeviceProfile dp = ActivityContext.lookupContext(getContext()).getDeviceProfile();
|
||||
View parent = (View) getParent();
|
||||
int size = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight()
|
||||
- 2 * dp.allAppsLeftRightPadding;
|
||||
int tabWidth = getTabWidth(getContext(), size);
|
||||
int shift = (size - tabWidth) / 2 + dp.allAppsLeftRightPadding;
|
||||
setTranslationX(Utilities.isRtl(getResources()) ? shift : -shift);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivePageChanged(int page) {
|
||||
mOnWorkTab = page == ActivityAllAppsContainerView.AdapterHolder.WORK;
|
||||
|
||||
Reference in New Issue
Block a user