Added back full screen mode for call activity
This commit is contained in:
parent
b42b1f5910
commit
a57d7d4578
7 changed files with 72 additions and 3 deletions
|
@ -20,11 +20,14 @@
|
|||
package org.linphone.activities.call
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import kotlinx.coroutines.*
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
|
@ -83,7 +86,8 @@ class CallActivity : ProximitySensorActivity() {
|
|||
previewY = v.y - event.rawY
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
v.animate().x(event.rawX + previewX).y(event.rawY + previewY).setDuration(0).start()
|
||||
v.animate().x(event.rawX + previewX).y(event.rawY + previewY).setDuration(0)
|
||||
.start()
|
||||
}
|
||||
else -> {
|
||||
v.performClick()
|
||||
|
@ -109,6 +113,20 @@ class CallActivity : ProximitySensorActivity() {
|
|||
} else {
|
||||
coreContext.removeCallOverlay()
|
||||
}
|
||||
|
||||
if (corePreferences.fullScreenCallUI) {
|
||||
hideSystemUI()
|
||||
window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
|
||||
if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) {
|
||||
GlobalScope.launch {
|
||||
delay(2000)
|
||||
withContext(Dispatchers.Main) {
|
||||
hideSystemUI()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
@ -142,4 +160,21 @@ class CallActivity : ProximitySensorActivity() {
|
|||
viewModel.isVideoPreviewResizedForPip.value = isInPictureInPictureMode
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTheme(): Resources.Theme {
|
||||
val theme = super.getTheme()
|
||||
if (corePreferences.fullScreenCallUI) {
|
||||
theme.applyStyle(R.style.FullScreenTheme, true)
|
||||
}
|
||||
return theme
|
||||
}
|
||||
|
||||
private fun hideSystemUI() {
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import android.content.Intent
|
|||
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
||||
import android.os.Bundle
|
||||
import android.os.SystemClock
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.Display
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
|
@ -173,7 +175,11 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
|||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
val screenWidth = requireActivity().windowManager.defaultDisplay.width.toFloat()
|
||||
|
||||
val metrics = DisplayMetrics()
|
||||
val display: Display = requireActivity().getWindowManager().getDefaultDisplay()
|
||||
display.getRealMetrics(metrics)
|
||||
val screenWidth = metrics.widthPixels.toFloat()
|
||||
numpadAnimator = ValueAnimator.ofFloat(screenWidth, 0f).apply {
|
||||
addUpdateListener {
|
||||
val value = it.animatedValue as Float
|
||||
|
|
|
@ -59,6 +59,13 @@ class CallSettingsViewModel : GenericSettingsViewModel() {
|
|||
}
|
||||
val encryptionMandatory = MutableLiveData<Boolean>()
|
||||
|
||||
val fullScreenListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
prefs.fullScreenCallUI = newValue
|
||||
}
|
||||
}
|
||||
val fullScreen = MutableLiveData<Boolean>()
|
||||
|
||||
val overlayListener = object : SettingListenerStub() {
|
||||
override fun onBoolValueChanged(newValue: Boolean) {
|
||||
if (Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60)) {
|
||||
|
@ -146,6 +153,7 @@ class CallSettingsViewModel : GenericSettingsViewModel() {
|
|||
initEncryptionList()
|
||||
encryptionMandatory.value = core.isMediaEncryptionMandatory
|
||||
|
||||
fullScreen.value = prefs.fullScreenCallUI
|
||||
overlay.value = prefs.showCallOverlay
|
||||
sipInfoDtmf.value = core.useInfoForDtmf
|
||||
rfc2833Dtmf.value = core.useRfc2833ForDtmf
|
||||
|
|
|
@ -206,6 +206,12 @@ class CorePreferences constructor(private val context: Context) {
|
|||
config.setBool("app", "call_right_away", value)
|
||||
}
|
||||
|
||||
var fullScreenCallUI: Boolean
|
||||
get() = config.getBool("app", "full_screen_call", true)
|
||||
set(value) {
|
||||
config.setBool("app", "full_screen_call", value)
|
||||
}
|
||||
|
||||
/* Assistant */
|
||||
|
||||
var firstStart: Boolean
|
||||
|
|
|
@ -95,6 +95,12 @@
|
|||
linphone:checked="@={viewModel.encryptionMandatory}"
|
||||
linphone:enabled="@{viewModel.encryptionIndex != 0}"
|
||||
android:visibility="@{viewModel.encryptionIndex != 0 ? View.VISIBLE : View.GONE}"/>
|
||||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
linphone:title="@{@string/call_settings_full_screen_title}"
|
||||
linphone:subtitle="@{@string/call_settings_full_screen_summary}"
|
||||
linphone:listener="@{viewModel.fullScreenListener}"
|
||||
linphone:checked="@={viewModel.fullScreen}"/>
|
||||
|
||||
<include
|
||||
layout="@layout/settings_widget_switch"
|
||||
|
|
|
@ -381,6 +381,8 @@
|
|||
<string name="call_settings_media_encryption_dtls">DTLS</string>
|
||||
<string name="call_settings_encryption_mandatory_title">Media encryption mandatory</string>
|
||||
<string name="call_settings_encryption_mandatory_summary"></string>
|
||||
<string name="call_settings_full_screen_title">Full screen app while in call</string>
|
||||
<string name="call_settings_full_screen_summary">Hides status and navigation bars</string>
|
||||
<string name="call_settings_overlay_title">Overlay call notification</string>
|
||||
<string name="call_settings_overlay_summary">You will be asked to grant overlay permission</string>
|
||||
<string name="call_settings_sipinfo_dtmf_title">Send out-band DTMFs (SIP INFO)</string>
|
||||
|
|
|
@ -46,10 +46,16 @@
|
|||
<item name="button_background_drawable">@drawable/button_background_light</item>
|
||||
</style>
|
||||
|
||||
<style name="LauncherTheme" parent="AppTheme">
|
||||
<style name="LauncherTheme" parent="@style/AppTheme">
|
||||
<item name="android:windowBackground">@drawable/launch_screen</item>
|
||||
</style>
|
||||
|
||||
<style name="FullScreenTheme" parent="@style/AppTheme">
|
||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:windowTranslucentNavigation">true</item>
|
||||
</style>
|
||||
|
||||
<!-- Numpad -->
|
||||
|
||||
<style name="numpad_digit" parent="@android:style/TextAppearance.Medium">
|
||||
|
|
Loading…
Reference in a new issue