Improved handling of speakerphone
This commit is contained in:
@@ -362,11 +362,6 @@ class BaresipService: Service() {
|
|||||||
updateStatusNotification()
|
updateStatusNotification()
|
||||||
}
|
}
|
||||||
|
|
||||||
"SetSpeaker" -> {
|
|
||||||
Log.d(LOG_TAG, "Set speakerphone $speakerPhone")
|
|
||||||
am.isSpeakerphoneOn = speakerPhone
|
|
||||||
}
|
|
||||||
|
|
||||||
"Stop", "Stop Force" -> {
|
"Stop", "Stop Force" -> {
|
||||||
if (!isServiceClean) cleanService()
|
if (!isServiceClean) cleanService()
|
||||||
if (isServiceRunning) baresipStop(action == "Stop Force")
|
if (isServiceRunning) baresipStop(action == "Stop Force")
|
||||||
@@ -686,15 +681,13 @@ class BaresipService: Service() {
|
|||||||
resetCallVolume()
|
resetCallVolume()
|
||||||
if (am.mode != AudioManager.MODE_NORMAL)
|
if (am.mode != AudioManager.MODE_NORMAL)
|
||||||
am.mode = AudioManager.MODE_NORMAL
|
am.mode = AudioManager.MODE_NORMAL
|
||||||
if (am.isSpeakerphoneOn) am.isSpeakerphoneOn = false
|
am.isSpeakerphoneOn = false
|
||||||
if (am.isBluetoothScoOn) {
|
if (am.isBluetoothScoOn) {
|
||||||
Log.d(LOG_TAG, "Stopping Bluetooth SCO")
|
Log.d(LOG_TAG, "Stopping Bluetooth SCO")
|
||||||
am.stopBluetoothSco()
|
am.stopBluetoothSco()
|
||||||
} else {
|
} else {
|
||||||
abandonAudioFocus()
|
abandonAudioFocus()
|
||||||
}
|
}
|
||||||
speakerPhone = false
|
|
||||||
am.isSpeakerphoneOn = false
|
|
||||||
proximitySensing(false)
|
proximitySensing(false)
|
||||||
}
|
}
|
||||||
if (ua.account.callHistory && !call.hasHistory) {
|
if (ua.account.callHistory && !call.hasHistory) {
|
||||||
@@ -1140,7 +1133,6 @@ class BaresipService: Service() {
|
|||||||
var isConfigInitialized = false
|
var isConfigInitialized = false
|
||||||
var libraryLoaded = false
|
var libraryLoaded = false
|
||||||
var isServiceClean = false
|
var isServiceClean = false
|
||||||
var speakerPhone = false
|
|
||||||
var callVolume = 0
|
var callVolume = 0
|
||||||
var dynDns = false
|
var dynDns = false
|
||||||
var netInterface = ""
|
var netInterface = ""
|
||||||
|
|||||||
@@ -902,6 +902,10 @@ class MainActivity : AppCompatActivity() {
|
|||||||
menuInflater.inflate(R.menu.main_menu, menu)
|
menuInflater.inflate(R.menu.main_menu, menu)
|
||||||
menuInflater.inflate(R.menu.speaker_icon, menu)
|
menuInflater.inflate(R.menu.speaker_icon, menu)
|
||||||
speakerIcon = menu.findItem(R.id.speakerIcon)
|
speakerIcon = menu.findItem(R.id.speakerIcon)
|
||||||
|
if (am.isSpeakerphoneOn)
|
||||||
|
speakerIcon.setIcon(R.drawable.speaker_on)
|
||||||
|
else
|
||||||
|
speakerIcon.setIcon(R.drawable.speaker_off)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,13 +916,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
|
|
||||||
R.id.speakerIcon -> {
|
R.id.speakerIcon -> {
|
||||||
if (BaresipService.speakerPhone)
|
am.isSpeakerphoneOn = !am.isSpeakerphoneOn
|
||||||
item.setIcon(R.drawable.speaker_off)
|
if (am.isSpeakerphoneOn)
|
||||||
else
|
|
||||||
item.setIcon(R.drawable.speaker_on)
|
item.setIcon(R.drawable.speaker_on)
|
||||||
BaresipService.speakerPhone = !BaresipService.speakerPhone
|
else
|
||||||
baresipService.setAction("SetSpeaker")
|
item.setIcon(R.drawable.speaker_off)
|
||||||
startService(baresipService)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R.id.config -> {
|
R.id.config -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user