summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/contactgrid
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-11-29 14:29:31 -0800
committerCopybara-Service <copybara-piper@google.com>2017-11-29 16:32:46 -0800
commit1d62ab209130bdacdb64b2cd824b5ff35817b89f (patch)
tree04e535956686bb2a8ddc98977fb305faa19bb77f /java/com/android/incallui/contactgrid
parentb33463c7cdf3a4d481767452d3a21c09527ffcb1 (diff)
Enable timer in emergency call.
"This phone's number: xxx" is shown for emergency call which replaces in call timer. This change move it to under emergency location service so timer could be shown again. Bug: 69810801 Test: manual PiperOrigin-RevId: 177363955 Change-Id: I543fbbee869923800ffd92a5799819b712f0b953
Diffstat (limited to 'java/com/android/incallui/contactgrid')
-rw-r--r--java/com/android/incallui/contactgrid/BottomRow.java4
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java33
-rw-r--r--java/com/android/incallui/contactgrid/res/layout/device_number_row.xml39
-rw-r--r--java/com/android/incallui/contactgrid/res/values/ids.xml2
4 files changed, 74 insertions, 4 deletions
diff --git a/java/com/android/incallui/contactgrid/BottomRow.java b/java/com/android/incallui/contactgrid/BottomRow.java
index a0d118552..f9fc870dc 100644
--- a/java/com/android/incallui/contactgrid/BottomRow.java
+++ b/java/com/android/incallui/contactgrid/BottomRow.java
@@ -97,10 +97,6 @@ public class BottomRow {
if (TextUtils.isEmpty(label)) {
label = context.getString(R.string.incall_call_ended);
}
- } else if (!TextUtils.isEmpty(state.callbackNumber)) {
- // This is used for carriers like Project Fi to show the callback number for emergency calls.
- label = context.getString(R.string.contact_grid_callback_number, state.callbackNumber);
- isTimerVisible = false;
} else {
label = getLabelForPhoneNumber(primaryInfo);
shouldPopulateAccessibilityEvent = primaryInfo.nameIsNumber;
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 8deee8263..1bac97842 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -81,9 +81,14 @@ public class ContactGridManager {
private boolean middleRowVisible = true;
private boolean isTimerStarted;
+ // Row in emergency call: This phone's number: +1 (650) 253-0000
+ private final TextView deviceNumberTextView;
+ private final View deviceNumberDivider;
+
private PrimaryInfo primaryInfo = PrimaryInfo.createEmptyPrimaryInfo();
private PrimaryCallState primaryCallState = PrimaryCallState.createEmptyPrimaryCallState();
private final LetterTileDrawable letterTile;
+ private boolean isInMultiWindowMode;
public ContactGridManager(
View view, @Nullable ImageView avatarImageView, int avatarSize, boolean showAnonymousAvatar) {
@@ -109,6 +114,9 @@ public class ContactGridManager {
contactGridLayout = (View) contactNameTextView.getParent();
letterTile = new LetterTileDrawable(context.getResources());
isTimerStarted = false;
+
+ deviceNumberTextView = view.findViewById(R.id.contactgrid_device_number_text);
+ deviceNumberDivider = view.findViewById(R.id.contactgrid_location_divider);
}
public void show() {
@@ -148,6 +156,7 @@ public class ContactGridManager {
this.primaryInfo = primaryInfo;
updatePrimaryNameAndPhoto();
updateBottomRow();
+ updateDeviceNumberRow();
}
public void setCallState(PrimaryCallState primaryCallState) {
@@ -155,6 +164,7 @@ public class ContactGridManager {
updatePrimaryNameAndPhoto();
updateBottomRow();
updateTopRow();
+ updateDeviceNumberRow();
}
public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
@@ -174,6 +184,14 @@ public class ContactGridManager {
updatePrimaryNameAndPhoto();
}
+ public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
+ if (this.isInMultiWindowMode == isInMultiWindowMode) {
+ return;
+ }
+ this.isInMultiWindowMode = isInMultiWindowMode;
+ updateDeviceNumberRow();
+ }
+
private void dispatchPopulateAccessibilityEvent(AccessibilityEvent event, View view) {
final List<CharSequence> eventText = event.getText();
int size = eventText.size();
@@ -379,4 +397,19 @@ public class ContactGridManager {
isTimerStarted = false;
}
}
+
+ private void updateDeviceNumberRow() {
+ if (isInMultiWindowMode || TextUtils.isEmpty(primaryCallState.callbackNumber)) {
+ deviceNumberTextView.setVisibility(View.GONE);
+ deviceNumberDivider.setVisibility(View.GONE);
+ return;
+ }
+ // This is used for carriers like Project Fi to show the callback number for emergency calls.
+ deviceNumberTextView.setText(
+ context.getString(R.string.contact_grid_callback_number, primaryCallState.callbackNumber));
+ deviceNumberTextView.setVisibility(View.VISIBLE);
+ if (primaryInfo.shouldShowLocation) {
+ deviceNumberDivider.setVisibility(View.VISIBLE);
+ }
+ }
}
diff --git a/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml b/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml
new file mode 100644
index 000000000..4f8bbad5a
--- /dev/null
+++ b/java/com/android/incallui/contactgrid/res/layout/device_number_row.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+ <View
+ android:id="@+id/contactgrid_location_divider"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_gravity="bottom"
+ android:background="#D8D8D8"
+ android:visibility="gone"/>
+
+ <TextView
+ android:id="@+id/contactgrid_device_number_text"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:padding="16dp"
+ android:background="@android:color/white"
+ android:elevation="2dp"
+ android:gravity="start"
+ android:orientation="vertical"
+ android:textColor="#DD000000"
+ android:textSize="16sp"
+ android:visibility="gone"/>
+</merge> \ No newline at end of file
diff --git a/java/com/android/incallui/contactgrid/res/values/ids.xml b/java/com/android/incallui/contactgrid/res/values/ids.xml
index f3b111a16..03f5a3d81 100644
--- a/java/com/android/incallui/contactgrid/res/values/ids.xml
+++ b/java/com/android/incallui/contactgrid/res/values/ids.xml
@@ -29,4 +29,6 @@
<item name="contactgrid_top_row" type="id"/>
<item name="contactgrid_bottom_row" type="id"/>
<item name="contactgrid_top_row_space" type="id"/>
+ <item name="contactgrid_location_divider" type="id"/>
+ <item name="contactgrid_device_number_text" type="id"/>
</resources>