Updating the card size logic

In full screen always follow the device aspect ratio
In multi-window, follow the 1:1 split window size
Rotate the screen shot only in full-screen mode

Bug: 70289009
Change-Id: Id5095565634d4d7920fefa929b28276db80bda5f
This commit is contained in:
Sunny Goyal
2018-04-05 13:37:46 -07:00
parent 80be805996
commit d792a77234
9 changed files with 189 additions and 191 deletions

View File

@@ -19,13 +19,11 @@ import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE;
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.Workspace;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.views.RecentsView;
@@ -47,14 +45,8 @@ public class OverviewState extends LauncherState {
@Override
public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
Rect pageRect = new Rect();
RecentsView.getPageRect(launcher.getDeviceProfile(), launcher, pageRect);
if (launcher.getWorkspace().getNormalChildWidth() <= 0 || pageRect.isEmpty()) {
return super.getWorkspaceScaleAndTranslation(launcher);
}
return getScaleAndTranslationForPageRect(launcher, pageRect);
// TODO: provide a valid value
return new float[]{1, 0, -launcher.getDeviceProfile().hotseatBarSizePx / 2};
}
@Override
@@ -93,20 +85,6 @@ public class OverviewState extends LauncherState {
};
}
public static float[] getScaleAndTranslationForPageRect(Launcher launcher, Rect pageRect) {
Workspace ws = launcher.getWorkspace();
float childWidth = ws.getNormalChildWidth();
float scale = pageRect.width() / childWidth;
Rect insets = launcher.getDragLayer().getInsets();
float halfHeight = ws.getExpectedHeight() / 2;
float childTop = halfHeight - scale * (halfHeight - ws.getPaddingTop() - insets.top);
float translationY = pageRect.top - childTop;
return new float[] {scale, 0, translationY};
}
@Override
public int getVisibleElements(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {