Try to respect in-app dialpad tone preference

This commit is contained in:
Naveen 2022-08-28 02:26:29 +05:30
parent b80df57240
commit 004515bc46
2 changed files with 11 additions and 5 deletions

View File

@ -364,7 +364,7 @@ class CallActivity : SimpleActivity() {
} }
private fun dialpadPressed(char: Char) { private fun dialpadPressed(char: Char) {
CallManager.keypad(char) CallManager.keypad(this, char)
dialpad_input.addCharacter(char) dialpad_input.addCharacter(char)
} }

View File

@ -1,10 +1,12 @@
package com.simplemobiletools.dialer.helpers package com.simplemobiletools.dialer.helpers
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler import android.os.Handler
import android.telecom.Call import android.telecom.Call
import android.telecom.InCallService import android.telecom.InCallService
import android.telecom.VideoProfile import android.telecom.VideoProfile
import com.simplemobiletools.dialer.extensions.config
import com.simplemobiletools.dialer.extensions.getStateCompat import com.simplemobiletools.dialer.extensions.getStateCompat
import com.simplemobiletools.dialer.extensions.hasCapability import com.simplemobiletools.dialer.extensions.hasCapability
import com.simplemobiletools.dialer.extensions.isConference import com.simplemobiletools.dialer.extensions.isConference
@ -168,11 +170,15 @@ class CallManager {
fun getState() = getPrimaryCall()?.getStateCompat() fun getState() = getPrimaryCall()?.getStateCompat()
fun keypad(c: Char) { fun keypad(context: Context, char: Char) {
call?.playDtmfTone(c) call?.playDtmfTone(char)
Handler().postDelayed({ if (context.config.dialpadBeeps) {
Handler().postDelayed({
call?.stopDtmfTone()
}, DIALPAD_TONE_LENGTH_MS)
} else {
call?.stopDtmfTone() call?.stopDtmfTone()
}, DIALPAD_TONE_LENGTH_MS) }
} }
} }
} }