mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Rotating controls on rotation
This commit is contained in:
parent
f9e9bc86d2
commit
f0c7621832
@ -275,6 +275,7 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity(), SensorEventLis
|
||||
if (currentOrientation != lastOrientation) {
|
||||
lastOrientation = currentOrientation
|
||||
viewModel.deviceOrientation = currentOrientation
|
||||
updateControlsRotation()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,15 +296,31 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity(), SensorEventLis
|
||||
ContextCompat.startForegroundService(this, answerIntent)
|
||||
}
|
||||
|
||||
private fun updateControlsRotation(newRotation: Int) {
|
||||
private fun updateControlsRotation() {
|
||||
with (binding) {
|
||||
val rotation = newRotation.toFloat()
|
||||
remoteRecipient.rotation = rotation
|
||||
speakerPhoneButton.rotation = rotation
|
||||
microphoneButton.rotation = rotation
|
||||
enableCameraButton.rotation = rotation
|
||||
switchCameraButton.rotation = rotation
|
||||
endCallButton.rotation = rotation
|
||||
val rotation = when(viewModel.deviceOrientation){
|
||||
Orientation.LANDSCAPE -> -90f
|
||||
Orientation.REVERSED_LANDSCAPE -> 90f
|
||||
else -> 0f
|
||||
}
|
||||
|
||||
remoteRecipient.animate().cancel()
|
||||
remoteRecipient.animate().rotation(rotation).start()
|
||||
|
||||
speakerPhoneButton.animate().cancel()
|
||||
speakerPhoneButton.animate().rotation(rotation).start()
|
||||
|
||||
microphoneButton.animate().cancel()
|
||||
microphoneButton.animate().rotation(rotation).start()
|
||||
|
||||
enableCameraButton.animate().cancel()
|
||||
enableCameraButton.animate().rotation(rotation).start()
|
||||
|
||||
switchCameraButton.animate().cancel()
|
||||
switchCameraButton.animate().rotation(rotation).start()
|
||||
|
||||
endCallButton.animate().cancel()
|
||||
endCallButton.animate().rotation(rotation).start()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user