From cea4adb5c2ebbce4ccea436865c751d8f6ed3a41 Mon Sep 17 00:00:00 2001 From: Sascha Werth <10984293+Honk2@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:30:14 +0200 Subject: [PATCH] feat: add backspace button to dialpad (#291) Added Delete buton to the right Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com> --- .../fossify/phone/activities/CallActivity.kt | 14 ++++++++++- app/src/main/res/layout/activity_call.xml | 25 +++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/phone/activities/CallActivity.kt b/app/src/main/kotlin/org/fossify/phone/activities/CallActivity.kt index 412f9e9a..a78457b3 100644 --- a/app/src/main/kotlin/org/fossify/phone/activities/CallActivity.kt +++ b/app/src/main/kotlin/org/fossify/phone/activities/CallActivity.kt @@ -13,6 +13,7 @@ import android.os.Looper import android.os.PowerManager import android.telecom.Call import android.telecom.CallAudioState +import android.view.KeyEvent import android.view.MotionEvent import android.view.View import android.view.WindowManager @@ -216,6 +217,8 @@ class CallActivity : SimpleActivity() { dialpad0Holder.setOnLongClickListener { dialpadPressed('+'); true } dialpadAsteriskHolder.setOnClickListener { dialpadPressed('*') } dialpadHashtagHolder.setOnClickListener { dialpadPressed('#') } + dialpadClearChar.setOnClickListener { clearChar(it) } + dialpadClearChar.setOnLongClickListener { clearInput() } } dialpadWrapper.setBackgroundColor( @@ -226,7 +229,7 @@ class CallActivity : SimpleActivity() { } ) - arrayOf(dialpadClose, callSimImage).forEach { + arrayOf(dialpadClose, callSimImage, dialpadClearChar).forEach { it.applyColorFilter(getProperTextColor()) } @@ -877,4 +880,13 @@ class CallActivity : SimpleActivity() { view.applyColorFilter(getProperBackgroundColor().getContrastColor()) } } + + private fun clearChar(view: View) { + binding.dialpadInput.dispatchKeyEvent(binding.dialpadInput.getKeyEvent(KeyEvent.KEYCODE_DEL)) + } + + private fun clearInput(): Boolean { + binding.dialpadInput.setText(""); + return true; + } } diff --git a/app/src/main/res/layout/activity_call.xml b/app/src/main/res/layout/activity_call.xml index 203df030..d09bec1d 100644 --- a/app/src/main/res/layout/activity_call.xml +++ b/app/src/main/res/layout/activity_call.xml @@ -446,13 +446,29 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + android:src="@drawable/ic_clear_vector" />