Fix self-PIP boundaries in calls.
This commit is contained in:
parent
632aeed00b
commit
b646e69b6b
4 changed files with 18 additions and 29 deletions
|
@ -991,16 +991,6 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
|
|||
controlsAndInfo.toggleControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSystemUI() {
|
||||
fullscreenHelper.showSystemUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideSystemUI() {
|
||||
fullscreenHelper.hideSystemUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioOutputChanged(@NonNull WebRtcAudioOutput audioOutput) {
|
||||
maybeDisplaySpeakerphonePopup(audioOutput);
|
||||
|
|
|
@ -34,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;
|
||||
|
@ -45,7 +45,9 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu
|
|||
private int maximumFlingVelocity;
|
||||
private boolean isLockedToBottomEnd;
|
||||
private Interpolator interpolator;
|
||||
private Corner currentCornerPosition = Corner.BOTTOM_RIGHT;
|
||||
private Corner currentCornerPosition = Corner.BOTTOM_RIGHT;
|
||||
private int previousTopBoundary = -1;
|
||||
private int previousBottomBoundary = -1;
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public static PictureInPictureGestureHelper applyTo(@NonNull View child) {
|
||||
|
@ -109,12 +111,12 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu
|
|||
this.interpolator = ADJUST_INTERPOLATOR;
|
||||
}
|
||||
|
||||
public void clearVerticalBoundaries() {
|
||||
setTopVerticalBoundary(parent.getTop());
|
||||
setBottomVerticalBoundary(parent.getMeasuredHeight() + parent.getTop());
|
||||
}
|
||||
|
||||
public void setTopVerticalBoundary(int topBoundary) {
|
||||
if (topBoundary == previousTopBoundary) {
|
||||
return;
|
||||
}
|
||||
previousTopBoundary = topBoundary;
|
||||
|
||||
extraPaddingTop = topBoundary - parent.getTop();
|
||||
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
|
||||
|
@ -123,6 +125,11 @@ public class PictureInPictureGestureHelper extends GestureDetector.SimpleOnGestu
|
|||
}
|
||||
|
||||
public void setBottomVerticalBoundary(int bottomBoundary) {
|
||||
if (bottomBoundary == previousBottomBoundary) {
|
||||
return;
|
||||
}
|
||||
previousBottomBoundary = bottomBoundary;
|
||||
|
||||
extraPaddingBottom = parent.getMeasuredHeight() + parent.getTop() - bottomBoundary;
|
||||
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
|
||||
|
|
|
@ -379,15 +379,9 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
|
|||
@Override
|
||||
public void onWindowSystemUiVisibilityChanged(int visible) {
|
||||
if ((visible & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
|
||||
if (controls.adjustForFold()) {
|
||||
pictureInPictureGestureHelper.clearVerticalBoundaries();
|
||||
pictureInPictureGestureHelper.setTopVerticalBoundary(getPipBarrier().getTop());
|
||||
} else {
|
||||
pictureInPictureGestureHelper.setTopVerticalBoundary(getPipBarrier().getBottom());
|
||||
pictureInPictureGestureHelper.setBottomVerticalBoundary(findViewById(R.id.call_controls_info_parent).getTop());
|
||||
}
|
||||
pictureInPictureGestureHelper.setTopVerticalBoundary(collapsedToolbar.getBottom());
|
||||
} else {
|
||||
pictureInPictureGestureHelper.clearVerticalBoundaries();
|
||||
pictureInPictureGestureHelper.setTopVerticalBoundary(getStatusBarGuideline().getBottom());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -961,8 +955,6 @@ public class WebRtcCallView extends InsetAwareConstraintLayout {
|
|||
public interface ControlsListener {
|
||||
void onStartCall(boolean isVideoCall);
|
||||
void onCancelStartCall();
|
||||
void showSystemUI();
|
||||
void hideSystemUI();
|
||||
void onAudioOutputChanged(@NonNull WebRtcAudioOutput audioOutput);
|
||||
@RequiresApi(31)
|
||||
void onAudioOutputChanged31(@NonNull WebRtcAudioDevice audioOutput);
|
||||
|
|
|
@ -104,8 +104,8 @@ class ControlsAndInfoController(
|
|||
behavior.state = BottomSheetBehavior.STATE_HIDDEN
|
||||
BottomSheetBehaviorHack.setNestedScrollingChild(behavior, callInfoComposeView)
|
||||
|
||||
coordinator.addOnLayoutChangeListener { _, _, top, _, bottom, _, _, _, _ ->
|
||||
val guidelineTop = max(frame.top, (bottom - top) - behavior.peekHeight)
|
||||
coordinator.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->
|
||||
val guidelineTop = max(frame.top, coordinator.height - behavior.peekHeight)
|
||||
webRtcCallView.post { webRtcCallView.onControlTopChanged(guidelineTop) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue