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