mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	toggle Speaker icon at the Call screen on click
This commit is contained in:
		| @@ -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" | ||||
|   | ||||
| @@ -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" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user