Merge "Limit starting bounds of swipe to animation start rect" into tm-dev

This commit is contained in:
Vinit Nayak
2022-05-27 02:52:36 +00:00
committed by Android (Google) Code Review
4 changed files with 33 additions and 0 deletions

View File

@@ -102,6 +102,17 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
velocity.set(-oldY, oldX);
}
@Override
public void fixBoundsForHomeAnimStartRect(RectF outStartRect, DeviceProfile deviceProfile) {
// We don't need to check the "top" value here because the startRect is in the orientation
// of the app, not of the fixed portrait launcher.
if (outStartRect.left > deviceProfile.heightPx) {
outStartRect.offsetTo(0, outStartRect.top);
} else if (outStartRect.left < -deviceProfile.heightPx) {
outStartRect.offsetTo(0, outStartRect.top);
}
}
@Override
public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
action.call(target, 0, param);

View File

@@ -226,6 +226,12 @@ public interface PagedOrientationHandler {
*/
void adjustFloatingIconStartVelocity(PointF velocity);
/**
* Ensures that outStartRect left bound is within the DeviceProfile's visual boundaries
* @param outStartRect The start rect that will directly be modified
*/
void fixBoundsForHomeAnimStartRect(RectF outStartRect, DeviceProfile deviceProfile);
class ChildBounds {
public final int primaryDimension;

View File

@@ -101,6 +101,15 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
//no-op
}
@Override
public void fixBoundsForHomeAnimStartRect(RectF outStartRect, DeviceProfile deviceProfile) {
if (outStartRect.left > deviceProfile.widthPx) {
outStartRect.offsetTo(0, outStartRect.top);
} else if (outStartRect.left < -deviceProfile.widthPx) {
outStartRect.offsetTo(0, outStartRect.top);
}
}
@Override
public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
action.call(target, param, 0);