Dynamically add AnswerFragment
AnswerPresenter is a little tricky because it is in charge of
responding to incoming calls, so we want it to be alive and getting
onIncomingCall callbacks, but we don't want to create an instance
of AnswerFragment, which it is dependent on.
Move some dependencies around so that AnswerPresenter is created
by InCallPresenter instead. It registers for callbacks via InCallPresenter
instead of directly to CallList, and shows/hides the AnswerFragment via
InCallActivity.
Change-Id: I7026150988bf3cda762dda8a319f48e1af132361
diff --git a/InCallUI/res/layout-land/call_card_content.xml b/InCallUI/res/layout-land/call_card_fragment.xml
similarity index 90%
rename from InCallUI/res/layout-land/call_card_content.xml
rename to InCallUI/res/layout-land/call_card_fragment.xml
index 496b6b3..4c76b95 100644
--- a/InCallUI/res/layout-land/call_card_content.xml
+++ b/InCallUI/res/layout-land/call_card_fragment.xml
@@ -93,23 +93,13 @@
<!-- Placeholder for the dialpad which is replaced with the dialpad fragment when shown. -->
<FrameLayout
- android:id="@+id/dialpadFragmentContainer"
+ android:id="@+id/answer_and_dialpad_container"
android:layout_toEndOf="@id/primary_call_info_container"
android:layout_gravity="end|center_vertical"
android:layout_alignParentEnd="true"
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <fragment android:name="com.android.incallui.AnswerFragment"
- android:id="@+id/answerFragment"
- android:layout_toEndOf="@id/primary_call_info_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="start"
- android:layout_gravity="end|center_vertical"
- android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
- android:visibility="gone" />
-
<FrameLayout
android:id="@+id/floating_end_call_action_button_container"
android:layout_width="@dimen/end_call_floating_action_button_diameter"
diff --git a/InCallUI/res/layout/answer_fragment.xml b/InCallUI/res/layout/answer_fragment.xml
index d663b83..ec6ef30 100644
--- a/InCallUI/res/layout/answer_fragment.xml
+++ b/InCallUI/res/layout/answer_fragment.xml
@@ -19,13 +19,13 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dc="http://schemas.android.com/apk/res-auto"
android:id="@+id/glow_pad_view"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:focusable="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:background="@color/glowpad_background_color"
- android:visibility="gone"
+ android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
dc:targetDrawables="@array/incoming_call_widget_audio_with_sms_targets"
dc:targetDescriptions="@array/incoming_call_widget_audio_with_sms_target_descriptions"
diff --git a/InCallUI/res/layout/call_card_content.xml b/InCallUI/res/layout/call_card_fragment.xml
similarity index 90%
rename from InCallUI/res/layout/call_card_content.xml
rename to InCallUI/res/layout/call_card_fragment.xml
index 7a42586..920f8cb 100644
--- a/InCallUI/res/layout/call_card_content.xml
+++ b/InCallUI/res/layout/call_card_fragment.xml
@@ -98,9 +98,9 @@
android:layout_height="wrap_content"
android:layout_alignTop="@id/photo" />
- <!-- Placeholder for the dialpad which is replaced with the dialpad fragment when shown. -->
+ <!-- Placeholder for various fragments that are added dynamically underneath the caller info -->
<FrameLayout
- android:id="@+id/dialpadFragmentContainer"
+ android:id="@+id/answer_and_dialpad_container"
android:layout_below="@id/primary_call_info_container"
android:layout_gravity="bottom|center_horizontal"
android:layout_alignParentBottom="true"
@@ -108,15 +108,6 @@
android:layout_height="match_parent"
android:elevation="@dimen/dialpad_elevation" />
- <fragment android:name="com.android.incallui.AnswerFragment"
- android:id="@+id/answerFragment"
- android:layout_below="@id/primary_call_info_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
- android:visibility="gone" />
-
<FrameLayout
android:id="@+id/floating_end_call_action_button_container"
android:layout_width="@dimen/end_call_floating_action_button_diameter"