mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-03-26 16:20:12 +01:00
Wait a little before stopping tone
This commit is contained in:
parent
c5aa7d6a91
commit
b80df57240
@ -1,6 +1,7 @@
|
||||
package com.simplemobiletools.dialer.helpers
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Handler
|
||||
import android.telecom.Call
|
||||
import android.telecom.InCallService
|
||||
import android.telecom.VideoProfile
|
||||
@ -169,7 +170,9 @@ class CallManager {
|
||||
|
||||
fun keypad(c: Char) {
|
||||
call?.playDtmfTone(c)
|
||||
call?.stopDtmfTone()
|
||||
Handler().postDelayed({
|
||||
call?.stopDtmfTone()
|
||||
}, DIALPAD_TONE_LENGTH_MS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,3 +24,5 @@ val tabsList = arrayListOf(TAB_CONTACTS, TAB_FAVORITES, TAB_CALL_HISTORY)
|
||||
private const val PATH = "com.simplemobiletools.dialer.action."
|
||||
const val ACCEPT_CALL = PATH + "accept_call"
|
||||
const val DECLINE_CALL = PATH + "decline_call"
|
||||
|
||||
const val DIALPAD_TONE_LENGTH_MS = 150L // The length of DTMF tones in milliseconds
|
||||
|
@ -14,7 +14,7 @@ class ToneGeneratorHelper(context: Context) {
|
||||
|
||||
fun playTone(char: Char) = playTone(charToTone[char] ?: -1)
|
||||
|
||||
fun playTone(tone: Int, durationMs: Int = TONE_LENGTH_MS) {
|
||||
fun playTone(tone: Int, durationMs: Int = DIALPAD_TONE_LENGTH_MS.toInt()) {
|
||||
if (tone != -1 && !isSilent) {
|
||||
toneGenerator.stopTone()
|
||||
toneGenerator.startTone(tone, durationMs)
|
||||
@ -22,7 +22,6 @@ class ToneGeneratorHelper(context: Context) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TONE_LENGTH_MS = 150 // The length of DTMF tones in milliseconds
|
||||
const val TONE_RELATIVE_VOLUME = 80 // The DTMF tone volume relative to other sounds in the stream
|
||||
const val DIAL_TONE_STREAM_TYPE = STREAM_DTMF
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user