summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-04-23 17:02:46 -0700
committerAndrew Lee <anwlee@google.com>2014-04-23 17:02:51 -0700
commite26b887e90d5e9566a5054a1ccb3ed32ae2eea2d (patch)
treeb6c78c89f4401a558bcf452962fd81077ecc3d36
parent7e5763d2b5ee7211c5d19d2b1fd2736e407a7e83 (diff)
Properly enable/disable end call button.
Also, cleaning up erroneous 8-space indents to 4-space. Bug: 14108639 Change-Id: Ic34fd9c645861533c584bfa33ab20793c509d78c
-rw-r--r--InCallUI/res/layout/call_card.xml64
-rw-r--r--InCallUI/res/layout/incall_screen.xml72
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java4
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java5
4 files changed, 77 insertions, 68 deletions
diff --git a/InCallUI/res/layout/call_card.xml b/InCallUI/res/layout/call_card.xml
index b254592f4..a8047f237 100644
--- a/InCallUI/res/layout/call_card.xml
+++ b/InCallUI/res/layout/call_card.xml
@@ -17,10 +17,10 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/call_card"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
+ android:id="@+id/call_card"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
<!-- The main content of the CallCard is either one or two "call info"
blocks, depending on whether one or two lines are in use.
@@ -32,49 +32,49 @@
<!-- Primary "call card" block, for the foreground call. -->
<FrameLayout android:id="@+id/primary_call_info"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
+ 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_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">
+ 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" />
+ 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" />
+ 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" />
+ 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"
- android:layout="@layout/secondary_call_info"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1" />
+ android:layout="@layout/secondary_call_info"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1" />
</LinearLayout>
diff --git a/InCallUI/res/layout/incall_screen.xml b/InCallUI/res/layout/incall_screen.xml
index 06e8dac15..d00b6bb95 100644
--- a/InCallUI/res/layout/incall_screen.xml
+++ b/InCallUI/res/layout/incall_screen.xml
@@ -16,58 +16,58 @@
<!-- 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:id="@+id/main" >
+ android:orientation="vertical" >
- <LinearLayout android:id="@+id/in_call_and_button_container"
+ <LinearLayout android:id="@+id/in_call_card_container"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
android:orientation="vertical" >
- <LinearLayout android:id="@+id/in_call_card_container"
+ <fragment android:name="com.android.incallui.CallCardFragment"
+ android:id="@+id/callCardFragment"
android:layout_width="match_parent"
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"/>
+ android:layout_alignParentTop="true"
+ android:layout_alignParentStart="true"
+ android:layout_weight="1"/>
<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" />
+ 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/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 2093a442c..10f3ed6c6 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -517,6 +517,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
return;
}
+ public void setEndCallButtonEnabled(boolean enabled) {
+ mEndCallButton.setEnabled(enabled);
+ }
+
private void dispatchPopulateAccessibilityEvent(AccessibilityEvent event, View view) {
if (view == null) return;
final List<CharSequence> eventText = event.getText();
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 50179c4e6..33d99b7d6 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -194,6 +194,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
} else {
ui.setCallState(Call.State.IDLE, DisconnectCause.NOT_VALID, false, null, null);
}
+
+ final boolean enableEndCallButton = state.isConnectingOrConnected() &&
+ !state.isIncoming() && mPrimary != null;
+ ui.setEndCallButtonEnabled(enableEndCallButton);
}
@Override
@@ -478,5 +482,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
void setPrimaryImage(Drawable image);
void setPrimaryPhoneNumber(String phoneNumber);
void setPrimaryLabel(String label);
+ void setEndCallButtonEnabled(boolean enabled);
}
}