Merge "Allow clipping individual direction of TaskView" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
47fde77687
@@ -290,19 +290,35 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
public static void getTaskDimension(Context context, DeviceProfile dp, PointF out) {
|
||||
if (dp.isMultiWindowMode) {
|
||||
WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(context);
|
||||
if (TaskView.clipStatusAndNavBars(dp)) {
|
||||
out.x = bounds.availableSize.x;
|
||||
out.y = bounds.availableSize.y;
|
||||
} else {
|
||||
out.x = bounds.availableSize.x + bounds.insets.left + bounds.insets.right;
|
||||
out.y = bounds.availableSize.y + bounds.insets.top + bounds.insets.bottom;
|
||||
out.x = bounds.availableSize.x;
|
||||
out.y = bounds.availableSize.y;
|
||||
if (!TaskView.clipLeft(dp)) {
|
||||
out.x += bounds.insets.left;
|
||||
}
|
||||
if (!TaskView.clipRight(dp)) {
|
||||
out.x += bounds.insets.right;
|
||||
}
|
||||
if (!TaskView.clipTop(dp)) {
|
||||
out.y += bounds.insets.top;
|
||||
}
|
||||
if (!TaskView.clipBottom(dp)) {
|
||||
out.y += bounds.insets.bottom;
|
||||
}
|
||||
} else if (TaskView.clipStatusAndNavBars(dp)) {
|
||||
out.x = dp.availableWidthPx;
|
||||
out.y = dp.availableHeightPx;
|
||||
} else {
|
||||
out.x = dp.widthPx;
|
||||
out.y = dp.heightPx;
|
||||
if (TaskView.clipLeft(dp)) {
|
||||
out.x -= dp.getInsets().left;
|
||||
}
|
||||
if (TaskView.clipRight(dp)) {
|
||||
out.x -= dp.getInsets().right;
|
||||
}
|
||||
if (TaskView.clipTop(dp)) {
|
||||
out.y -= dp.getInsets().top;
|
||||
}
|
||||
if (TaskView.clipBottom(dp)) {
|
||||
out.y -= Math.max(dp.getInsets().bottom, dp.taskbarSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -396,9 +396,17 @@ public class RecentsOrientedState implements
|
||||
Rect insets = dp.getInsets();
|
||||
float fullWidth = dp.widthPx;
|
||||
float fullHeight = dp.heightPx;
|
||||
if (TaskView.clipStatusAndNavBars(dp)) {
|
||||
fullWidth -= insets.left + insets.right;
|
||||
fullHeight -= insets.top + insets.bottom;
|
||||
if (TaskView.clipLeft(dp)) {
|
||||
fullWidth -= insets.left;
|
||||
}
|
||||
if (TaskView.clipRight(dp)) {
|
||||
fullWidth -= insets.right;
|
||||
}
|
||||
if (TaskView.clipTop(dp)) {
|
||||
fullHeight -= insets.top;
|
||||
}
|
||||
if (TaskView.clipBottom(dp)) {
|
||||
fullHeight -= insets.bottom;
|
||||
}
|
||||
|
||||
getTaskDimension(mContext, dp, outPivot);
|
||||
|
||||
@@ -211,10 +211,6 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
|
||||
return Insets.NONE;
|
||||
}
|
||||
|
||||
if (!TaskView.clipStatusAndNavBars(mActivity.getDeviceProfile())) {
|
||||
return Insets.NONE;
|
||||
}
|
||||
|
||||
RectF bitmapRect = new RectF(
|
||||
0, 0,
|
||||
mThumbnailData.thumbnail.getWidth(), mThumbnailData.thumbnail.getHeight());
|
||||
@@ -228,11 +224,14 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
|
||||
RectF boundsInBitmapSpace = new RectF();
|
||||
boundsToBitmapSpace.mapRect(boundsInBitmapSpace, viewRect);
|
||||
|
||||
return Insets.of(
|
||||
Math.round(boundsInBitmapSpace.left),
|
||||
Math.round(boundsInBitmapSpace.top),
|
||||
Math.round(bitmapRect.right - boundsInBitmapSpace.right),
|
||||
Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom));
|
||||
DeviceProfile dp = mActivity.getDeviceProfile();
|
||||
int leftInset = TaskView.clipLeft(dp) ? Math.round(boundsInBitmapSpace.left) : 0;
|
||||
int topInset = TaskView.clipTop(dp) ? Math.round(boundsInBitmapSpace.top) : 0;
|
||||
int rightInset = TaskView.clipRight(dp) ? Math.round(
|
||||
bitmapRect.right - boundsInBitmapSpace.right) : 0;
|
||||
int bottomInset = TaskView.clipBottom(dp)
|
||||
? Math.round(bitmapRect.bottom - boundsInBitmapSpace.bottom) : 0;
|
||||
return Insets.of(leftInset, topInset, rightInset, bottomInset);
|
||||
}
|
||||
|
||||
|
||||
@@ -440,8 +439,19 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
|
||||
|
||||
int thumbnailRotation = thumbnailData.rotation;
|
||||
int deltaRotate = getRotationDelta(currentRotation, thumbnailRotation);
|
||||
RectF thumbnailClipHint = TaskView.clipStatusAndNavBars(dp)
|
||||
? new RectF(thumbnailData.insets) : new RectF();
|
||||
RectF thumbnailClipHint = new RectF();
|
||||
if (TaskView.clipLeft(dp)) {
|
||||
thumbnailClipHint.left = thumbnailData.insets.left;
|
||||
}
|
||||
if (TaskView.clipRight(dp)) {
|
||||
thumbnailClipHint.right = thumbnailData.insets.right;
|
||||
}
|
||||
if (TaskView.clipTop(dp)) {
|
||||
thumbnailClipHint.top = thumbnailData.insets.top;
|
||||
}
|
||||
if (TaskView.clipBottom(dp)) {
|
||||
thumbnailClipHint.bottom = thumbnailData.insets.bottom;
|
||||
}
|
||||
|
||||
float scale = thumbnailData.scale;
|
||||
final float thumbnailScale;
|
||||
|
||||
@@ -146,19 +146,39 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
public static final float MAX_PAGE_SCRIM_ALPHA = 0.4f;
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the status and navigation bars in recents. When this
|
||||
* is false the overview shows the whole screen scaled down instead.
|
||||
* Should the TaskView display clip off the left inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipStatusAndNavBars(DeviceProfile deviceProfile) {
|
||||
return deviceProfile.isTaskbarPresentInApps;
|
||||
public static boolean clipLeft(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the top inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipTop(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the right inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipRight(DeviceProfile deviceProfile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView display clip off the bottom inset in RecentsView.
|
||||
*/
|
||||
public static boolean clipBottom(DeviceProfile deviceProfile) {
|
||||
return deviceProfile.isTablet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the TaskView scale down to fit whole thumbnail in fullscreen.
|
||||
*/
|
||||
public static boolean useFullThumbnail(DeviceProfile deviceProfile) {
|
||||
return deviceProfile.isTaskbarPresentInApps;
|
||||
};
|
||||
return deviceProfile.isTablet && !deviceProfile.isTaskbarPresentInApps;
|
||||
}
|
||||
|
||||
private static final float EDGE_SCALE_DOWN_FACTOR_CAROUSEL = 0.03f;
|
||||
private static final float EDGE_SCALE_DOWN_FACTOR_GRID = 0.00f;
|
||||
|
||||
Reference in New Issue
Block a user