diff options
author | Evan Charlton <evanc@google.com> | 2014-05-09 13:23:34 -0700 |
---|---|---|
committer | Evan Charlton <evanc@google.com> | 2014-05-09 14:16:58 -0700 |
commit | 09bbf1595013b3d871230c368d26d577f60a0b8a (patch) | |
tree | 119b75c7b7e747ac67bc563f85d7aefdc6eacc51 /InCallUI | |
parent | 5e5d526fe508ed200e6b382052325e4a384b7e44 (diff) |
Re-add network indicator/handoff button
Add a handoff button (and network indicator) back into InCallUI. This
has not be vetted by UX or anything, but it will hopefully not cause
merge conflicts.
Change-Id: I6d0a8e7cd865df70b13fc69ec96cdc98e0e3f203
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/res/drawable-xxhdpi/ic_in_call_pstn.png | bin | 0 -> 4997 bytes | |||
-rw-r--r-- | InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png | bin | 0 -> 3065 bytes | |||
-rw-r--r-- | InCallUI/res/drawable/floating_handoff_button_active_background.xml | 28 | ||||
-rw-r--r-- | InCallUI/res/drawable/floating_handoff_button_compound_background.xml | 24 | ||||
-rw-r--r-- | InCallUI/res/drawable/floating_handoff_button_disabled_background.xml | 28 | ||||
-rw-r--r-- | InCallUI/res/drawable/floating_handoff_button_pressed_background.xml | 28 | ||||
-rw-r--r-- | InCallUI/res/layout/call_card.xml | 34 | ||||
-rw-r--r-- | InCallUI/res/values/colors.xml | 12 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 19 |
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 Binary files differnew file mode 100644 index 000000000..3a52a2bbd --- /dev/null +++ b/InCallUI/res/drawable-xxhdpi/ic_in_call_pstn.png diff --git a/InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png b/InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png Binary files differnew file mode 100644 index 000000000..4fd5f333c --- /dev/null +++ b/InCallUI/res/drawable-xxhdpi/ic_in_call_wifi.png 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 07ecef074..4b20b8a72 100644 --- a/InCallUI/res/layout/call_card.xml +++ b/InCallUI/res/layout/call_card.xml @@ -80,17 +80,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 0cdf93a01..6837a268d 100644 --- a/InCallUI/res/values/colors.xml +++ b/InCallUI/res/values/colors.xml @@ -47,6 +47,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 e21a9b14e..e58a5f6bb 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -27,6 +27,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; @@ -56,6 +57,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private View mSecondaryPhotoOverlay; private View mEndCallButton; + private ImageButton mHandoffButton; // Cached DisplayMetrics density. private float mDensity; @@ -116,6 +118,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 @@ -248,6 +258,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. mCallStateLabel.setText(callStateLabel); @@ -255,6 +268,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) { |