mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-24 22:38:42 +02:00
toggle Speaker icon at the Call screen on click
This commit is contained in:
parent
b3aa539f52
commit
11e243f170
@ -22,6 +22,8 @@ import kotlinx.android.synthetic.main.activity_call.*
|
|||||||
class CallActivity : SimpleActivity() {
|
class CallActivity : SimpleActivity() {
|
||||||
private val CALL_NOTIFICATION_ID = 1
|
private val CALL_NOTIFICATION_ID = 1
|
||||||
|
|
||||||
|
private var isSpeakerOn = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
supportActionBar?.hide()
|
supportActionBar?.hide()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@ -42,10 +44,19 @@ class CallActivity : SimpleActivity() {
|
|||||||
call_accept.setOnClickListener { }
|
call_accept.setOnClickListener { }
|
||||||
|
|
||||||
call_toggle_microphone.setOnClickListener { }
|
call_toggle_microphone.setOnClickListener { }
|
||||||
call_toggle_speaker.setOnClickListener { }
|
call_toggle_speaker.setOnClickListener {
|
||||||
|
toggleSpeaker()
|
||||||
|
}
|
||||||
|
|
||||||
call_dialpad.setOnClickListener { }
|
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")
|
@SuppressLint("NewApi")
|
||||||
private fun showNotification() {
|
private fun showNotification() {
|
||||||
val channelId = "simple_contacts_call"
|
val channelId = "simple_contacts_call"
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
android:layout_height="@dimen/dialpad_button_size"
|
android:layout_height="@dimen/dialpad_button_size"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:padding="@dimen/medium_margin"
|
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_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user