summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorEvan Charlton <evanc@google.com>2014-05-09 21:18:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-09 21:18:26 +0000
commit0b5d65f4eeb0d450a83284cbed6580b022213bad (patch)
tree14dbbd21be6f36e8a349c21ce15afc66f776f304 /InCallUI
parent1f207741a8796fbefe5949be4caf15305bfc8006 (diff)
parent09bbf1595013b3d871230c368d26d577f60a0b8a (diff)
Merge "Re-add network indicator/handoff button" into master-nova
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/res/drawable-xxhdpi/ic_in_call_pstn.pngbin0 -> 4997 bytes
-rw-r--r--InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.pngbin0 -> 3065 bytes
-rw-r--r--InCallUI/res/drawable/floating_handoff_button_active_background.xml28
-rw-r--r--InCallUI/res/drawable/floating_handoff_button_compound_background.xml24
-rw-r--r--InCallUI/res/drawable/floating_handoff_button_disabled_background.xml28
-rw-r--r--InCallUI/res/drawable/floating_handoff_button_pressed_background.xml28
-rw-r--r--InCallUI/res/layout/call_card.xml34
-rw-r--r--InCallUI/res/values/colors.xml12
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java19
9 files changed, 164 insertions, 9 deletions
diff --git a/InCallUI/res/drawable-xxhdpi/ic_in_call_pstn.png b/InCallUI/res/drawable-xxhdpi/ic_in_call_pstn.png
new file mode 100644
index 000000000..3a52a2bbd
--- /dev/null
+++ b/InCallUI/res/drawable-xxhdpi/ic_in_call_pstn.png
Binary files differ
diff --git a/InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png b/InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png
new file mode 100644
index 000000000..4fd5f333c
--- /dev/null
+++ b/InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png
Binary files differ
diff --git a/InCallUI/res/drawable/floating_handoff_button_active_background.xml b/InCallUI/res/drawable/floating_handoff_button_active_background.xml
new file mode 100644
index 000000000..f06e8416b
--- /dev/null
+++ b/InCallUI/res/drawable/floating_handoff_button_active_background.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval" >
+ <corners
+ android:radius="@dimen/floating_action_button_radius" />
+ <size
+ android:width="@dimen/floating_action_button_width"
+ android:height="@dimen/floating_action_button_height" />
+ <solid
+ android:color="@color/handoff_call_active_color" />
+</shape>
diff --git a/InCallUI/res/drawable/floating_handoff_button_compound_background.xml b/InCallUI/res/drawable/floating_handoff_button_compound_background.xml
new file mode 100644
index 000000000..00ee7913a
--- /dev/null
+++ b/InCallUI/res/drawable/floating_handoff_button_compound_background.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Background drawable used to render the floating circular "end call" button. -->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false"
+ android:drawable="@drawable/floating_handoff_button_disabled_background" />
+ <item android:state_pressed="true"
+ android:drawable="@drawable/floating_handoff_button_pressed_background" />
+ <item android:drawable="@drawable/floating_handoff_button_active_background" />
+</selector>
diff --git a/InCallUI/res/drawable/floating_handoff_button_disabled_background.xml b/InCallUI/res/drawable/floating_handoff_button_disabled_background.xml
new file mode 100644
index 000000000..68d64b8e0
--- /dev/null
+++ b/InCallUI/res/drawable/floating_handoff_button_disabled_background.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval" >
+ <corners
+ android:radius="@dimen/floating_action_button_radius" />
+ <size
+ android:width="@dimen/floating_action_button_width"
+ android:height="@dimen/floating_action_button_height" />
+ <solid
+ android:color="@color/handoff_call_disabled_color" />
+</shape>
diff --git a/InCallUI/res/drawable/floating_handoff_button_pressed_background.xml b/InCallUI/res/drawable/floating_handoff_button_pressed_background.xml
new file mode 100644
index 000000000..54a046973
--- /dev/null
+++ b/InCallUI/res/drawable/floating_handoff_button_pressed_background.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="oval" >
+ <corners
+ android:radius="@dimen/floating_action_button_radius" />
+ <size
+ android:width="@dimen/floating_action_button_width"
+ android:height="@dimen/floating_action_button_height" />
+ <solid
+ android:color="@color/handoff_call_pressed_color" />
+</shape>
diff --git a/InCallUI/res/layout/call_card.xml b/InCallUI/res/layout/call_card.xml
index 6a06cabd0..8b54ad6b9 100644
--- a/InCallUI/res/layout/call_card.xml
+++ b/InCallUI/res/layout/call_card.xml
@@ -91,17 +91,33 @@
</LinearLayout>
<FrameLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|center">
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|center">
<ImageButton android:id="@+id/endButton"
- android:layout_width="@dimen/floating_action_button_width"
- android:layout_height="@dimen/floating_action_button_height"
- android:layout_marginBottom="@dimen/end_call_button_margin_bottom"
- android:background="@drawable/floating_end_button_compound_background"
- android:src="@drawable/ic_in_call_phone_hangup"
- android:contentDescription="@string/onscreenEndCallText" />
+ android:layout_width="@dimen/floating_action_button_width"
+ android:layout_height="@dimen/floating_action_button_height"
+ android:layout_marginBottom="@dimen/end_call_button_margin_bottom"
+ android:background="@drawable/floating_end_button_compound_background"
+ android:src="@drawable/ic_in_call_phone_hangup"
+ android:contentDescription="@string/onscreenEndCallText" />
+
+ </FrameLayout>
+
+ <!-- Insert a CallService indicator (which controls handoff, too) -->
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|right">
+
+ <ImageButton android:id="@+id/handoffButton"
+ android:enabled="false"
+ android:layout_width="@dimen/floating_action_button_width"
+ android:layout_height="@dimen/floating_action_button_height"
+ android:layout_marginBottom="@dimen/end_call_button_margin_bottom"
+ android:background="@drawable/floating_handoff_button_compound_background"
+ android:src="@drawable/ic_in_call_pstn" />
</FrameLayout>
diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml
index 7b23b60a5..03e058d38 100644
--- a/InCallUI/res/values/colors.xml
+++ b/InCallUI/res/values/colors.xml
@@ -49,6 +49,18 @@
<!-- Used when the End Call button is disabled -->
<color name="end_call_disabled_color">#303030</color>
+ <!-- Used when the Handoff Call button is active -->
+ <color name="handoff_call_active_color">#F2882C</color>
+
+ <!-- Used when the Handoff Call button is pressed -->
+ <color name="handoff_call_pressed_color">#F2A35E</color>
+
+ <!-- Used when the Handoff Call button is disabled -->
+ <color name="handoff_call_disabled_color">#303030</color>
+
+ <color name="call_state_wifi">#19E392</color>
+ <color name="call_state_cellular">#33A9F2</color>
+
<!-- Color of dialpad digits -->
<color name="dialpad_digits_text_color">#000000</color>
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index f466ac54e..ff499128e 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -28,6 +28,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
@@ -57,6 +58,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private View mSecondaryPhotoOverlay;
private View mEndCallButton;
+ private ImageButton mHandoffButton;
// Cached DisplayMetrics density.
private float mDensity;
@@ -117,6 +119,14 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
}
});
ViewUtil.setupFloatingActionButton(mEndCallButton, getResources());
+
+ mHandoffButton = (ImageButton) view.findViewById(R.id.handoffButton);
+ mHandoffButton.setOnClickListener(new View.OnClickListener() {
+ @Override public void onClick(View v) {
+ getPresenter().connectionHandoffClicked();
+ }
+ });
+ ViewUtil.setupFloatingActionButton(mHandoffButton, getResources());
}
@Override
@@ -249,6 +259,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
Log.v(this, "DisconnectCause " + DisconnectCause.toString(cause));
Log.v(this, "bluetooth on " + bluetoothOn);
Log.v(this, "gateway " + gatewayLabel + gatewayNumber);
+ Log.v(this, "isWiFi " + isWiFi);
+ Log.v(this, "isHandoffCapable " + isHandoffCapable);
+ Log.v(this, "isHandoffPending " + isHandoffPending);
// Update the call state label.
if (!TextUtils.isEmpty(callStateLabel)) {
@@ -261,6 +274,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
if (Call.State.INCOMING == state) {
setBluetoothOn(bluetoothOn);
}
+
+ mHandoffButton.setEnabled(isHandoffCapable && !isHandoffPending);
+ if (Call.State.ACTIVE == state) {
+ mHandoffButton.setImageResource(isWiFi ?
+ R.drawable.ic_in_call_wifi : R.drawable.ic_in_call_pstn);
+ }
}
private void showInternetCallLabel(boolean show) {