diff options
author | Andrew Lee <anwlee@google.com> | 2015-04-21 00:03:18 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-21 00:03:19 +0000 |
commit | bc406d1e915c873f1dbeb33285034eb8ddda6b4d (patch) | |
tree | 2bbddf31fc2237e0da5dd27d9b8d33880aa66354 /InCallUI | |
parent | 0d9c9a77c98ba690e330c19db6037618944a4b11 (diff) | |
parent | 89aad4adce9cc66294f15391fa3e10f3123d3d92 (diff) |
Merge "Add EmergencyCallListener."
Diffstat (limited to 'InCallUI')
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; + } } |