Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement #274 #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/src/main/kotlin/org/fossify/phone/activities/CallActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -226,7 +229,7 @@ class CallActivity : SimpleActivity() {
}
)

arrayOf(dialpadClose, callSimImage).forEach {
arrayOf(dialpadClose, callSimImage, dialpadClearChar).forEach {
it.applyColorFilter(getProperTextColor())
}

Expand Down Expand Up @@ -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;
}
}
25 changes: 20 additions & 5 deletions app/src/main/res/layout/activity_call.xml
Original file line number Diff line number Diff line change
Expand Up @@ -446,21 +446,37 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ImageView
android:id="@+id/dialpad_close"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:layout_alignTop="@+id/dialpad_input"
android:layout_alignBottom="@+id/dialpad_input"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/activity_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/hide_dialpad"
android:elevation="@dimen/medium_margin"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_cross_vector" />

<org.fossify.commons.views.MyEditText
android:id="@+id/dialpad_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dialpad_button_size"
android:layout_marginStart="@dimen/medium_margin"
android:layout_marginEnd="@dimen/medium_margin"
android:layout_toStartOf="@+id/dialpad_close"
android:layout_toEndOf="@id/dialpad_close"
android:layout_toStartOf="@+id/dialpad_clear_char"
android:gravity="center"
android:inputType="phone"
android:textCursorDrawable="@null"
android:textSize="@dimen/dialpad_text_size"
tools:ignore="SpUsage" />

<ImageView
android:id="@+id/dialpad_close"
android:id="@+id/dialpad_clear_char"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:layout_alignTop="@+id/dialpad_input"
Expand All @@ -469,10 +485,9 @@
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/activity_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/hide_dialpad"
android:elevation="@dimen/medium_margin"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_cross_vector" />
android:src="@drawable/ic_clear_vector" />

</RelativeLayout>

Expand Down
Loading