summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-05-31 14:50:56 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-01 18:15:52 -0700
commitba2a369716543f954a33bd04c4af5bafbb127393 (patch)
tree6de388ff61042a52139edc551eb3c217c27d8fe6
parent598ab9a2d6a23a03fb0990411496276347bbc67a (diff)
UI fixes for emergency numbers in the old call log.
Bug: 80426301,80426768 Test: Manual PiperOrigin-RevId: 198783744 Change-Id: Ib704a710680b3cf18e4c3c91cd48e7b8491671ff
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java23
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java33
2 files changed, 43 insertions, 13 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 9b7741df4..48e523db3 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -599,6 +599,29 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
setUpVideoButtonView.setVisibility(View.GONE);
inviteVideoButtonView.setVisibility(View.GONE);
+ // For an emergency number, show "Call details" only.
+ if (PhoneNumberHelper.isLocalEmergencyNumber(context, number)) {
+ createNewContactButtonView.setVisibility(View.GONE);
+ addToExistingContactButtonView.setVisibility(View.GONE);
+ sendMessageView.setVisibility(View.GONE);
+ callWithNoteButtonView.setVisibility(View.GONE);
+ callComposeButtonView.setVisibility(View.GONE);
+ blockReportView.setVisibility(View.GONE);
+ blockView.setVisibility(View.GONE);
+ unblockView.setVisibility(View.GONE);
+ reportNotSpamView.setVisibility(View.GONE);
+ voicemailPlaybackView.setVisibility(View.GONE);
+
+ detailsButtonView.setVisibility(View.VISIBLE);
+ detailsButtonView.setTag(
+ IntentProvider.getCallDetailIntentProvider(
+ callDetailsEntries,
+ buildContact(),
+ /* canReportCallerId = */ false,
+ /* canSupportAssistedDialing = */ false));
+ return;
+ }
+
if (isFullyUndialableVoicemail()) {
// Sometimes the voicemail server will report the message is from some non phone number
// source. If the number does not contains any dialable digit treat it as it is from a unknown
diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
index 44b5a4319..4da7fa0dc 100644
--- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
+++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java
@@ -40,6 +40,7 @@ import com.android.dialer.dialercontact.DialerContact;
import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent;
import com.android.dialer.logging.InteractionEvent;
import com.android.dialer.logging.Logger;
+import com.android.dialer.phonenumberutil.PhoneNumberHelper;
import com.android.dialer.widget.BidiTextView;
/**
@@ -157,20 +158,26 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder
contact.getNameOrNumber(),
contact.getContactType());
- nameView.setText(contact.getNameOrNumber());
- if (!TextUtils.isEmpty(contact.getDisplayNumber())) {
- numberView.setVisibility(View.VISIBLE);
- String secondaryInfo =
- TextUtils.isEmpty(contact.getNumberLabel())
- ? contact.getDisplayNumber()
- : context.getString(
- com.android.contacts.common.R.string.call_subject_type_and_number,
- contact.getNumberLabel(),
- contact.getDisplayNumber());
- numberView.setText(secondaryInfo);
+ // Hide the secondary text of the header by default.
+ // We will show it if needed (see below).
+ numberView.setVisibility(View.GONE);
+ numberView.setText(null);
+
+ if (PhoneNumberHelper.isLocalEmergencyNumber(context, contact.getNumber())) {
+ nameView.setText(context.getResources().getString(R.string.emergency_number));
} else {
- numberView.setVisibility(View.GONE);
- numberView.setText(null);
+ nameView.setText(contact.getNameOrNumber());
+ if (!TextUtils.isEmpty(contact.getDisplayNumber())) {
+ numberView.setVisibility(View.VISIBLE);
+ String secondaryInfo =
+ TextUtils.isEmpty(contact.getNumberLabel())
+ ? contact.getDisplayNumber()
+ : context.getString(
+ com.android.contacts.common.R.string.call_subject_type_and_number,
+ contact.getNumberLabel(),
+ contact.getDisplayNumber());
+ numberView.setText(secondaryInfo);
+ }
}
if (!TextUtils.isEmpty(contact.getSimDetails().getNetwork())) {