show a dialpad at the call screen on button press

This commit is contained in:
tibbi 2020-05-01 21:04:47 +02:00
parent 33b5f6e1a3
commit 85123eba20
2 changed files with 37 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import com.simplemobiletools.commons.helpers.isOreoPlus
import com.simplemobiletools.commons.helpers.isQPlus import com.simplemobiletools.commons.helpers.isQPlus
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.extensions.audioManager 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.ACCEPT_CALL
import com.simplemobiletools.contacts.pro.helpers.CallManager import com.simplemobiletools.contacts.pro.helpers.CallManager
import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL
@ -77,7 +78,13 @@ class CallActivity : SimpleActivity() {
} }
override fun onBackPressed() { override fun onBackPressed() {
super.onBackPressed() if (dialpad_wrapper.isVisible()) {
dialpad_wrapper.beGone()
return
} else {
super.onBackPressed()
}
if (CallManager.getState() == Call.STATE_DIALING) { if (CallManager.getState() == Call.STATE_DIALING) {
endCall() endCall()
} }
@ -100,10 +107,15 @@ class CallActivity : SimpleActivity() {
toggleSpeaker() toggleSpeaker()
} }
call_dialpad.setOnClickListener { } call_dialpad.setOnClickListener {
toggleDialpadVisibility()
}
call_end.setOnClickListener { call_end.setOnClickListener {
endCall() endCall()
} }
dialpad_wrapper.setBackgroundColor(config.backgroundColor)
} }
private fun toggleSpeaker() { private fun toggleSpeaker() {
@ -120,6 +132,14 @@ class CallActivity : SimpleActivity() {
audioManager.isMicrophoneMute = !isMicrophoneOn audioManager.isMicrophoneMute = !isMicrophoneOn
} }
private fun toggleDialpadVisibility() {
if (dialpad_wrapper.isVisible()) {
dialpad_wrapper.beGone()
} else {
dialpad_wrapper.beVisible()
}
}
private fun updateOtherPersonsInfo() { private fun updateOtherPersonsInfo() {
if (callContact == null) { if (callContact == null) {
return return

View File

@ -44,8 +44,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ongoing_call_holder" android:id="@+id/ongoing_call_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:visibility="gone">
<ImageView <ImageView
android:id="@+id/call_toggle_microphone" android:id="@+id/call_toggle_microphone"
@ -156,4 +155,18 @@
app:layout_constraintTop_toBottomOf="@+id/call_accept" /> app:layout_constraintTop_toBottomOf="@+id/call_accept" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:id="@+id/dialpad_wrapper"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/activity_margin"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/call_status_label">
<include layout="@layout/dialpad" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>