Merge "Fix screenshot/clipboard swipe padding" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
be8c277af0
@@ -43,6 +43,7 @@ import com.android.systemui.R;
|
||||
*/
|
||||
public class DraggableConstraintLayout extends ConstraintLayout
|
||||
implements ViewTreeObserver.OnComputeInternalInsetsListener {
|
||||
public static final int SWIPE_PADDING_DP = 12; // extra padding around views to allow swipe
|
||||
|
||||
private static final float VELOCITY_DP_PER_MS = 1;
|
||||
private static final int MAXIMUM_DISMISS_DISTANCE_DP = 400;
|
||||
@@ -179,8 +180,13 @@ public class DraggableConstraintLayout extends ConstraintLayout
|
||||
Region r = new Region();
|
||||
Rect rect = new Rect();
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
getChildAt(i).getGlobalVisibleRect(rect);
|
||||
r.op(rect, Region.Op.UNION);
|
||||
View child = getChildAt(i);
|
||||
if (child.getVisibility() == View.VISIBLE) {
|
||||
child.getGlobalVisibleRect(rect);
|
||||
rect.inset((int) FloatingWindowUtil.dpToPx(mDisplayMetrics, -SWIPE_PADDING_DP),
|
||||
(int) FloatingWindowUtil.dpToPx(mDisplayMetrics, -SWIPE_PADDING_DP));
|
||||
r.op(rect, Region.Op.UNION);
|
||||
}
|
||||
}
|
||||
inoutInfo.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION);
|
||||
inoutInfo.touchableRegion.set(r);
|
||||
|
||||
@@ -68,7 +68,6 @@ import android.view.GestureDetector;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ScrollCaptureResponse;
|
||||
import android.view.TouchDelegate;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
@@ -123,7 +122,6 @@ public class ScreenshotView extends FrameLayout implements
|
||||
public static final long SCREENSHOT_ACTIONS_EXPANSION_DURATION_MS = 400;
|
||||
private static final long SCREENSHOT_ACTIONS_ALPHA_DURATION_MS = 100;
|
||||
private static final float SCREENSHOT_ACTIONS_START_SCALE_X = .7f;
|
||||
private static final int SWIPE_PADDING_DP = 12; // extra padding around views to allow swipe
|
||||
|
||||
private final Resources mResources;
|
||||
private final Interpolator mFastOutSlowIn;
|
||||
@@ -284,17 +282,22 @@ public class ScreenshotView extends FrameLayout implements
|
||||
Region swipeRegion = new Region();
|
||||
|
||||
final Rect tmpRect = new Rect();
|
||||
int swipePadding = (int) FloatingWindowUtil.dpToPx(
|
||||
mDisplayMetrics, DraggableConstraintLayout.SWIPE_PADDING_DP * -1);
|
||||
mScreenshotPreview.getBoundsOnScreen(tmpRect);
|
||||
tmpRect.inset((int) FloatingWindowUtil.dpToPx(mDisplayMetrics, -SWIPE_PADDING_DP),
|
||||
(int) FloatingWindowUtil.dpToPx(mDisplayMetrics, -SWIPE_PADDING_DP));
|
||||
tmpRect.inset(swipePadding, swipePadding);
|
||||
swipeRegion.op(tmpRect, Region.Op.UNION);
|
||||
mActionsContainerBackground.getBoundsOnScreen(tmpRect);
|
||||
tmpRect.inset((int) FloatingWindowUtil.dpToPx(mDisplayMetrics, -SWIPE_PADDING_DP),
|
||||
(int) FloatingWindowUtil.dpToPx(mDisplayMetrics, -SWIPE_PADDING_DP));
|
||||
tmpRect.inset(swipePadding, swipePadding);
|
||||
swipeRegion.op(tmpRect, Region.Op.UNION);
|
||||
mDismissButton.getBoundsOnScreen(tmpRect);
|
||||
swipeRegion.op(tmpRect, Region.Op.UNION);
|
||||
|
||||
View messageContainer = findViewById(R.id.screenshot_message_container);
|
||||
if (messageContainer != null) {
|
||||
messageContainer.getBoundsOnScreen(tmpRect);
|
||||
swipeRegion.op(tmpRect, Region.Op.UNION);
|
||||
}
|
||||
View messageDismiss = findViewById(R.id.message_dismiss_button);
|
||||
if (messageDismiss != null) {
|
||||
messageDismiss.getBoundsOnScreen(tmpRect);
|
||||
@@ -378,16 +381,6 @@ public class ScreenshotView extends FrameLayout implements
|
||||
mEditChip = requireNonNull(mActionsContainer.findViewById(R.id.screenshot_edit_chip));
|
||||
mScrollChip = requireNonNull(mActionsContainer.findViewById(R.id.screenshot_scroll_chip));
|
||||
|
||||
int swipePaddingPx = (int) FloatingWindowUtil.dpToPx(mDisplayMetrics, SWIPE_PADDING_DP);
|
||||
TouchDelegate previewDelegate = new TouchDelegate(
|
||||
new Rect(swipePaddingPx, swipePaddingPx, swipePaddingPx, swipePaddingPx),
|
||||
mScreenshotPreview);
|
||||
mScreenshotPreview.setTouchDelegate(previewDelegate);
|
||||
TouchDelegate actionsDelegate = new TouchDelegate(
|
||||
new Rect(swipePaddingPx, swipePaddingPx, swipePaddingPx, swipePaddingPx),
|
||||
mActionsContainerBackground);
|
||||
mActionsContainerBackground.setTouchDelegate(actionsDelegate);
|
||||
|
||||
setFocusable(true);
|
||||
mActionsContainer.setScrollX(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user