Added Proximity Sensing setting
This commit is contained in:
@ -519,7 +519,7 @@ class BaresipService: Service() {
|
|||||||
stopMediaPlayer()
|
stopMediaPlayer()
|
||||||
am.mode = MODE_IN_COMMUNICATION
|
am.mode = MODE_IN_COMMUNICATION
|
||||||
setCallVolume()
|
setCallVolume()
|
||||||
proximitySensing(true)
|
proximitySensing(proximitySensing)
|
||||||
Api.ua_answer(uap, callp, vidMode)
|
Api.ua_answer(uap, callp, vidMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +818,7 @@ class BaresipService: Service() {
|
|||||||
setCallVolume()
|
setCallVolume()
|
||||||
if (speakerPhone && !Utils.isSpeakerPhoneOn(am))
|
if (speakerPhone && !Utils.isSpeakerPhoneOn(am))
|
||||||
Utils.toggleSpeakerPhone(ContextCompat.getMainExecutor(this), am)
|
Utils.toggleSpeakerPhone(ContextCompat.getMainExecutor(this), am)
|
||||||
proximitySensing(true)
|
proximitySensing(proximitySensing)
|
||||||
}
|
}
|
||||||
"call ringing" -> {
|
"call ringing" -> {
|
||||||
playRingBack()
|
playRingBack()
|
||||||
@ -1715,6 +1715,7 @@ class BaresipService: Service() {
|
|||||||
var isMicMuted = false
|
var isMicMuted = false
|
||||||
var isRecOn = false
|
var isRecOn = false
|
||||||
var toneCountry = "us"
|
var toneCountry = "us"
|
||||||
|
var proximitySensing = true
|
||||||
|
|
||||||
val uas = mutableStateOf(emptyList<UserAgent>())
|
val uas = mutableStateOf(emptyList<UserAgent>())
|
||||||
val uasStatus = mutableStateOf(emptyMap<String, Int>())
|
val uasStatus = mutableStateOf(emptyMap<String, Int>())
|
||||||
|
|||||||
@ -126,6 +126,13 @@ object Config {
|
|||||||
"${config}colorblind no\n"
|
"${config}colorblind no\n"
|
||||||
BaresipService.colorblind = colorblind == "yes"
|
BaresipService.colorblind = colorblind == "yes"
|
||||||
|
|
||||||
|
val proximitySensing = previousVariable("proximity_sensing")
|
||||||
|
config = if (proximitySensing != "")
|
||||||
|
"${config}proximity_sensing $proximitySensing\n"
|
||||||
|
else
|
||||||
|
"${config}proximity_sensing yes\n"
|
||||||
|
BaresipService.proximitySensing = proximitySensing == "yes"
|
||||||
|
|
||||||
var contactsMode = previousVariable("contacts_mode").lowercase()
|
var contactsMode = previousVariable("contacts_mode").lowercase()
|
||||||
if (contactsMode != "") {
|
if (contactsMode != "") {
|
||||||
if (contactsMode != "baresip" &&
|
if (contactsMode != "baresip" &&
|
||||||
|
|||||||
@ -248,6 +248,8 @@ private var newDarkTheme = false
|
|||||||
|
|
||||||
private var newColorblind = false
|
private var newColorblind = false
|
||||||
|
|
||||||
|
private var newProximitySensing = true
|
||||||
|
|
||||||
private var newDefaultDialer = false
|
private var newDefaultDialer = false
|
||||||
|
|
||||||
private var newDebug = false
|
private var newDebug = false
|
||||||
@ -315,6 +317,7 @@ private fun SettingsContent(
|
|||||||
BatteryOptimizations()
|
BatteryOptimizations()
|
||||||
DarkTheme()
|
DarkTheme()
|
||||||
ColorBlind()
|
ColorBlind()
|
||||||
|
ProximitySensing()
|
||||||
if (VERSION.SDK_INT >= 29)
|
if (VERSION.SDK_INT >= 29)
|
||||||
DefaultDialer()
|
DefaultDialer()
|
||||||
Debug()
|
Debug()
|
||||||
@ -1095,6 +1098,7 @@ private fun DarkTheme() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColorBlind() {
|
private fun ColorBlind() {
|
||||||
Row(
|
Row(
|
||||||
@ -1126,6 +1130,39 @@ private fun ColorBlind() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Composable
|
||||||
|
private fun ProximitySensing() {
|
||||||
|
Row(
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(end = 10.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.Start
|
||||||
|
) {
|
||||||
|
val ctx = LocalContext.current
|
||||||
|
Text(text = stringResource(R.string.proximity_sensing),
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.clickable {
|
||||||
|
alertTitle.value = ctx.getString(R.string.proximity_sensing)
|
||||||
|
alertMessage.value = ctx.getString(R.string.proximity_sensing_help)
|
||||||
|
showAlert.value = true
|
||||||
|
},
|
||||||
|
color = LocalCustomColors.current.itemText,
|
||||||
|
fontSize = 18.sp)
|
||||||
|
var proximitySensing by remember {
|
||||||
|
mutableStateOf(Config.variable("proximity_sensing") == "yes")
|
||||||
|
}
|
||||||
|
newProximitySensing = proximitySensing
|
||||||
|
Switch(
|
||||||
|
checked = proximitySensing,
|
||||||
|
onCheckedChange = {
|
||||||
|
proximitySensing= it
|
||||||
|
newProximitySensing = proximitySensing
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequiresApi(29)
|
@RequiresApi(29)
|
||||||
@Composable
|
@Composable
|
||||||
@ -1423,6 +1460,15 @@ private fun checkOnClick(ctx: Context) {
|
|||||||
save = true
|
save = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((Config.variable("proximity_sensing") == "yes") != newProximitySensing) {
|
||||||
|
Config.replaceVariable(
|
||||||
|
"proximity_sensing",
|
||||||
|
if (newProximitySensing) "yes" else "no"
|
||||||
|
)
|
||||||
|
BaresipService.proximitySensing = newProximitySensing
|
||||||
|
save = true
|
||||||
|
}
|
||||||
|
|
||||||
if ((Config.variable("log_level") == "0") != newDebug) {
|
if ((Config.variable("log_level") == "0") != newDebug) {
|
||||||
val logLevelString = if (newDebug) "0" else "2"
|
val logLevelString = if (newDebug) "0" else "2"
|
||||||
Config.replaceVariable("log_level", logLevelString)
|
Config.replaceVariable("log_level", logLevelString)
|
||||||
|
|||||||
@ -418,6 +418,9 @@
|
|||||||
<string name="dark_theme_help">Käytä aina tummaa näyttöteemaa</string>
|
<string name="dark_theme_help">Käytä aina tummaa näyttöteemaa</string>
|
||||||
<string name="colorblind">Värisokea</string>
|
<string name="colorblind">Värisokea</string>
|
||||||
<string name="colorblind_help">Käytä värisokealle ystävällisiä rekisteröintitilaikoineita</string>
|
<string name="colorblind_help">Käytä värisokealle ystävällisiä rekisteröintitilaikoineita</string>
|
||||||
|
<string name="proximity_sensing">Läheisyyden tunnistus</string>">
|
||||||
|
<string name="proximity_sensing_help">Jos merkitty, läheisyyden tunnistus aktivoidaan
|
||||||
|
puhelun aikana.</string>
|
||||||
<string name="video_size">Videon kehyskoko</string>
|
<string name="video_size">Videon kehyskoko</string>
|
||||||
<string name="video_size_help">Lähetettävän videon kehyskoko (leveys x korkeus)</string>
|
<string name="video_size_help">Lähetettävän videon kehyskoko (leveys x korkeus)</string>
|
||||||
<string name="video_fps">Videokehysten lähetystaajuus</string>
|
<string name="video_fps">Videokehysten lähetystaajuus</string>
|
||||||
|
|||||||
@ -389,6 +389,8 @@
|
|||||||
<string name="dark_theme_help">Force dark display theme</string>
|
<string name="dark_theme_help">Force dark display theme</string>
|
||||||
<string name="colorblind">Colorblind</string>
|
<string name="colorblind">Colorblind</string>
|
||||||
<string name="colorblind_help">Use colorblind friendly registration status icons</string>
|
<string name="colorblind_help">Use colorblind friendly registration status icons</string>
|
||||||
|
<string name="proximity_sensing">Proximity Sensing</string>">
|
||||||
|
<string name="proximity_sensing_help">If checked, proximity sensing is enabled during calls.</string>
|
||||||
<string name="video_size">Video Frame Size</string>
|
<string name="video_size">Video Frame Size</string>
|
||||||
<string name="video_size_help">Size of transmitted video frames (width x height)</string>
|
<string name="video_size_help">Size of transmitted video frames (width x height)</string>
|
||||||
<string name="video_fps">Video Frames Per Second</string>
|
<string name="video_fps">Video Frames Per Second</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user