mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-28 04:34:21 +01:00
Fix call controls disappearing when returning from system pip.
This commit is contained in:
committed by
Nicholas Tinsley
parent
27812bb1ec
commit
7d81ed1150
@@ -97,7 +97,7 @@ class ControlsAndInfoController(
|
|||||||
private val handler: Handler?
|
private val handler: Handler?
|
||||||
get() = webRtcCallView.handler
|
get() = webRtcCallView.handler
|
||||||
|
|
||||||
private var previousCallControlHeight = 0
|
private var previousCallControlHeightData = HeightData()
|
||||||
private var controlPeakHeight = 0
|
private var controlPeakHeight = 0
|
||||||
private var controlState: WebRtcControls = WebRtcControls.NONE
|
private var controlState: WebRtcControls = WebRtcControls.NONE
|
||||||
|
|
||||||
@@ -152,8 +152,9 @@ class ControlsAndInfoController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
callControls.viewTreeObserver.addOnGlobalLayoutListener {
|
callControls.viewTreeObserver.addOnGlobalLayoutListener {
|
||||||
if (callControls.height > 0 && callControls.height != previousCallControlHeight) {
|
if (callControls.height > 0 && previousCallControlHeightData.hasChanged(callControls.height, coordinator.height)) {
|
||||||
previousCallControlHeight = callControls.height
|
previousCallControlHeightData = HeightData(callControls.height, coordinator.height)
|
||||||
|
|
||||||
controlPeakHeight = callControls.height + callControls.y.toInt()
|
controlPeakHeight = callControls.height + callControls.y.toInt()
|
||||||
behavior.peekHeight = controlPeakHeight
|
behavior.peekHeight = controlPeakHeight
|
||||||
frame.minimumHeight = coordinator.height / 2
|
frame.minimumHeight = coordinator.height / 2
|
||||||
@@ -456,6 +457,15 @@ class ControlsAndInfoController(
|
|||||||
displayEndCall() != previousState.displayEndCall()
|
displayEndCall() != previousState.displayEndCall()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private data class HeightData(
|
||||||
|
val controlHeight: Int = 0,
|
||||||
|
val coordinatorHeight: Int = 0
|
||||||
|
) {
|
||||||
|
fun hasChanged(controlHeight: Int, coordinatorHeight: Int): Boolean {
|
||||||
|
return controlHeight != this.controlHeight || coordinatorHeight != this.coordinatorHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface BottomSheetVisibilityListener {
|
interface BottomSheetVisibilityListener {
|
||||||
fun onShown()
|
fun onShown()
|
||||||
fun onHidden()
|
fun onHidden()
|
||||||
|
|||||||
Reference in New Issue
Block a user