Updating landscape layout for launcher/quickstep

> Hotseat is tied to navbar (on left in seascape)
> Search box shows up in Overview (clicking it would crash for now)
> All-apps is no longer fullscreen in landscape
> Recents cards are appropriately scaled down
> Hotseat is visible in Overview

Bug: 70179916
Change-Id: I53149eaeac9557e8a01021b7e2d139f3d6ceef37
This commit is contained in:
Sunny Goyal
2018-01-04 15:35:22 -08:00
parent 07b1d670f2
commit 228153d92a
32 changed files with 397 additions and 500 deletions

View File

@@ -16,10 +16,12 @@
package com.android.launcher3.uioverrides;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import android.graphics.Rect;
import android.view.View;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -38,7 +40,7 @@ public class OverviewState extends LauncherState {
private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED;
public OverviewState(int id) {
super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, 1f, STATE_FLAGS);
super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
}
@Override
@@ -58,11 +60,6 @@ public class OverviewState extends LauncherState {
return getScaleAndTranslationForPageRect(launcher, overlap, pageRect);
}
@Override
public float getHoseatAlpha(Launcher launcher) {
return launcher.getDeviceProfile().isVerticalBarLayout() ? 0 : 1;
}
@Override
public void onStateEnabled(Launcher launcher) {
RecentsView rv = launcher.getOverviewPanel();
@@ -75,28 +72,57 @@ public class OverviewState extends LauncherState {
rv.setOverviewStateEnabled(false);
}
@Override
public float getVerticalProgress(Launcher launcher) {
DeviceProfile grid = launcher.getDeviceProfile();
if (!grid.isVerticalBarLayout()) {
return 1f;
}
float total = grid.heightPx;
float searchHeight = total - grid.availableHeightPx +
launcher.getResources().getDimension(R.dimen.all_apps_search_box_full_height);
return 1 - (searchHeight / total);
}
@Override
public View getFinalFocus(Launcher launcher) {
return launcher.getOverviewPanel();
}
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
final int centerPage = launcher.getWorkspace().getNextPage();
return new PageAlphaProvider(ACCEL_2) {
@Override
public float getPageAlpha(int pageIndex) {
return pageIndex != centerPage ? 0 : 1f;
}
};
}
public static float[] getScaleAndTranslationForPageRect(Launcher launcher, float offsetX,
Rect pageRect) {
Workspace ws = launcher.getWorkspace();
float childWidth = ws.getNormalChildWidth();
float childHeight = ws.getNormalChildHeight();
Rect insets = launcher.getDragLayer().getInsets();
float scale = pageRect.width() / childWidth;
float translationX = offsetX / scale;
if (Utilities.isRtl(launcher.getResources())) {
translationX = -translationX;
}
float scale = Math.min(pageRect.width() / childWidth, pageRect.height() / childHeight);
float halfHeight = ws.getHeight() / 2;
float childTop = halfHeight - scale * (halfHeight - ws.getPaddingTop() - insets.top);
float translationY = pageRect.top - childTop;
float halfWidth = ws.getWidth() / 2;
float translationX;
if (Utilities.isRtl(launcher.getResources())) {
float childRight = halfWidth + scale * (halfWidth - ws.getPaddingRight() - insets.right);
translationX = childRight - pageRect.right - offsetX / scale;
} else {
float childLeft = halfWidth - scale * (halfWidth - ws.getPaddingLeft() - insets.left);
translationX = pageRect.left - childLeft + offsetX / scale;
}
return new float[] {scale, translationX, translationY};
}
}