diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index 8f89d30564..330e496c56 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -33,13 +33,6 @@ public class AllAppsState extends LauncherState { private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS; - private static final PageAlphaProvider PAGE_ALPHA_PROVIDER = new PageAlphaProvider(DEACCEL_2) { - @Override - public float getPageAlpha(int pageIndex) { - return 0; - } - }; - public AllAppsState(int id) { super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS); } @@ -82,7 +75,15 @@ public class AllAppsState extends LauncherState { @Override public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) { - return PAGE_ALPHA_PROVIDER; + PageAlphaProvider superPageAlphaProvider = super.getWorkspacePageAlphaProvider(launcher); + return new PageAlphaProvider(DEACCEL_2) { + @Override + public float getPageAlpha(int pageIndex) { + return launcher.getDeviceProfile().isTablet + ? superPageAlphaProvider.getPageAlpha(pageIndex) + : 0; + } + }; } @Override @@ -97,6 +98,8 @@ public class AllAppsState extends LauncherState { @Override public int getWorkspaceScrimColor(Launcher launcher) { - return Themes.getAttrColor(launcher, R.attr.allAppsScrimColor); + return launcher.getDeviceProfile().isTablet + ? launcher.getResources().getColor(R.color.widgets_picker_scrim) + : Themes.getAttrColor(launcher, R.attr.allAppsScrimColor); } } diff --git a/res/drawable/bg_all_apps_bottom_sheet.xml b/res/drawable/bg_all_apps_bottom_sheet.xml new file mode 100644 index 0000000000..dba2fee7e9 --- /dev/null +++ b/res/drawable/bg_all_apps_bottom_sheet.xml @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml index 3727932676..157cefa801 100644 --- a/res/values-sw600dp/dimens.xml +++ b/res/values-sw600dp/dimens.xml @@ -20,4 +20,7 @@ 32dp + + + 32dp diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml new file mode 100644 index 0000000000..9d7941f5e3 --- /dev/null +++ b/res/values-sw720dp/dimens.xml @@ -0,0 +1,20 @@ + + + + + + 41dp + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 086a2542d1..167c6b247f 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -114,6 +114,7 @@ 150dp 8dp 6dp + 0dp 2dp diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 8a5b8885ff..a2324ac344 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -174,6 +174,7 @@ public class DeviceProfile { public int allAppsIconSizePx; public int allAppsIconDrawablePaddingPx; public int allAppsLeftRightPadding; + public int allAppsLeftRightMargin; public final int numShownAllAppsColumns; public float allAppsIconTextSizePx; @@ -595,11 +596,16 @@ public class DeviceProfile { + textHeight + (topBottomPadding * 2); } - private void updateAllAppsWidth() { - if (isTwoPanels) { + private void updateAllAppsWidth(Resources res) { + + if (isTablet) { + allAppsLeftRightPadding = + res.getDimensionPixelSize(R.dimen.all_apps_bottom_sheet_horizontal_padding) + + cellLayoutPaddingLeftRightPx; int usedWidth = (allAppsCellWidthPx * numShownAllAppsColumns) - + (allAppsBorderSpacePx.x * (numShownAllAppsColumns + 1)); - allAppsLeftRightPadding = Math.max(1, (availableWidthPx - usedWidth) / 2); + + (allAppsBorderSpacePx.x * (numShownAllAppsColumns + 1)) + + allAppsLeftRightPadding * 2; + allAppsLeftRightMargin = Math.max(1, (availableWidthPx - usedWidth) / 2); } else { allAppsLeftRightPadding = desiredWorkspaceHorizontalMarginPx + cellLayoutPaddingLeftRightPx; @@ -709,7 +715,7 @@ public class DeviceProfile { allAppsCellHeightPx = getCellSize().y; } allAppsCellWidthPx = allAppsIconSizePx + (2 * allAppsIconDrawablePaddingPx); - updateAllAppsWidth(); + updateAllAppsWidth(res); if (isVerticalLayout) { hideWorkspaceLabelsIfNotEnoughSpace(); @@ -1102,7 +1108,10 @@ public class DeviceProfile { writer.println(prefix + pxToDpStr("allAppsIconDrawablePaddingPx", allAppsIconDrawablePaddingPx)); writer.println(prefix + pxToDpStr("allAppsCellHeightPx", allAppsCellHeightPx)); + writer.println(prefix + pxToDpStr("allAppsCellWidthPx", allAppsCellWidthPx)); writer.println(prefix + "\tnumShownAllAppsColumns: " + numShownAllAppsColumns); + writer.println(prefix + pxToDpStr("allAppsLeftRightPadding", allAppsLeftRightPadding)); + writer.println(prefix + pxToDpStr("allAppsLeftRightMargin", allAppsLeftRightMargin)); writer.println(prefix + pxToDpStr("hotseatBarSizePx", hotseatBarSizePx)); writer.println(prefix + pxToDpStr("hotseatCellHeightPx", hotseatCellHeightPx)); diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 3ba6ea4de9..f06ec4f3a7 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -161,6 +161,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor)); mAllAppsStore.addUpdateListener(this::onAppsUpdated); + + updateBackground(mLauncher.getDeviceProfile()); } @Override @@ -224,6 +226,13 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo holder.recyclerView.getRecycledViewPool().clear(); } } + updateBackground(dp); + } + + private void updateBackground(DeviceProfile deviceProfile) { + setBackground(deviceProfile.isTablet + ? getContext().getDrawable(R.drawable.bg_all_apps_bottom_sheet) + : null); } private void onAppsUpdated() { @@ -389,8 +398,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo } ViewGroup.MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams(); - mlp.leftMargin = insets.left; - mlp.rightMargin = insets.right; + mlp.topMargin = grid.isTablet ? insets.top : 0; + int leftRightMargin = grid.allAppsLeftRightMargin; + mlp.leftMargin = insets.left + leftRightMargin; + mlp.rightMargin = insets.right + leftRightMargin; setLayoutParams(mlp); if (grid.isVerticalBarLayout()) { diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 85ee636a12..1f7822deef 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -30,12 +30,12 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; -import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.R; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; +import com.android.launcher3.views.ActivityContext; import com.android.systemui.plugins.AllAppsRow; import com.android.systemui.plugins.AllAppsRow.OnHeightUpdatedListener; import com.android.systemui.plugins.PluginListener; @@ -118,7 +118,9 @@ public class FloatingHeaderView extends LinearLayout implements mHeaderTopPadding = context.getResources() .getDimensionPixelSize(R.dimen.all_apps_header_top_padding); mHeaderProtectionSupported = context.getResources().getBoolean( - R.bool.config_header_protection_supported); + R.bool.config_header_protection_supported) + // TODO(b/208599118) Support header protection for bottom sheet. + && !ActivityContext.lookupContext(context).getDeviceProfile().isTablet; } @Override @@ -413,7 +415,7 @@ public class FloatingHeaderView extends LinearLayout implements @Override public void setInsets(Rect insets) { - DeviceProfile grid = BaseDraggingActivity.fromContext(getContext()).getDeviceProfile(); + DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile(); for (FloatingHeaderRow row : mAllRows) { row.setInsets(insets, grid); } diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java index 978c321cb4..5543cc2696 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -34,13 +34,6 @@ public class AllAppsState extends LauncherState { private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE; - private static final PageAlphaProvider PAGE_ALPHA_PROVIDER = new PageAlphaProvider(DEACCEL_2) { - @Override - public float getPageAlpha(int pageIndex) { - return 0; - } - }; - public AllAppsState(int id) { super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS); } @@ -68,7 +61,15 @@ public class AllAppsState extends LauncherState { @Override public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) { - return PAGE_ALPHA_PROVIDER; + PageAlphaProvider superPageAlphaProvider = super.getWorkspacePageAlphaProvider(launcher); + return new PageAlphaProvider(DEACCEL_2) { + @Override + public float getPageAlpha(int pageIndex) { + return launcher.getDeviceProfile().isTablet + ? superPageAlphaProvider.getPageAlpha(pageIndex) + : 0; + } + }; } @Override @@ -78,6 +79,8 @@ public class AllAppsState extends LauncherState { @Override public int getWorkspaceScrimColor(Launcher launcher) { - return Themes.getAttrColor(launcher, R.attr.allAppsScrimColor); + return launcher.getDeviceProfile().isTablet + ? launcher.getResources().getColor(R.color.widgets_picker_scrim) + : Themes.getAttrColor(launcher, R.attr.allAppsScrimColor); } }