diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PictureInPictureGestureHelper.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PictureInPictureGestureHelper.java index 229b9b3f2c..2ff05130c8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PictureInPictureGestureHelper.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/PictureInPictureGestureHelper.java @@ -16,7 +16,6 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.core.view.GestureDetectorCompat; -import org.signal.core.util.DimensionUnit; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.util.ViewUtil; import org.thoughtcrime.securesms.util.views.TouchInterceptingFrameLayout; @@ -25,10 +24,9 @@ import java.util.Arrays; public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestureListener { - private static final float DECELERATION_RATE = 0.99f; - private static final Interpolator FLING_INTERPOLATOR = new ViscousFluidInterpolator(); - private static final Interpolator ADJUST_INTERPOLATOR = new AccelerateDecelerateInterpolator(); - private static final int HORIZONTAL_PARTICIPANTS_CONTAINER_HEIGHT = (int) DimensionUnit.DP.toPixels(36); + private static final float DECELERATION_RATE = 0.99f; + private static final Interpolator FLING_INTERPOLATOR = new ViscousFluidInterpolator(); + private static final Interpolator ADJUST_INTERPOLATOR = new AccelerateDecelerateInterpolator(); private final ViewGroup parent; private final View child; @@ -36,7 +34,7 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu private int pipWidth; private int pipHeight; - private int activePointerId = MotionEvent.INVALID_POINTER_ID; + private int activePointerId = MotionEvent.INVALID_POINTER_ID; private float lastTouchX; private float lastTouchY; private int extraPaddingTop; @@ -47,10 +45,9 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu private int maximumFlingVelocity; private boolean isLockedToBottomEnd; private Interpolator interpolator; - private Corner currentCornerPosition = Corner.BOTTOM_RIGHT; - private int previousTopBoundary = -1; - private int previousBottomBoundary = -1; - private boolean displayBelowVerticalBoundary = false; + private Corner currentCornerPosition = Corner.BOTTOM_RIGHT; + private int previousTopBoundary = -1; + private int previousBottomBoundary = -1; @SuppressLint("ClickableViewAccessibility") public static PictureInPictureGestureHelper applyTo(@NonNull View child) { @@ -135,27 +132,9 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu extraPaddingBottom = parent.getMeasuredHeight() + parent.getTop() - bottomBoundary; - if (displayBelowVerticalBoundary) { - extraPaddingBottom -= (int) DimensionUnit.DP.toPixels(HORIZONTAL_PARTICIPANTS_CONTAINER_HEIGHT); - } - ViewUtil.setBottomMargin(child, extraPaddingBottom + framePadding); } - public void setDisplayBelowVerticalBoundary(boolean displayBelowVerticalBoundary) { - if (this.displayBelowVerticalBoundary == displayBelowVerticalBoundary) { - return; - } - - this.displayBelowVerticalBoundary = displayBelowVerticalBoundary; - - int bottomBoundary = previousBottomBoundary; - - previousBottomBoundary = -1; - - setBottomVerticalBoundary(bottomBoundary); - } - private boolean onGestureFinished(MotionEvent e) { final int pointerIndex = e.findPointerIndex(activePointerId); @@ -322,7 +301,7 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu * User drag is implemented by translating the view from the current gravity anchor (corner). When the user drags * to a new corner, we need to adjust the translations for the new corner so the animation of translation X/Y to 0 * works correctly. - *

+ * * For example, if in bottom right and need to move to top right, we need to calculate a new translation Y since instead * of being translated up from bottom it's translated down from the top. */ diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java index 4ec64e12ab..a720ba9d67 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/WebRtcCallView.java @@ -521,8 +521,6 @@ public class WebRtcCallView extends InsetAwareConstraintLayout { } } - pictureInPictureGestureHelper.setDisplayBelowVerticalBoundary(false); - switch (state) { case GONE: largeLocalRender.attachBroadcastVideoSink(null); @@ -543,7 +541,6 @@ public class WebRtcCallView extends InsetAwareConstraintLayout { largeLocalRender.attachBroadcastVideoSink(null); largeLocalRenderFrame.setVisibility(View.GONE); - pictureInPictureGestureHelper.setDisplayBelowVerticalBoundary(true); break; case LARGE: largeLocalRender.attachBroadcastVideoSink(localCallParticipant.getVideoSink());