toggle the microphone on icon click

This commit is contained in:
tibbi 2020-04-30 23:25:34 +02:00
parent 11e243f170
commit 7d2fa2743f
4 changed files with 21 additions and 32 deletions

View File

@ -57,7 +57,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.26.28'
implementation 'com.simplemobiletools:commons:5.26.33'
implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'

View File

@ -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"

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M19,11C19,11 19.0088,9.8569 18.1571,9.8714 17.362,9.885 17.3,11 17.3,11c0,0.74 -0.16,1.43 -0.43,2.05l1.23,1.23C18.66,13.3 19,12.19 19,11ZM14.98,11.17C14.98,11.11 15,11.06 15,11L15,5C15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5L9,5.18ZM4.27,3 L3,4.27l6.01,6.01 0,0.72c0,1.66 1.33,3 2.99,3 0.22,0 0.44,-0.03 0.65,-0.08l1.66,1.66C13.6,15.91 12.81,16.1 12,16.1 9.24,16.1 6.7,14 6.7,11 6.7,11 6.6686,9.9807 5.8435,9.992 5.0185,10.0033 5,11 5,11c0,3.41 2.72,6.23 6,6.72L11,21c0,0 -0.0013,1.036 1.0127,1.0169C12.9886,21.9987 13,21 13,21l0,-3.28c0.91,-0.13 1.77,-0.45 2.54,-0.9L19.73,21 21,19.73Z" />
</vector>

View File

@ -1,30 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="18dp"
android:height="18dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#ffffff"
android:pathData="m12,14c1.66,0 2.99,-1.34 2.99,-3L15,5C15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5l0,6c0,1.66 1.34,3 3,3zM17.3,11c0,3 -2.54,5.1 -5.3,5.1C9.24,16.1 6.7,14 6.7,11L5,11c0,3.41 2.72,6.23 6,6.72l0,3.2123 2,0L13,17.72c3.28,-0.48 6,-3.3 6,-6.72z" />
<path
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData="M5,11.0547a0.8516,0.9245 0,1 0,1.7031 0a0.8516,0.9245 0,1 0,-1.7031 0z"
android:strokeAlpha="1"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData="M17.293,11a0.8516,0.9245 0,1 0,1.7031 0a0.8516,0.9245 0,1 0,-1.7031 0z"
android:strokeAlpha="1"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData="M10.9992,20.9539a1,0.9245 0,1 0,2 0a1,0.9245 0,1 0,-2 0z"
android:strokeAlpha="1"
android:strokeColor="#00000000" />
</vector>