mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +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) {
|
if (currentOrientation != lastOrientation) {
|
||||||
lastOrientation = currentOrientation
|
lastOrientation = currentOrientation
|
||||||
viewModel.deviceOrientation = currentOrientation
|
viewModel.deviceOrientation = currentOrientation
|
||||||
|
updateControlsRotation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,15 +296,31 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity(), SensorEventLis
|
|||||||
ContextCompat.startForegroundService(this, answerIntent)
|
ContextCompat.startForegroundService(this, answerIntent)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateControlsRotation(newRotation: Int) {
|
private fun updateControlsRotation() {
|
||||||
with (binding) {
|
with (binding) {
|
||||||
val rotation = newRotation.toFloat()
|
val rotation = when(viewModel.deviceOrientation){
|
||||||
remoteRecipient.rotation = rotation
|
Orientation.LANDSCAPE -> -90f
|
||||||
speakerPhoneButton.rotation = rotation
|
Orientation.REVERSED_LANDSCAPE -> 90f
|
||||||
microphoneButton.rotation = rotation
|
else -> 0f
|
||||||
enableCameraButton.rotation = rotation
|
}
|
||||||
switchCameraButton.rotation = rotation
|
|
||||||
endCallButton.rotation = rotation
|
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