mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Update widget picker two pane to support foldables
Bug: 301918659 Test: WidgetPickerImageTest Flag: ACONFIG com.android.launcher3.enable_unfolded_two_pane_picker DEVELOPMENT Change-Id: I5beecf4f8c46235f3e89c7bd8aed65fd292883ce
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.android.launcher3.widget;
|
||||
|
||||
import static com.android.app.animation.Interpolators.EMPHASIZED;
|
||||
import static com.android.launcher3.Flags.enableUnfoldedTwoPanePicker;
|
||||
import static com.android.launcher3.LauncherPrefs.WIDGETS_EDUCATION_TIP_SEEN;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -182,12 +183,8 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
|
||||
DeviceProfile deviceProfile = mActivityContext.getDeviceProfile();
|
||||
int widthUsed;
|
||||
if (deviceProfile.isTablet) {
|
||||
int margin = deviceProfile.allAppsLeftRightMargin;
|
||||
if (deviceProfile.isLandscape && !deviceProfile.isTwoPanels) {
|
||||
margin = getResources().getDimensionPixelSize(
|
||||
R.dimen.widget_picker_landscape_tablet_left_right_margin);
|
||||
}
|
||||
widthUsed = Math.max(2 * margin, 2 * (mInsets.left + mInsets.right));
|
||||
widthUsed = Math.max(2 * getTabletMargin(deviceProfile),
|
||||
2 * (mInsets.left + mInsets.right));
|
||||
} else if (mInsets.bottom > 0) {
|
||||
widthUsed = mInsets.left + mInsets.right;
|
||||
} else {
|
||||
@@ -202,6 +199,18 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
|
||||
MeasureSpec.getSize(heightMeasureSpec));
|
||||
}
|
||||
|
||||
private int getTabletMargin(DeviceProfile deviceProfile) {
|
||||
if (deviceProfile.isLandscape && !deviceProfile.isTwoPanels) {
|
||||
return getResources().getDimensionPixelSize(
|
||||
R.dimen.widget_picker_landscape_tablet_left_right_margin);
|
||||
}
|
||||
if (deviceProfile.isTwoPanels && enableUnfoldedTwoPanePicker()) {
|
||||
return getResources().getDimensionPixelSize(
|
||||
R.dimen.widget_picker_two_panels_left_right_margin);
|
||||
}
|
||||
return deviceProfile.allAppsLeftRightMargin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Interpolator getIdleInterpolator() {
|
||||
return mActivityContext.getDeviceProfile().isTablet
|
||||
|
||||
Reference in New Issue
Block a user