mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
toggle the microphone on icon click
This commit is contained in:
@ -23,6 +23,7 @@ class CallActivity : SimpleActivity() {
|
||||
private val CALL_NOTIFICATION_ID = 1
|
||||
|
||||
private var isSpeakerOn = false
|
||||
private var isMicrophoneOn = true
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
supportActionBar?.hide()
|
||||
@ -43,7 +44,10 @@ class CallActivity : SimpleActivity() {
|
||||
call_decline.setOnClickListener { }
|
||||
call_accept.setOnClickListener { }
|
||||
|
||||
call_toggle_microphone.setOnClickListener { }
|
||||
call_toggle_microphone.setOnClickListener {
|
||||
toggleMicrophone()
|
||||
}
|
||||
|
||||
call_toggle_speaker.setOnClickListener {
|
||||
toggleSpeaker()
|
||||
}
|
||||
@ -57,6 +61,12 @@ class CallActivity : SimpleActivity() {
|
||||
call_toggle_speaker.setImageDrawable(getDrawable(drawable))
|
||||
}
|
||||
|
||||
private fun toggleMicrophone() {
|
||||
isMicrophoneOn = !isMicrophoneOn
|
||||
val drawable = if (isMicrophoneOn) R.drawable.ic_microphone_vector else R.drawable.ic_microphone_off_vector
|
||||
call_toggle_microphone.setImageDrawable(getDrawable(drawable))
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private fun showNotification() {
|
||||
val channelId = "simple_contacts_call"
|
||||
|
Reference in New Issue
Block a user