toggle Speaker icon at the Call screen on click

This commit is contained in:
tibbi 2020-04-30 21:58:09 +02:00
parent b3aa539f52
commit 11e243f170
2 changed files with 13 additions and 2 deletions

View File

@ -22,6 +22,8 @@ import kotlinx.android.synthetic.main.activity_call.*
class CallActivity : SimpleActivity() {
private val CALL_NOTIFICATION_ID = 1
private var isSpeakerOn = false
override fun onCreate(savedInstanceState: Bundle?) {
supportActionBar?.hide()
super.onCreate(savedInstanceState)
@ -42,10 +44,19 @@ class CallActivity : SimpleActivity() {
call_accept.setOnClickListener { }
call_toggle_microphone.setOnClickListener { }
call_toggle_speaker.setOnClickListener { }
call_toggle_speaker.setOnClickListener {
toggleSpeaker()
}
call_dialpad.setOnClickListener { }
}
private fun toggleSpeaker() {
isSpeakerOn = !isSpeakerOn
val drawable = if (isSpeakerOn) R.drawable.ic_speaker_on_vector else R.drawable.ic_speaker_off_vector
call_toggle_speaker.setImageDrawable(getDrawable(drawable))
}
@SuppressLint("NewApi")
private fun showNotification() {
val channelId = "simple_contacts_call"

View File

@ -66,7 +66,7 @@
android:layout_height="@dimen/dialpad_button_size"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_speaker_on_vector"
android:src="@drawable/ic_speaker_off_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"