diff options
Diffstat (limited to 'InCallUI/src/com/android/incallui/CallCardFragment.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 5998a3f88..3cebb7fe8 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -44,6 +44,11 @@ import android.widget.TextView; import com.android.contacts.common.animation.AnimationListenerAdapter; import com.android.contacts.common.util.ViewUtil; import com.android.incallui.animation.ResizeAnimation; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.TextView; + +import com.android.contacts.common.util.ViewUtil; import java.util.List; @@ -80,6 +85,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private View mAnimatedScrim; private View mEndCallButton; + private ImageButton mHandoffButton; // Cached DisplayMetrics density. private float mDensity; @@ -146,6 +152,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 @@ -266,8 +280,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } @Override - public void setCallState(int state, int cause, boolean bluetoothOn, - String gatewayLabel, String gatewayNumber, String wifiConnection) { + public void setCallState(int state, int cause, boolean bluetoothOn, String gatewayLabel, + String gatewayNumber, boolean isWiFi, boolean isHandoffCapable, + boolean isHandoffPending) { String callStateLabel = null; if (Call.State.isDialing(state) && !TextUtils.isEmpty(gatewayLabel)) { @@ -281,6 +296,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)) { @@ -293,6 +311,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr if (Call.State.INCOMING == state) { setBluetoothOn(bluetoothOn); } + + mHandoffButton.setEnabled(isHandoffCapable && !isHandoffPending); + mHandoffButton.setVisibility(mHandoffButton.isEnabled() ? View.VISIBLE : View.GONE); + mHandoffButton.setImageResource(isWiFi ? + R.drawable.ic_in_call_wifi : R.drawable.ic_in_call_pstn); } private void showInternetCallLabel(boolean show) { |