diff options
author | Sailesh Nepal <sail@google.com> | 2013-12-17 17:56:08 -0800 |
---|---|---|
committer | Sailesh Nepal <sail@google.com> | 2013-12-17 17:56:08 -0800 |
commit | e14843e2ce456ffca91ae83d0ccff722ca222e5d (patch) | |
tree | b0989de7663aae834158c982da35e55015e611bd /InCallUI | |
parent | e9e0c65ab11308c84271ab9e1d955fa4c977c4ce (diff) |
Add handoff buttons
This CL adds two buttons to the in call UI:
- video handoff - switch to video mode
- connection handoff - switch between wifi and cell
Change-Id: I42a36d22dc0a37d1ed00f1a3ab1ebcb53c35864c
Diffstat (limited to 'InCallUI')
15 files changed, 101 insertions, 6 deletions
diff --git a/InCallUI/res/drawable-hdpi/ic_in_call_video_handoff.png b/InCallUI/res/drawable-hdpi/ic_in_call_video_handoff.png Binary files differnew file mode 100644 index 000000000..fb76e3c69 --- /dev/null +++ b/InCallUI/res/drawable-hdpi/ic_in_call_video_handoff.png diff --git a/InCallUI/res/drawable-hdpi/ic_in_call_wifi.png b/InCallUI/res/drawable-hdpi/ic_in_call_wifi.png Binary files differnew file mode 100644 index 000000000..93e086dab --- /dev/null +++ b/InCallUI/res/drawable-hdpi/ic_in_call_wifi.png diff --git a/InCallUI/res/drawable-mdpi/ic_in_call_video_handoff.png b/InCallUI/res/drawable-mdpi/ic_in_call_video_handoff.png Binary files differnew file mode 100644 index 000000000..8b1ff4e02 --- /dev/null +++ b/InCallUI/res/drawable-mdpi/ic_in_call_video_handoff.png diff --git a/InCallUI/res/drawable-mdpi/ic_in_call_wifi.png b/InCallUI/res/drawable-mdpi/ic_in_call_wifi.png Binary files differnew file mode 100644 index 000000000..339d4ed27 --- /dev/null +++ b/InCallUI/res/drawable-mdpi/ic_in_call_wifi.png diff --git a/InCallUI/res/drawable-xhdpi/ic_in_call_video_handoff.png b/InCallUI/res/drawable-xhdpi/ic_in_call_video_handoff.png Binary files differnew file mode 100644 index 000000000..38d6220b1 --- /dev/null +++ b/InCallUI/res/drawable-xhdpi/ic_in_call_video_handoff.png diff --git a/InCallUI/res/drawable-xhdpi/ic_in_call_wifi.png b/InCallUI/res/drawable-xhdpi/ic_in_call_wifi.png Binary files differnew file mode 100644 index 000000000..692726fbe --- /dev/null +++ b/InCallUI/res/drawable-xhdpi/ic_in_call_wifi.png diff --git a/InCallUI/res/drawable-xxhdpi/ic_in_call_video_handoff.png b/InCallUI/res/drawable-xxhdpi/ic_in_call_video_handoff.png Binary files differnew file mode 100644 index 000000000..4cbdbbb57 --- /dev/null +++ b/InCallUI/res/drawable-xxhdpi/ic_in_call_video_handoff.png diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml index 013d1b22a..944c3147a 100644 --- a/InCallUI/res/layout/call_button_fragment.xml +++ b/InCallUI/res/layout/call_button_fragment.xml @@ -164,7 +164,19 @@ android:visibility="gone" /> - <!-- Separator between 4th (or 5th) button and right padding --> + <!-- Separator between 5th and 6th button --> + <View android:id="@+id/videoHandoffSpacer" + style="@style/VerticalSeparator" + android:visibility="gone" /> + + <ImageButton android:id="@+id/videoHandoffButton" + style="@style/InCallButton" + android:src="@drawable/ic_in_call_video_handoff" + android:contentDescription="@string/video_handoff_text" + android:visibility="gone" + /> + + <!-- Separator between last button and right padding --> <View style="@style/VerticalSeparator"/> </LinearLayout> diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml index d013f7022..d3f6db307 100644 --- a/InCallUI/res/layout/primary_call_info.xml +++ b/InCallUI/res/layout/primary_call_info.xml @@ -119,7 +119,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical|right" - android:orientation="vertical" + android:orientation="horizontal" android:background="@color/incall_secondary_info_background" android:animateLayoutChanges="true"> @@ -127,8 +127,9 @@ indication like "Dialing" or "Incoming call" or "Call ended". It's unused for the normal case of an active ongoing call. --> <TextView android:id="@+id/callStateLabel" - android:layout_width="match_parent" + android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_weight="1" android:paddingTop="@dimen/provider_info_top_bottom_padding" android:paddingBottom="@dimen/provider_info_top_bottom_padding" android:paddingStart="@dimen/call_banner_side_padding" @@ -140,6 +141,13 @@ android:background="@android:color/transparent" android:singleLine="true" android:ellipsize="end"/> + + <Button android:id="@+id/connectionHandoffButton" + android:text="@string/connection_handoff_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:visibility="gone" /> + </LinearLayout> </LinearLayout> diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index bbcbbe962..ddfec2c07 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -519,4 +519,10 @@ <string name="emergency_call_dialog_number_for_display">Emergency number</string> <string name="in_call_wifi_connected">Connected via <xliff:g id="wifi_ssid">%s</xliff:g></string> + + <!-- Text for the onscreen video handoff button --> + <string name="video_handoff_text">Video</string> + + <!-- Text for the onscreen connection handoff button --> + <string name="connection_handoff_text">Handoff</string> </resources> diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index ed7690334..536680c5a 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -48,6 +48,8 @@ public class CallButtonFragment private ImageButton mMergeButton; private ImageButton mAddCallButton; private ImageButton mSwapButton; + private ImageButton mVideoHandoffButton; + private View mVideoHandoffSpacer; private PopupMenu mAudioModePopup; private boolean mAudioModePopupVisible; @@ -141,6 +143,9 @@ public class CallButtonFragment mMergeButton.setOnClickListener(this); mSwapButton = (ImageButton) parent.findViewById(R.id.swapButton); mSwapButton.setOnClickListener(this); + mVideoHandoffButton = (ImageButton) parent.findViewById(R.id.videoHandoffButton); + mVideoHandoffButton.setOnClickListener(this); + mVideoHandoffSpacer = parent.findViewById(R.id.videoHandoffSpacer); return parent; } @@ -183,6 +188,9 @@ public class CallButtonFragment case R.id.dialpadButton: getPresenter().showDialpadClicked(mShowDialpadButton.isChecked()); break; + case R.id.videoHandoffButton: + getPresenter().videoHandoffClicked(); + break; default: Log.wtf(this, "onClick: unexpected"); break; @@ -526,6 +534,11 @@ public class CallButtonFragment } } + @Override + public void showVideoHandoff(boolean show) { + mVideoHandoffButton.setVisibility(show ? View.VISIBLE : View.GONE); + mVideoHandoffSpacer.setVisibility(show ? View.VISIBLE : View.GONE); + } @Override public void showManageConferenceCallButton() { diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 67a642b06..0a0330629 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -219,6 +219,10 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto updateExtraButtonRow(); } + public void videoHandoffClicked() { + CallCommandClient.getInstance().videoHandoff(mCall.getCallId()); + } + private void updateUi(InCallState state, Call call) { final CallButtonUi ui = getUi(); if (ui == null) { @@ -239,12 +243,12 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto Log.v(this, "Show swap ", call.can(Capabilities.SWAP_CALLS)); Log.v(this, "Show add call ", call.can(Capabilities.ADD_CALL)); Log.v(this, "Show mute ", call.can(Capabilities.MUTE)); + Log.v(this, "Show video handoff ", call.can(Capabilities.VIDEO_HANDOFF)); final boolean canMerge = call.can(Capabilities.MERGE_CALLS); final boolean canAdd = call.can(Capabilities.ADD_CALL); final boolean isGenericConference = call.can(Capabilities.GENERIC_CONFERENCE); - final boolean showMerge = !isGenericConference && canMerge; if (showMerge) { @@ -291,6 +295,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } ui.enableMute(call.can(Capabilities.MUTE)); + ui.showVideoHandoff(call.can(Capabilities.VIDEO_HANDOFF)); // Finally, update the "extra button row": It's displayed above the // "End" button, but only if necessary. Also, it's never displayed @@ -357,5 +362,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto void showGenericMergeButton(); void hideExtraRow(); void displayManageConferencePanel(boolean on); + void showVideoHandoff(boolean show); } } diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 76cdf2ca9..c50e64aa0 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -30,6 +30,7 @@ import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewStub; import android.view.accessibility.AccessibilityEvent; +import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; @@ -52,6 +53,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private ImageView mPhoto; private TextView mElapsedTime; private ViewGroup mSupplementaryInfoContainer; + private Button mConnectionHandoffButton; // Secondary caller info private ViewStub mSecondaryCallInfo; @@ -111,6 +113,13 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime); mSupplementaryInfoContainer = (ViewGroup) view.findViewById(R.id.supplementary_info_container); + mConnectionHandoffButton = (Button) view.findViewById(R.id.connectionHandoffButton); + mConnectionHandoffButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + getPresenter().connectionHandoffClicked(); + } + }); } @Override @@ -170,6 +179,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } @Override + public void setShowConnectionHandoff(boolean showConnectionHandoff) { + mConnectionHandoffButton.setVisibility(showConnectionHandoff ? View.VISIBLE : View.GONE); + } + + @Override public void setPrimary(String number, String name, boolean nameIsNumber, String label, Drawable photo, boolean isConference, boolean isGeneric, boolean isSipCall) { Log.d(this, "Setting primary call"); @@ -258,13 +272,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mCallStateLabel.setText(getResources().getString(R.string.in_call_wifi_connected, wifiConnection)); mCallStateLabel.setGravity(Gravity.START | Gravity.CENTER_VERTICAL); - mCallStateLabel.setBackgroundResource(R.color.wifi_connected_background); mCallStateLabel.setCompoundDrawablesRelativeWithIntrinsicBounds( R.drawable.ic_in_call_wifi, 0, 0, 0); mCallStateLabel.setCompoundDrawablePadding(5); mCallStateLabel.setAllCaps(false); mCallStateLabel.setVisibility(View.VISIBLE); - + mSupplementaryInfoContainer.setBackgroundResource(R.color.wifi_connected_background); } else if (!TextUtils.isEmpty(callStateLabel)) { mCallStateLabel.setGravity(Gravity.END); mCallStateLabel.setAllCaps(true); @@ -274,6 +287,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr if (Call.State.INCOMING == state) { setBluetoothOn(bluetoothOn); } + mSupplementaryInfoContainer.setBackgroundResource( + R.color.incall_secondary_info_background); } else { mCallStateLabel.setVisibility(View.GONE); mCallStateLabel.setCompoundDrawables(null, null, null, null); diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index e81ec8526..4c010a565 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -195,6 +195,9 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> } else { ui.setCallState(Call.State.IDLE, Call.DisconnectCause.UNKNOWN, false, null, null, null); } + + ui.setShowConnectionHandoff(mPrimary != null && mPrimary.can( + Capabilities.CONNECTION_HANDOFF)); } @Override @@ -469,6 +472,12 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> CallCommandClient.getInstance().swap(); } + public void connectionHandoffClicked() { + if (mPrimary != null) { + CallCommandClient.getInstance().connectionHandoff(mPrimary.getCallId()); + } + } + public interface CallCardUi extends Ui { void setVisible(boolean on); void setPrimary(String number, String name, boolean nameIsNumber, String label, @@ -483,5 +492,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> void setPrimaryImage(Drawable image); void setPrimaryPhoneNumber(String phoneNumber); void setPrimaryLabel(String label); + void setShowConnectionHandoff(boolean showConnectionHandoff); } } diff --git a/InCallUI/src/com/android/incallui/CallCommandClient.java b/InCallUI/src/com/android/incallui/CallCommandClient.java index 52d2100c8..234c518de 100644 --- a/InCallUI/src/com/android/incallui/CallCommandClient.java +++ b/InCallUI/src/com/android/incallui/CallCommandClient.java @@ -243,4 +243,29 @@ public class CallCommandClient { } } + public void videoHandoff(int callId) { + Log.i(this, "video handoff"); + if (mCommandService == null) { + Log.e(this, "Cannot perform video handoff; CallCommandService == null"); + return; + } + try { + mCommandService.videoHandoff(callId); + } catch (RemoteException e) { + Log.e(this, "Error performing video handoff.", e); + } + } + + public void connectionHandoff(int callId) { + Log.i(this, "connection handoff"); + if (mCommandService == null) { + Log.e(this, "Cannot perform connection handoff; CallCommandService == null"); + return; + } + try { + mCommandService.connectionHandoff(callId); + } catch (RemoteException e) { + Log.e(this, "Error performing connection handoff.", e); + } + } } |