mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-02 12:30:47 +02:00
lets actually remove the callers number if we know his name
This commit is contained in:
parent
2a0cbe9b4f
commit
6be6b546f5
@ -107,8 +107,6 @@ class CallActivity : SimpleActivity() {
|
||||
|
||||
val callContact = CallManager.getCallContact(applicationContext) ?: return
|
||||
caller_name_label.text = if (callContact.name.isNotEmpty()) callContact.name else getString(R.string.unknown_caller)
|
||||
caller_number_label.text = callContact.number
|
||||
caller_number_label.beVisibleIf(callContact.number.isNotEmpty())
|
||||
|
||||
if (callContactAvatar != null) {
|
||||
caller_avatar.setImageBitmap(callContactAvatar)
|
||||
@ -196,7 +194,7 @@ class CallActivity : SimpleActivity() {
|
||||
val declinePendingIntent = PendingIntent.getBroadcast(this, 1, declineCallIntent, PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
|
||||
val callerName = if (callContact != null && callContact!!.name.isNotEmpty()) callContact!!.name else getString(R.string.unknown_caller)
|
||||
val contentText = "${getString(R.string.incoming_call)} ${callContact?.number ?: ""}"
|
||||
val contentText = getString(R.string.incoming_call)
|
||||
|
||||
val collapsedView = RemoteViews(packageName, R.layout.call_notification).apply {
|
||||
setText(R.id.notification_caller_name, callerName)
|
||||
|
@ -46,7 +46,7 @@ class CallManager {
|
||||
}
|
||||
|
||||
fun getCallContact(context: Context): CallContact? {
|
||||
val callContact = CallContact("", "", "")
|
||||
val callContact = CallContact("", "")
|
||||
if (call == null) {
|
||||
return callContact
|
||||
}
|
||||
@ -54,16 +54,10 @@ class CallManager {
|
||||
val uri = Uri.decode(call!!.details.handle.toString())
|
||||
if (uri.startsWith("tel:")) {
|
||||
val number = uri.substringAfter("tel:")
|
||||
callContact.number = number
|
||||
callContact.name = context.getNameFromPhoneNumber(number)
|
||||
callContact.photoUri = context.getPhotoUriFromPhoneNumber(number)
|
||||
}
|
||||
|
||||
if (callContact.name.isEmpty() && callContact.number.isNotEmpty()) {
|
||||
callContact.name = callContact.number
|
||||
callContact.number = ""
|
||||
}
|
||||
|
||||
return callContact
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.simplemobiletools.contacts.pro.models
|
||||
|
||||
// a simpler Contact model containing just info needed at the call screen
|
||||
data class CallContact(var name: String, var number: String, var photoUri: String)
|
||||
data class CallContact(var name: String, var photoUri: String)
|
||||
|
@ -29,18 +29,6 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/caller_avatar"
|
||||
tools:text="Caller name" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/caller_number_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:alpha="0.8"
|
||||
android:textSize="@dimen/caller_number_text_size"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/caller_name_label"
|
||||
tools:text="123 456 789" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ongoing_call_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -8,7 +8,6 @@
|
||||
<dimen name="incoming_call_button_size">72dp</dimen>
|
||||
<dimen name="call_notification_button_size">30dp</dimen>
|
||||
|
||||
<dimen name="caller_name_text_size">26sp</dimen>
|
||||
<dimen name="caller_number_text_size">20sp</dimen>
|
||||
<dimen name="caller_name_text_size">28sp</dimen>
|
||||
<dimen name="dialpad_text_size">34sp</dimen>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user