mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 16:07:30 +00:00
Merge pull request #1352 from rugveddarwhekar/master
Fixed #1085 | Video call auto rotate, when auto rotate is disabled
This commit is contained in:
commit
a0e6167718
@ -21,6 +21,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.isActive
|
import kotlinx.coroutines.isActive
|
||||||
|
import android.provider.Settings
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import network.loki.messenger.databinding.ActivityWebrtcBinding
|
import network.loki.messenger.databinding.ActivityWebrtcBinding
|
||||||
@ -100,7 +101,14 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||||
super.onCreate(savedInstanceState, ready)
|
super.onCreate(savedInstanceState, ready)
|
||||||
rotationListener.enable()
|
|
||||||
|
// Only enable auto-rotate if system auto-rotate is enabled
|
||||||
|
if (isAutoRotateOn()) {
|
||||||
|
rotationListener.enable()
|
||||||
|
} else {
|
||||||
|
rotationListener.disable()
|
||||||
|
}
|
||||||
|
|
||||||
binding = ActivityWebrtcBinding.inflate(layoutInflater)
|
binding = ActivityWebrtcBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
@ -185,6 +193,14 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Function to check if Android System Auto-rotate is on or off
|
||||||
|
private fun isAutoRotateOn(): Boolean {
|
||||||
|
return Settings.System.getInt(
|
||||||
|
contentResolver,
|
||||||
|
Settings.System.ACCELEROMETER_ROTATION, 0
|
||||||
|
) == 1
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
hangupReceiver?.let { receiver ->
|
hangupReceiver?.let { receiver ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user