From 85123eba2010cc4ebb4645d871b3ab6f12e1d1cd Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 May 2020 21:04:47 +0200 Subject: [PATCH] show a dialpad at the call screen on button press --- .../contacts/pro/activities/CallActivity.kt | 24 +++++++++++++++++-- app/src/main/res/layout/activity_call.xml | 17 +++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/CallActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/CallActivity.kt index 2f6a19c6..86c4c9f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/CallActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/CallActivity.kt @@ -23,6 +23,7 @@ import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.commons.helpers.isQPlus import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.extensions.audioManager +import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.helpers.ACCEPT_CALL import com.simplemobiletools.contacts.pro.helpers.CallManager import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL @@ -77,7 +78,13 @@ class CallActivity : SimpleActivity() { } override fun onBackPressed() { - super.onBackPressed() + if (dialpad_wrapper.isVisible()) { + dialpad_wrapper.beGone() + return + } else { + super.onBackPressed() + } + if (CallManager.getState() == Call.STATE_DIALING) { endCall() } @@ -100,10 +107,15 @@ class CallActivity : SimpleActivity() { toggleSpeaker() } - call_dialpad.setOnClickListener { } + call_dialpad.setOnClickListener { + toggleDialpadVisibility() + } + call_end.setOnClickListener { endCall() } + + dialpad_wrapper.setBackgroundColor(config.backgroundColor) } private fun toggleSpeaker() { @@ -120,6 +132,14 @@ class CallActivity : SimpleActivity() { audioManager.isMicrophoneMute = !isMicrophoneOn } + private fun toggleDialpadVisibility() { + if (dialpad_wrapper.isVisible()) { + dialpad_wrapper.beGone() + } else { + dialpad_wrapper.beVisible() + } + } + private fun updateOtherPersonsInfo() { if (callContact == null) { return diff --git a/app/src/main/res/layout/activity_call.xml b/app/src/main/res/layout/activity_call.xml index 2ea273c9..50caf158 100644 --- a/app/src/main/res/layout/activity_call.xml +++ b/app/src/main/res/layout/activity_call.xml @@ -44,8 +44,7 @@ + android:layout_height="match_parent"> + + + + + + +