summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-04-23 15:02:49 -0700
committerAndrew Lee <anwlee@google.com>2014-04-23 16:15:57 -0700
commit7e5763d2b5ee7211c5d19d2b1fd2736e407a7e83 (patch)
tree9a2f486e36a6110d451daa94dc82aa9723fa5313
parent200cb1c38dfa88ab3593b6cd0c0f9c82f39c9bc9 (diff)
Relocate EndCallButton and CallButtonFragment.
This is an incremental checkin. - Split out EndCallButton from CallButtonFragment into CallCardFragment, and update the presenter to handle end call clicks. - Move CallButtonFragment and EndCallButton into the container for the primary call info. - Rearranged the layouts of the call_card and primary_call_info to accomodate the new locations of these buttons. - Temporarily attached a linear layout around the InCallUI dialpad so that it doesn't render full-screen. That is the immediate followup work to this.. Bug: 14108639 Change-Id: Ie0e2afae109aed4bc7c75de67c70698c92962760
-rw-r--r--InCallUI/res/layout/call_button_fragment.xml10
-rw-r--r--InCallUI/res/layout/call_card.xml41
-rw-r--r--InCallUI/res/layout/incall_screen.xml90
-rw-r--r--InCallUI/res/layout/primary_call_info.xml17
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java16
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java8
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java15
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java8
8 files changed, 104 insertions, 101 deletions
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml
index cd58d9a25..9d8f743d9 100644
--- a/InCallUI/res/layout/call_button_fragment.xml
+++ b/InCallUI/res/layout/call_button_fragment.xml
@@ -50,15 +50,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <!-- Row 2: The "End call" button. -->
- <ImageButton android:id="@+id/endButton"
- style="@style/InCallEndButton"
- android:layout_width="match_parent"
- android:src="@drawable/ic_in_call_phone_hangup"
- android:background="@drawable/end_call_background"
- android:contentDescription="@string/onscreenEndCallText" />
-
- <!-- Row 3: The main batch of in-call buttons:
+ <!-- Row 2: The main batch of in-call buttons:
Dialpad / Audio mode / Mute / Hold / Add call
Visible in all states except while an incoming call is
ringing. -->
diff --git a/InCallUI/res/layout/call_card.xml b/InCallUI/res/layout/call_card.xml
index af47ef751..b254592f4 100644
--- a/InCallUI/res/layout/call_card.xml
+++ b/InCallUI/res/layout/call_card.xml
@@ -30,10 +30,45 @@
common case) then the 2nd call info will be GONE and thus the 1st one
will expand to fill the full height of the CallCard. -->
-
<!-- Primary "call card" block, for the foreground call. -->
- <include android:id="@+id/primary_call_info"
- layout="@layout/primary_call_info" />
+ <FrameLayout android:id="@+id/primary_call_info"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1">
+
+ <!-- Contact photo for primary call info -->
+ <ImageView android:id="@+id/photo"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentTop="true"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="top|center_horizontal"
+ android:scaleType="centerCrop"
+ android:contentDescription="@string/contactPhoto"
+ android:src="@drawable/picture_unknown"/>
+
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <include android:id="@+id/primary_call_info"
+ layout="@layout/primary_call_info" />
+
+ <fragment android:name="com.android.incallui.CallButtonFragment"
+ android:id="@+id/callButtonFragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+
+ <ImageButton android:id="@+id/endButton"
+ style="@style/InCallEndButton"
+ android:layout_width="match_parent"
+ android:src="@drawable/ic_in_call_phone_hangup"
+ android:background="@drawable/end_call_background"
+ android:contentDescription="@string/onscreenEndCallText"
+ android:layout_gravity="bottom" />
+ </FrameLayout>
<!-- Secondary "Call info" block, for the background ("on hold") call. -->
<ViewStub android:id="@+id/secondary_call_info"
diff --git a/InCallUI/res/layout/incall_screen.xml b/InCallUI/res/layout/incall_screen.xml
index 892f91707..06e8dac15 100644
--- a/InCallUI/res/layout/incall_screen.xml
+++ b/InCallUI/res/layout/incall_screen.xml
@@ -15,65 +15,59 @@
-->
<!-- In-call Phone UI; see InCallActivity.java. -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/main">
-
- <LinearLayout
- android:id="@+id/in_call_and_button_container"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:id="@+id/main" >
- <RelativeLayout
- android:id="@+id/in_call_card_container"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
+ <LinearLayout android:id="@+id/in_call_and_button_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
- <fragment
- android:name="com.android.incallui.CallCardFragment"
- android:id="@+id/callCardFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentStart="true" />
- <fragment
- android:name="com.android.incallui.DialpadFragment"
- android:id="@+id/dialpadFragment"
+ <LinearLayout android:id="@+id/in_call_card_container"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentStart="true" />
- </RelativeLayout>
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="vertical" >
+
+ <fragment android:name="com.android.incallui.CallCardFragment"
+ android:id="@+id/callCardFragment"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentStart="true"
+ android:layout_weight="1"/>
- <fragment android:name="com.android.incallui.CallButtonFragment"
- android:id="@+id/callButtonFragment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"/>
+ <fragment android:name="com.android.incallui.DialpadFragment"
+ android:id="@+id/dialpadFragment"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentStart="true"
+ android:layout_weight="1" />
+ </LinearLayout>
</LinearLayout>
<fragment android:name="com.android.incallui.AnswerFragment"
- android:id="@+id/answerFragment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_centerHorizontal="true"
- android:gravity="top"
- android:layout_gravity="bottom|center_horizontal"
- android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
- android:visibility="gone" />
+ android:id="@+id/answerFragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_centerHorizontal="true"
+ android:gravity="top"
+ android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginBottom="@dimen/glowpadview_margin_bottom"
+ android:visibility="gone" />
<fragment android:name="com.android.incallui.ConferenceManagerFragment"
- android:id="@+id/conferenceManagerFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentStart="true"
- android:layout_alignParentBottom="true"
- android:layout_alignParentEnd="true" />
+ android:id="@+id/conferenceManagerFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentStart="true"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentEnd="true" />
</FrameLayout>
diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml
index fd2fe50ef..1102402a2 100644
--- a/InCallUI/res/layout/primary_call_info.xml
+++ b/InCallUI/res/layout/primary_call_info.xml
@@ -17,20 +17,8 @@
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
-
- <!-- Contact photo for primary call info -->
- <ImageView android:id="@+id/photo"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="top|center_horizontal"
- android:scaleType="centerCrop"
- android:contentDescription="@string/contactPhoto"
- android:src="@drawable/picture_unknown"/>
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
@@ -144,5 +132,4 @@
</LinearLayout>
-
</FrameLayout>
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index a63b32576..58cb6d879 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -54,7 +54,6 @@ public class CallButtonFragment
private PopupMenu mAudioModePopup;
private boolean mAudioModePopupVisible;
- private View mEndCallButton;
private View mExtraRowButton;
private View mManageConferenceButton;
private View mGenericMergeButton;
@@ -98,18 +97,6 @@ public class CallButtonFragment
}
});
- mEndCallButton = parent.findViewById(R.id.endButton);
- mEndCallButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- getPresenter().endCallClicked();
- }
- });
-
- // make the hit target smaller for the end button so that is creates a deadzone
- // along the inside perimeter of the button.
- mEndCallButton.setOnTouchListener(new SmallerHitTargetTouchListener());
-
mMuteButton = (ImageButton) parent.findViewById(R.id.muteButton);
mMuteButton.setOnClickListener(new OnClickListener() {
@Override
@@ -205,9 +192,6 @@ public class CallButtonFragment
view.setVisibility(View.VISIBLE);
}
- // The main end-call button spanning across the screen.
- mEndCallButton.setEnabled(isEnabled);
-
// The smaller buttons laid out horizontally just below the end-call button.
mMuteButton.setEnabled(isEnabled);
mAudioButton.setEnabled(isEnabled);
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index 104da6d94..129c68cb9 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -189,14 +189,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
setAudioMode(newMode);
}
- public void endCallClicked() {
- if (mCall == null) {
- return;
- }
-
- CallCommandClient.getInstance().disconnectCall(mCall.getCallId());
- }
-
public void manageConferenceButtonClicked() {
getUi().displayManageConferencePanel(true);
}
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 6c5a3805f..2093a442c 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -18,8 +18,6 @@ package com.android.incallui;
import android.animation.LayoutTransition;
import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.telephony.DisconnectCause;
@@ -60,6 +58,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private ImageView mSecondaryPhoto;
private View mSecondaryPhotoOverlay;
+ private View mEndCallButton;
+
// Cached DisplayMetrics density.
private float mDensity;
@@ -112,6 +112,17 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime);
mSupplementaryInfoContainer =
(ViewGroup) view.findViewById(R.id.supplementary_info_container);
+
+ mEndCallButton = view.findViewById(R.id.endButton);
+ mEndCallButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getPresenter().endCallClicked();
+ }
+ });
+ // Make the hit target smaller for the end button so that is creates a deadzone along the
+ // inside perimeter of the button.
+ mEndCallButton.setOnTouchListener(new SmallerHitTargetTouchListener());
}
@Override
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 4e9fe9659..50179c4e6 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -456,6 +456,14 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
CallCommandClient.getInstance().swap();
}
+ public void endCallClicked() {
+ if (mPrimary == null) {
+ return;
+ }
+
+ CallCommandClient.getInstance().disconnectCall(mPrimary.getCallId());
+ }
+
public interface CallCardUi extends Ui {
void setVisible(boolean on);
void setPrimary(String number, String name, boolean nameIsNumber, String label,