summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-04-10 13:01:13 -0700
committerAndrew Lee <anwlee@google.com>2015-04-20 14:42:38 -0700
commit89aad4adce9cc66294f15391fa3e10f3123d3d92 (patch)
tree3b03d2738c47784874699778dbe128f00fad1c8f
parentcb687e7d20c2633d65f22a961e7080ea5692e554 (diff)
Add EmergencyCallListener.
+ Add EmergencyCallListener, which fires when the call card is updated to indicate whether the call is an emergency call or not. Bug: 20300758 Change-Id: Ie9ad6ddecb278b56226804f5009504b4cc8b4cd5
-rw-r--r--InCallUI/res/layout-land/call_card_fragment.xml27
-rw-r--r--InCallUI/res/layout/call_card_fragment.xml28
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java12
-rw-r--r--InCallUI/src/com/android/incallui/ContactInfoCache.java4
-rw-r--r--InCallUI/src/com/android/incalluibind/ObjectFactory.java14
5 files changed, 61 insertions, 24 deletions
diff --git a/InCallUI/res/layout-land/call_card_fragment.xml b/InCallUI/res/layout-land/call_card_fragment.xml
index 89466152a..c02af1b03 100644
--- a/InCallUI/res/layout-land/call_card_fragment.xml
+++ b/InCallUI/res/layout-land/call_card_fragment.xml
@@ -59,17 +59,24 @@
</LinearLayout>
- <!-- Contact photo for primary call info -->
- <ImageView android:id="@+id/photo"
- android:layout_toEndOf="@id/primary_call_info_container"
- android:layout_width="match_parent"
- android:layout_gravity="start|center_vertical"
+ <FrameLayout
android:layout_height="match_parent"
- android:gravity="start|center_vertical"
- android:scaleType="centerCrop"
- android:contentDescription="@string/contactPhoto"
- android:background="@android:color/white"
- android:src="@drawable/img_no_image_automirrored" />
+ android:layout_width="match_parent"
+ android:layout_below="@id/primary_call_info_container"
+ android:id="@+id/call_card_content">
+
+ <ImageView android:id="@+id/photo"
+ android:layout_toEndOf="@id/primary_call_info_container"
+ android:layout_width="match_parent"
+ android:layout_gravity="start|center_vertical"
+ android:layout_height="match_parent"
+ android:gravity="start|center_vertical"
+ android:scaleType="centerCrop"
+ android:contentDescription="@string/contactPhoto"
+ android:background="@android:color/white"
+ android:src="@drawable/img_no_image_automirrored" />
+
+ </FrameLayout>
<include layout="@layout/manage_conference_call_button"
android:layout_width="match_parent"
diff --git a/InCallUI/res/layout/call_card_fragment.xml b/InCallUI/res/layout/call_card_fragment.xml
index 615744c79..13f72d4d0 100644
--- a/InCallUI/res/layout/call_card_fragment.xml
+++ b/InCallUI/res/layout/call_card_fragment.xml
@@ -60,17 +60,25 @@
</LinearLayout>
- <!-- Contact photo for primary call info -->
- <ImageView android:id="@+id/photo"
- android:layout_below="@id/primary_call_info_container"
- android:layout_width="match_parent"
+ <FrameLayout
android:layout_height="match_parent"
- android:layout_gravity="center_vertical"
- android:gravity="top|center_horizontal"
- android:scaleType="centerCrop"
- android:contentDescription="@string/contactPhoto"
- android:background="@android:color/white"
- android:src="@drawable/img_no_image_automirrored" />
+ android:layout_width="match_parent"
+ android:layout_below="@id/primary_call_info_container"
+ android:id="@+id/call_card_content">
+
+ <!-- Contact photo for primary call info -->
+ <ImageView android:id="@+id/photo"
+ android:layout_below="@id/primary_call_info_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:gravity="top|center_horizontal"
+ android:scaleType="centerCrop"
+ android:contentDescription="@string/contactPhoto"
+ android:background="@android:color/white"
+ android:src="@drawable/img_no_image_automirrored" />
+
+ </FrameLayout>
<!-- Progress spinner, useful for indicating pending operations such as upgrade to video. -->
<FrameLayout
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 535ba3bf0..e4da71e68 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -60,6 +60,13 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
implements InCallStateListener, IncomingCallListener, InCallDetailsListener,
InCallEventListener {
+ public interface EmergencyCallListener {
+ public void onCallUpdated(BaseFragment fragment, boolean isEmergency);
+ }
+
+ private static final EmergencyCallListener mEmergencyCallListener =
+ ObjectFactory.newEmergencyCallListener();
+
private static final String TAG = CallCardPresenter.class.getSimpleName();
private static final long CALL_TIME_UPDATE_INTERVAL_MS = 1000;
@@ -526,6 +533,11 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
ui.setPrimary(null, null, false, null, null, false);
}
+ if (mEmergencyCallListener != null) {
+ boolean isEmergencyCall = PhoneNumberUtils.isEmergencyNumber(
+ getNumberFromHandle(mPrimary.getHandle()));
+ mEmergencyCallListener.onCallUpdated((BaseFragment) ui, isEmergencyCall);
+ }
}
private void updateSecondaryDisplayInfo() {
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java
index 49621695b..27bf5a8f6 100644
--- a/InCallUI/src/com/android/incallui/ContactInfoCache.java
+++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java
@@ -29,7 +29,7 @@ import android.text.TextUtils;
import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.incallui.service.PhoneNumberService;
-import com.android.incalluibind.ServiceFactory;
+import com.android.incalluibind.ObjectFactory;
import com.android.services.telephony.common.MoreStrings;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -69,7 +69,7 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
private ContactInfoCache(Context context) {
mContext = context;
- mPhoneNumberService = ServiceFactory.newPhoneNumberService(context);
+ mPhoneNumberService = ObjectFactory.newPhoneNumberService(context);
}
public ContactCacheEntry getInfo(String callId) {
diff --git a/InCallUI/src/com/android/incalluibind/ObjectFactory.java b/InCallUI/src/com/android/incalluibind/ObjectFactory.java
index a2adc102f..0cb4241b2 100644
--- a/InCallUI/src/com/android/incalluibind/ObjectFactory.java
+++ b/InCallUI/src/com/android/incalluibind/ObjectFactory.java
@@ -19,14 +19,24 @@ package com.android.incalluibind;
import android.content.Context;
import android.content.Intent;
+import com.android.incallui.CallCardPresenter.EmergencyCallListener;
+
public class ObjectFactory {
+ public static EmergencyCallListener getEmergencyCallListener() {
+ return null;
+ }
+
/** @return An {@link Intent} to be broadcast when the InCallUI is visible. */
- public static Intent getUiReadyBroadcastIntent(Context context) { return null; }
+ public static Intent getUiReadyBroadcastIntent(Context context) {
+ return null;
+ }
/**
* @return An {@link Intent} to be broadcast when the call state button in the InCallUI is
* touched while in a call.
*/
- public static Intent getCallStateButtonBroadcastIntent(Context context) { return null; }
+ public static Intent getCallStateButtonBroadcastIntent(Context context) {
+ return null;
+ }
}