Fix bad sheet behavior when returning from system pip.
This commit is contained in:
parent
62b5276c75
commit
6678fdcbe9
1 changed files with 23 additions and 9 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
package org.thoughtcrime.securesms.components.webrtc.controls
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
|
@ -201,22 +202,35 @@ class ControlsAndInfoController private constructor(
|
|||
BottomSheetBehaviorHack.setNestedScrollingChild(behavior, callInfoComposeView)
|
||||
|
||||
behavior.addBottomSheetCallback(object : BottomSheetCallback() {
|
||||
@SuppressLint("SwitchIntDef")
|
||||
override fun onStateChanged(bottomSheet: View, newState: Int) {
|
||||
overflowPopupWindow.dismiss()
|
||||
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
|
||||
controlsAndInfoViewModel.resetScrollState()
|
||||
if (controlState.isFadeOutEnabled) {
|
||||
hide(delay = HIDE_CONTROL_DELAY)
|
||||
when (newState) {
|
||||
BottomSheetBehavior.STATE_COLLAPSED -> {
|
||||
controlsAndInfoViewModel.resetScrollState()
|
||||
if (controlState.isFadeOutEnabled) {
|
||||
hide(delay = HIDE_CONTROL_DELAY)
|
||||
}
|
||||
updateCallSheetVisibilities(0f)
|
||||
}
|
||||
BottomSheetBehavior.STATE_EXPANDED -> {
|
||||
cancelScheduledHide()
|
||||
updateCallSheetVisibilities(1f)
|
||||
}
|
||||
BottomSheetBehavior.STATE_DRAGGING -> {
|
||||
cancelScheduledHide()
|
||||
}
|
||||
BottomSheetBehavior.STATE_HIDDEN -> {
|
||||
controlsAndInfoViewModel.resetScrollState()
|
||||
updateCallSheetVisibilities(-1f)
|
||||
}
|
||||
} else if (newState == BottomSheetBehavior.STATE_EXPANDED || newState == BottomSheetBehavior.STATE_DRAGGING) {
|
||||
cancelScheduledHide()
|
||||
} else if (newState == BottomSheetBehavior.STATE_HIDDEN) {
|
||||
controlsAndInfoViewModel.resetScrollState()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSlide(bottomSheet: View, slideOffset: Float) {
|
||||
updateCallSheetVisibilities(slideOffset)
|
||||
if (slideOffset <= 1 || slideOffset >= -1) {
|
||||
updateCallSheetVisibilities(slideOffset)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue