From 137f67c0d87a8a28be94a07e1c7f05219aacbcb7 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 18 Jul 2014 12:04:03 -0700 Subject: Show correct call buttons depending on voice/video call. Behaviors to be implemented in separate changelist. Renamed some of the methods to reference buttons, and rearranged the order in which buttons are listed and dealt with to be more consistent with the order in the layout. Bug: 16014280 Change-Id: I40a9137d222daf6959a869c11e6ac763baa61788 --- InCallUI/res/drawable/btn_change_to_audio.xml | 29 ----- InCallUI/res/drawable/btn_change_to_voice.xml | 29 +++++ InCallUI/res/layout/call_button_fragment.xml | 6 +- InCallUI/res/values/strings.xml | 6 +- .../com/android/incallui/CallButtonFragment.java | 95 +++++++++++++--- .../com/android/incallui/CallButtonPresenter.java | 121 +++++++++++++++------ 6 files changed, 202 insertions(+), 84 deletions(-) delete mode 100644 InCallUI/res/drawable/btn_change_to_audio.xml create mode 100644 InCallUI/res/drawable/btn_change_to_voice.xml diff --git a/InCallUI/res/drawable/btn_change_to_audio.xml b/InCallUI/res/drawable/btn_change_to_audio.xml deleted file mode 100644 index 974dd4a2e..000000000 --- a/InCallUI/res/drawable/btn_change_to_audio.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/InCallUI/res/drawable/btn_change_to_voice.xml b/InCallUI/res/drawable/btn_change_to_voice.xml new file mode 100644 index 000000000..974dd4a2e --- /dev/null +++ b/InCallUI/res/drawable/btn_change_to_voice.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml index a35cc5e3a..6b7e17aa9 100644 --- a/InCallUI/res/layout/call_button_fragment.xml +++ b/InCallUI/res/layout/call_button_fragment.xml @@ -83,10 +83,10 @@ android:contentDescription="@string/onscreenAudioText" /> - diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index 3795aa540..dbbfc129c 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -303,9 +303,9 @@ Video call - - Change to audio call + + Change to voice call Switch camera diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 3b06f1af1..93bb00145 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -40,13 +40,18 @@ public class CallButtonFragment implements CallButtonPresenter.CallButtonUi, OnMenuItemClickListener, OnDismissListener, View.OnClickListener, CompoundButton.OnCheckedChangeListener { - private ImageButton mMuteButton; private ImageButton mAudioButton; - private ImageButton mHoldButton; + private ImageButton mChangeToVoiceButton; + private ImageButton mMuteButton; private ImageButton mShowDialpadButton; - private ImageButton mMergeButton; - private ImageButton mAddCallButton; + private ImageButton mHoldButton; private ImageButton mSwapButton; + private ImageButton mChangeToVideoButton; + private ImageButton mSwitchCameraButton; + private ImageButton mAddCallButton; + private ImageButton mMergeButton; + private ImageButton mPauseVideoButton; + private ImageButton mOverflowButton; private PopupMenu mAudioModePopup; private boolean mAudioModePopupVisible; @@ -125,14 +130,24 @@ public class CallButtonFragment } }); + mChangeToVoiceButton = (ImageButton) parent.findViewById(R.id.changeToVoiceButton); + mChangeToVoiceButton. setOnClickListener(this); mShowDialpadButton = (ImageButton) parent.findViewById(R.id.dialpadButton); mShowDialpadButton.setOnClickListener(this); + mSwapButton = (ImageButton) parent.findViewById(R.id.swapButton); + mSwapButton.setOnClickListener(this); + mChangeToVideoButton = (ImageButton) parent.findViewById(R.id.changeToVideoButton); + mChangeToVideoButton.setOnClickListener(this); + mSwitchCameraButton = (ImageButton) parent.findViewById(R.id.switchCameraButton); + mSwitchCameraButton.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); + mPauseVideoButton = (ImageButton) parent.findViewById(R.id.pauseVideoButton); + mPauseVideoButton.setOnClickListener(this); + mOverflowButton = (ImageButton) parent.findViewById(R.id.overflowButton); + mOverflowButton.setOnClickListener(this); return parent; } @@ -175,6 +190,13 @@ public class CallButtonFragment case R.id.dialpadButton: getPresenter().showDialpadClicked(!mShowDialpadButton.isSelected()); break; + case R.id.changeToVoiceButton: + case R.id.changeToVideoButton: + case R.id.switchCameraButton: + case R.id.pauseVideoButton: + case R.id.overflowButton: + // TODO: Implement these button behaviors. + break; default: Log.wtf(this, "onClick: unexpected"); break; @@ -189,14 +211,18 @@ public class CallButtonFragment view.setVisibility(View.VISIBLE); } - // The smaller buttons laid out horizontally just below the end-call button. - mMuteButton.setEnabled(isEnabled); mAudioButton.setEnabled(isEnabled); - mHoldButton.setEnabled(isEnabled); + mChangeToVoiceButton.setEnabled(isEnabled); + mMuteButton.setEnabled(isEnabled); mShowDialpadButton.setEnabled(isEnabled); - mMergeButton.setEnabled(isEnabled); - mAddCallButton.setEnabled(isEnabled); + mHoldButton.setEnabled(isEnabled); mSwapButton.setEnabled(isEnabled); + mChangeToVideoButton.setEnabled(isEnabled); + mSwitchCameraButton.setEnabled(isEnabled); + mAddCallButton.setEnabled(isEnabled); + mMergeButton.setEnabled(isEnabled); + mPauseVideoButton.setEnabled(isEnabled); + mOverflowButton.setEnabled(isEnabled); } @Override @@ -204,18 +230,33 @@ public class CallButtonFragment mMuteButton.setSelected(value); } + @Override + public void showAudioButton(boolean show) { + mAudioButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + + @Override + public void showChangeToVoiceButton(boolean show) { + mChangeToVoiceButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + @Override public void enableMute(boolean enabled) { mMuteButton.setEnabled(enabled); } + @Override + public void showDialpadButton(boolean show) { + mShowDialpadButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + @Override public void setHold(boolean value) { mHoldButton.setSelected(value); } @Override - public void showHold(boolean show) { + public void showHoldButton(boolean show) { mHoldButton.setVisibility(show ? View.VISIBLE : View.GONE); } @@ -225,17 +266,22 @@ public class CallButtonFragment } @Override - public void showMerge(boolean show) { - mMergeButton.setVisibility(show ? View.VISIBLE : View.GONE); + public void showSwapButton(boolean show) { + mSwapButton.setVisibility(show ? View.VISIBLE : View.GONE); } @Override - public void showSwap(boolean show) { - mSwapButton.setVisibility(show ? View.VISIBLE : View.GONE); + public void showChangeToVideoButton(boolean show) { + mChangeToVideoButton.setVisibility(show ? View.VISIBLE : View.GONE); } @Override - public void showAddCall(boolean show) { + public void showSwitchCameraButton(boolean show) { + mSwitchCameraButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + + @Override + public void showAddCallButton(boolean show) { mAddCallButton.setVisibility(show ? View.VISIBLE : View.GONE); } @@ -244,6 +290,21 @@ public class CallButtonFragment mAddCallButton.setEnabled(enabled); } + @Override + public void showMergeButton(boolean show) { + mMergeButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + + @Override + public void showPauseVideoButton(boolean show) { + mPauseVideoButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + + @Override + public void showOverflowButton(boolean show) { + mOverflowButton.setVisibility(show ? View.VISIBLE : View.GONE); + } + @Override public void setAudio(int mode) { updateAudioButtons(getPresenter().getSupportedAudio()); diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index 7867f4304..4f457b8c2 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -16,7 +16,6 @@ package com.android.incallui; -import android.content.Context; import android.telecomm.CallCapabilities; import com.android.contacts.common.util.PhoneNumberHelper; @@ -27,7 +26,6 @@ import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; import com.android.services.telephony.common.AudioMode; -import android.app.Fragment; import android.telephony.PhoneNumberUtils; /** @@ -229,6 +227,60 @@ public class CallButtonPresenter extends Presenter