Merge "Remove some unused hotseat/qsb scaling code" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b9d201a5d6
@@ -81,20 +81,6 @@ public class BackgroundAppState extends OverviewState {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
|
||||
if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) {
|
||||
// Translate hotseat offscreen if we show it in overview.
|
||||
RecentsView recentsView = launcher.getOverviewPanel();
|
||||
ScaleAndTranslation scaleAndTranslation = super.getHotseatScaleAndTranslation(launcher);
|
||||
scaleAndTranslation.translationY += LayoutUtils.getShelfTrackingDistance(launcher,
|
||||
launcher.getDeviceProfile(),
|
||||
recentsView.getPagedOrientationHandler());
|
||||
return scaleAndTranslation;
|
||||
}
|
||||
return super.getHotseatScaleAndTranslation(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDepthUnchecked(Context context) {
|
||||
return 1f;
|
||||
|
||||
@@ -77,40 +77,11 @@ public class OverviewState extends LauncherState {
|
||||
return new ScaleAndTranslation(scale, 0, -getDefaultSwipeHeight(launcher) * parallaxFactor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
|
||||
if ((getVisibleElements(launcher) & HOTSEAT_ICONS) != 0) {
|
||||
DeviceProfile dp = launcher.getDeviceProfile();
|
||||
if (dp.allAppsIconSizePx >= dp.iconSizePx) {
|
||||
return new ScaleAndTranslation(1, 0, 0);
|
||||
} else {
|
||||
float scale = ((float) dp.allAppsIconSizePx) / dp.iconSizePx;
|
||||
// Distance between the screen center (which is the pivotY for hotseat) and the
|
||||
// bottom of the hotseat (which we want to preserve)
|
||||
float distanceFromBottom = dp.heightPx / 2 - dp.hotseatBarBottomPaddingPx;
|
||||
// On scaling, the bottom edge is moved closer to the pivotY. We move the
|
||||
// hotseat back down so that the bottom edge's position is preserved.
|
||||
float translationY = distanceFromBottom * (1 - scale);
|
||||
return new ScaleAndTranslation(scale, 0, translationY);
|
||||
}
|
||||
}
|
||||
return getWorkspaceScaleAndTranslation(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getOverviewScaleAndOffset(Launcher launcher) {
|
||||
return new float[] {NO_SCALE, NO_OFFSET};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) {
|
||||
if (this == OVERVIEW) {
|
||||
// Treat the QSB as part of the hotseat so they move together.
|
||||
return getHotseatScaleAndTranslation(launcher);
|
||||
}
|
||||
return super.getQsbScaleAndTranslation(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
|
||||
return new PageAlphaProvider(DEACCEL_2) {
|
||||
|
||||
@@ -176,10 +176,6 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
||||
return launcher.getNormalOverviewScaleAndOffset();
|
||||
}
|
||||
|
||||
public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) {
|
||||
return new ScaleAndTranslation(NO_SCALE, NO_OFFSET, NO_OFFSET);
|
||||
}
|
||||
|
||||
public float getOverviewFullscreenProgress() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ public class WorkspaceStateTransitionAnimation {
|
||||
ScaleAndTranslation scaleAndTranslation = state.getWorkspaceScaleAndTranslation(mLauncher);
|
||||
ScaleAndTranslation hotseatScaleAndTranslation = state.getHotseatScaleAndTranslation(
|
||||
mLauncher);
|
||||
ScaleAndTranslation qsbScaleAndTranslation = state.getQsbScaleAndTranslation(mLauncher);
|
||||
mNewScale = scaleAndTranslation.scale;
|
||||
PageAlphaProvider pageAlphaProvider = state.getWorkspacePageAlphaProvider(mLauncher);
|
||||
final int childCount = mWorkspace.getChildCount();
|
||||
|
||||
@@ -110,6 +110,8 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
mDragController = dragController;
|
||||
recreateControllers();
|
||||
|
||||
mOverviewScrim.setup();
|
||||
|
||||
mWorkspaceDragScrim = new WorkspaceDragScrim((this));
|
||||
mWorkspaceDragScrim.setWorkspace(workspace);
|
||||
|
||||
@@ -118,8 +120,6 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
mRootView = (LauncherRootView) getParent();
|
||||
mSysUiScrim = new SysUiScrim(mRootView);
|
||||
mRootView.setSysUiScrim(mSysUiScrim);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -555,7 +555,6 @@ public class DragLayer extends BaseDragLayer<Launcher> {
|
||||
public void setInsets(Rect insets) {
|
||||
super.setInsets(insets);
|
||||
mSysUiScrim.onInsetsChanged(insets, mAllowSysuiScrims);
|
||||
mOverviewScrim.onInsetsChanged(insets);
|
||||
}
|
||||
|
||||
public WorkspaceDragScrim getWorkspaceDragScrim() {
|
||||
|
||||
@@ -18,10 +18,6 @@ package com.android.launcher3.graphics;
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -55,15 +51,15 @@ public class OverviewScrim extends Scrim {
|
||||
|
||||
public OverviewScrim(View view) {
|
||||
super(view);
|
||||
mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
|
||||
|
||||
onExtractedColorsChanged(mWallpaperColorInfo);
|
||||
}
|
||||
|
||||
public void onInsetsChanged(Rect insets) {
|
||||
mStableScrimmedView = (OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0
|
||||
? mLauncher.getHotseat()
|
||||
: mLauncher.getOverviewPanel();
|
||||
/**
|
||||
* Initializes once view hierarchy is established.
|
||||
*/
|
||||
public void setup() {
|
||||
mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
|
||||
}
|
||||
|
||||
public void updateCurrentScrimmedView(ViewGroup root) {
|
||||
|
||||
@@ -53,10 +53,4 @@ public class HintState extends LauncherState {
|
||||
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
|
||||
return new ScaleAndTranslation(0.92f, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) {
|
||||
// Treat the QSB as part of the hotseat so they move together.
|
||||
return getHotseatScaleAndTranslation(launcher);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user