From b6404417362ca02c940807426fefdb7568e269e3 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Wed, 7 Aug 2013 22:35:43 -0700 Subject: Merge/Swap/AddCall support in UI. Add UI support, presenter logic and CallCommandClient code. Change-Id: I3d561b67cbecd9b4672ecef49dad99d1f6b07b11 --- .../com/android/incallui/CallButtonFragment.java | 61 +++++++++++++++++++--- .../com/android/incallui/CallButtonPresenter.java | 31 +++++++++-- .../com/android/incallui/CallCommandClient.java | 24 +++++++++ 3 files changed, 106 insertions(+), 10 deletions(-) (limited to 'InCallUI/src') diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index a5350da08..26480d2c5 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -26,6 +26,7 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; +import android.widget.ImageButton; import android.widget.PopupMenu; import android.widget.PopupMenu.OnDismissListener; import android.widget.PopupMenu.OnMenuItemClickListener; @@ -38,12 +39,15 @@ import com.android.services.telephony.common.AudioMode; */ public class CallButtonFragment extends BaseFragment implements CallButtonPresenter.CallButtonUi, OnMenuItemClickListener, - OnDismissListener { + OnDismissListener, View.OnClickListener, CompoundButton.OnCheckedChangeListener { private ToggleButton mMuteButton; private ToggleButton mAudioButton; private ToggleButton mHoldButton; private ToggleButton mShowDialpadButton; + private ImageButton mMergeButton; + private ImageButton mAddCallButton; + private ImageButton mSwapButton; private PopupMenu mAudioModePopup; private boolean mAudioModePopupVisible; @@ -99,12 +103,13 @@ public class CallButtonFragment extends BaseFragment }); mShowDialpadButton = (ToggleButton) parent.findViewById(R.id.dialpadButton); - mShowDialpadButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - getPresenter().showDialpadClicked(isChecked); - } - }); + mShowDialpadButton.setOnClickListener(this); + mAddCallButton = (ImageButton) parent.findViewById(R.id.addButton); + mAddCallButton.setOnClickListener(this); + mMergeButton = (ImageButton) parent.findViewById(R.id.mergeButton); + mMergeButton.setOnClickListener(this); + mSwapButton = (ImageButton) parent.findViewById(R.id.swapButton); + mSwapButton.setOnClickListener(this); return parent; } @@ -123,6 +128,33 @@ public class CallButtonFragment extends BaseFragment getPresenter().onUiUnready(this); } + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + } + + @Override + public void onClick(View view) { + int id = view.getId(); + Logger.d(this, "onClick(View " + view + ", id " + id + ")..."); + + switch(id) { + case R.id.addButton: + getPresenter().addCallClicked(); + break; + case R.id.mergeButton: + getPresenter().mergeClicked(); + break; + case R.id.swapButton: + getPresenter().swapClicked(); + break; + case R.id.dialpadButton: + getPresenter().showDialpadClicked(mShowDialpadButton.isChecked()); + default: + Logger.wtf(this, "onClick: unexpected"); + break; + } + } + @Override public void setVisible(boolean on) { if (on) { @@ -147,6 +179,21 @@ public class CallButtonFragment extends BaseFragment mHoldButton.setVisibility(show ? View.VISIBLE : View.GONE); } + @Override + public void showMerge(boolean show) { + mMergeButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + + @Override + public void showSwap(boolean show) { + mSwapButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + + @Override + public void showAddCall(boolean show) { + mAddCallButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + @Override public void setAudio(int mode) { } diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index bb2484747..7b6649704 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -146,6 +146,18 @@ public class CallButtonPresenter extends Presenter