Fix Video call screen bottom sheet weird animation and height.

This commit is contained in:
Sagar
2025-04-17 17:33:21 +05:30
committed by Cody Henthorne
parent 2e50699a2d
commit cd838c4bee
2 changed files with 8 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ import androidx.constraintlayout.widget.ConstraintSet
import androidx.constraintlayout.widget.Guideline import androidx.constraintlayout.widget.Guideline
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.transition.AutoTransition import androidx.transition.AutoTransition
import androidx.transition.TransitionManager import androidx.transition.TransitionManager
import androidx.transition.TransitionSet import androidx.transition.TransitionSet
@@ -108,6 +109,7 @@ class ControlsAndInfoController private constructor(
private val raiseHandComposeView: ComposeView = webRtcCallView.findViewById(R.id.call_screen_raise_hand_view) private val raiseHandComposeView: ComposeView = webRtcCallView.findViewById(R.id.call_screen_raise_hand_view)
private val aboveControlsGuideline: Guideline = webRtcCallView.findViewById(R.id.call_screen_above_controls_guideline) private val aboveControlsGuideline: Guideline = webRtcCallView.findViewById(R.id.call_screen_above_controls_guideline)
private val toggleCameraDirectionView: View = webRtcCallView.findViewById(R.id.call_screen_camera_direction_toggle) private val toggleCameraDirectionView: View = webRtcCallView.findViewById(R.id.call_screen_camera_direction_toggle)
private val startCallControls: View = webRtcCallView.findViewById(R.id.call_screen_start_call_controls)
private val callControls: ConstraintLayout = webRtcCallView.findViewById(R.id.call_controls_constraint_layout) private val callControls: ConstraintLayout = webRtcCallView.findViewById(R.id.call_controls_constraint_layout)
private val isLandscape = activity.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE private val isLandscape = activity.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
private val waitingToBeLetInProgressDrawable = IndeterminateDrawable.createCircularDrawable( private val waitingToBeLetInProgressDrawable = IndeterminateDrawable.createCircularDrawable(
@@ -160,7 +162,11 @@ class ControlsAndInfoController private constructor(
previousCallControlHeightData = HeightData(callControls.height, coordinator.height) previousCallControlHeightData = HeightData(callControls.height, coordinator.height)
val controlPeakHeight = callControls.height + callControls.y.toInt() + 16.dp val controlPeakHeight = callControls.height + callControls.y.toInt() + 16.dp
if (startCallControls.isVisible) {
behavior.peekHeight = max(behavior.peekHeight, controlPeakHeight)
} else {
behavior.peekHeight = controlPeakHeight behavior.peekHeight = controlPeakHeight
}
frame.minimumHeight = coordinator.height / minFrameHeightDenominator frame.minimumHeight = coordinator.height / minFrameHeightDenominator
behavior.maxHeight = (coordinator.height.toFloat() * maxBehaviorHeightPercentage).toInt() behavior.maxHeight = (coordinator.height.toFloat() * maxBehaviorHeightPercentage).toInt()
@@ -199,7 +205,6 @@ class ControlsAndInfoController private constructor(
behavior.isHideable = true behavior.isHideable = true
behavior.peekHeight = 0 behavior.peekHeight = 0
behavior.state = BottomSheetBehavior.STATE_HIDDEN
BottomSheetBehaviorHack.setNestedScrollingChild(behavior, callInfoComposeView) BottomSheetBehaviorHack.setNestedScrollingChild(behavior, callInfoComposeView)
behavior.addBottomSheetCallback(object : BottomSheetCallback() { behavior.addBottomSheetCallback(object : BottomSheetCallback() {

View File

@@ -148,8 +148,7 @@
android:id="@+id/call_controls_constraint_layout" android:id="@+id/call_controls_constraint_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="38dp" android:layout_marginTop="38dp">
android:paddingBottom="48dp">
<org.thoughtcrime.securesms.components.webrtc.WebRtcAudioOutputToggleButton <org.thoughtcrime.securesms.components.webrtc.WebRtcAudioOutputToggleButton
android:id="@+id/call_screen_speaker_toggle" android:id="@+id/call_screen_speaker_toggle"