diff options
author | Santos Cordon <santoscordon@google.com> | 2013-08-07 21:26:49 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2013-08-07 23:46:43 -0700 |
commit | fa6d1c3cc9cc049a062d9308b4f4042df2ecfbab (patch) | |
tree | ffef7a60aa78231c9e13489a781974c3efdf092b | |
parent | 317954397ef01099ed0afeb1fca1a3778d5fec87 (diff) |
Show/Hide HOLD depending on phone capabilities.
Change-Id: I9fc00175d214668e59058a9b0983019457134b12
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonFragment.java | 5 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonPresenter.java | 24 |
2 files changed, 25 insertions, 4 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 1b9465de7..a5350da08 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -143,6 +143,11 @@ public class CallButtonFragment extends BaseFragment<CallButtonPresenter> } @Override + public void showHold(boolean show) { + mHoldButton.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 12f27c81f..bb2484747 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -23,6 +23,7 @@ import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.services.telephony.common.AudioMode; import com.android.services.telephony.common.Call; +import com.android.services.telephony.common.Call.Capabilities; /** * Logic for call buttons. @@ -54,10 +55,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto @Override public void onStateChange(InCallState state, CallList callList) { - final boolean isVisible = state.isConnectingOrConnected() && - !state.isIncoming(); - - getUi().setVisible(isVisible); if (state == InCallState.OUTGOING) { mCall = callList.getOutgoingCall(); @@ -66,6 +63,8 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } else { mCall = null; } + + updateUi(state, mCall); } @Override @@ -152,10 +151,27 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto getUi().displayDialpad(checked); } + private void updateUi(InCallState state, Call call) { + final CallButtonUi ui = getUi(); + if (ui == null) { + return; + } + + final boolean isVisible = state.isConnectingOrConnected() && + !state.isIncoming(); + + getUi().setVisible(isVisible); + + if (call != null) { + getUi().showHold(call.can(Capabilities.HOLD)); + } + } + public interface CallButtonUi extends Ui { void setVisible(boolean on); void setMute(boolean on); void setHold(boolean on); + void showHold(boolean show); void displayDialpad(boolean on); void setAudio(int mode); void setSupportedAudio(int mask); |