summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-07-18 12:04:03 -0700
committerAndrew Lee <anwlee@google.com>2014-07-18 13:09:03 -0700
commit137f67c0d87a8a28be94a07e1c7f05219aacbcb7 (patch)
treeea1d779dba57c0abf25c8b3e03933e3a56e6c56a
parentaf947faa14e8c77fe4d3a90927d0f11b42eb7e3f (diff)
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
-rw-r--r--InCallUI/res/drawable/btn_change_to_voice.xml (renamed from InCallUI/res/drawable/btn_change_to_audio.xml)0
-rw-r--r--InCallUI/res/layout/call_button_fragment.xml6
-rw-r--r--InCallUI/res/values/strings.xml6
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java95
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java121
5 files changed, 173 insertions, 55 deletions
diff --git a/InCallUI/res/drawable/btn_change_to_audio.xml b/InCallUI/res/drawable/btn_change_to_voice.xml
index 974dd4a2e..974dd4a2e 100644
--- a/InCallUI/res/drawable/btn_change_to_audio.xml
+++ b/InCallUI/res/drawable/btn_change_to_voice.xml
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" />
<!-- "Change to audio call" for video calls. -->
- <ImageButton android:id="@+id/changeToAudioButton"
+ <ImageButton android:id="@+id/changeToVoiceButton"
style="@style/InCallButton"
- android:background="@drawable/btn_change_to_audio"
- android:contentDescription="@string/onscreenChangeToAudioText"
+ android:background="@drawable/btn_change_to_voice"
+ android:contentDescription="@string/onscreenChangeToVoiceText"
android:visibility="gone" />
<!-- MIDDLE LEFT SLOT ================================================================== -->
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 @@
<!-- Text for the onscreen "Video call" button used to change a voice call
to a video call. [CHAR LIMIT=10] -->
<string name="onscreenVideoCallText">Video call</string>
- <!-- Text for the onscreen "Change to audio" button. When clicked, this downgrades a video call
- to an audio call. -->
- <string name="onscreenChangeToAudioText">Change to audio call</string>
+ <!-- Text for the onscreen "Change to voice" button. When clicked, this downgrades a video call
+ to a voice call. -->
+ <string name="onscreenChangeToVoiceText">Change to voice call</string>
<!-- Text for the onscreen "Switch camera" button. When clicked, this switches the user's camera
for video calling between the front-facing camera and the back-facing camera. -->
<string name="onscreenSwitchCameraText">Switch camera</string>
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
@@ -205,17 +231,32 @@ public class CallButtonFragment
}
@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);
}
@@ -245,6 +291,21 @@ public class CallButtonFragment
}
@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());
refreshAudioModePopup();
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<CallButtonPresenter.CallButto
return;
}
+ if (call.isVideoCall()) {
+ updateVideoCallButtons(call);
+ } else {
+ updateVoiceCallButtons(call);
+ }
+
+ ui.enableMute(call.can(CallCapabilities.MUTE));
+
+ // Finally, update the "extra button row": It's displayed above the "End" button, but only
+ // if necessary. It's never displayed while the dialpad is visible since it would overlap.
+ //
+ // The row contains two buttons:
+ // - "Manage conference" (used only on GSM devices)
+ // - "Merge" button (used only on CDMA devices)
+ final boolean canMerge = call.can(CallCapabilities.MERGE_CALLS);
+ final boolean isGenericConference = call.can(CallCapabilities.GENERIC_CONFERENCE);
+ mShowGenericMerge = isGenericConference && canMerge;
+ mShowManageConference = (call.isConferenceCall() && !isGenericConference);
+ updateExtraButtonRow();
+ }
+
+ private void updateVideoCallButtons(Call call) {
+ Log.v(this, "Showing buttons for video call.");
+ final CallButtonUi ui = getUi();
+
+ // Hide all voice-call-related buttons.
+ ui.showAudioButton(false);
+ ui.showDialpadButton(false);
+ ui.showHoldButton(false);
+ ui.showSwapButton(false);
+ ui.showChangeToVideoButton(false);
+ ui.showAddCallButton(false);
+ ui.showMergeButton(false);
+ ui.showOverflowButton(false);
+
+ // Show all video-call-related buttons.
+ ui.showChangeToVoiceButton(true);
+ ui.showSwitchCameraButton(true);
+ ui.showPauseVideoButton(true);
+ }
+
+ private void updateVoiceCallButtons(Call call) {
+ Log.v(this, "Showing buttons for voice call.");
+ final CallButtonUi ui = getUi();
+
+ // Hide all video-call-related buttons.
+ ui.showChangeToVoiceButton(false);
+ ui.showSwitchCameraButton(false);
+ ui.showPauseVideoButton(false);
+
+ // Show all voice-call-related buttons.
+ ui.showAudioButton(true);
+ ui.showDialpadButton(true);
+
Log.v(this, "Show hold ", call.can(CallCapabilities.SUPPORT_HOLD));
Log.v(this, "Enable hold", call.can(CallCapabilities.HOLD));
Log.v(this, "Show merge ", call.can(CallCapabilities.MERGE_CALLS));
@@ -242,37 +294,35 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
final boolean canHold = call.can(CallCapabilities.HOLD);
final boolean canSwap = call.can(CallCapabilities.SWAP_CALLS);
final boolean supportHold = call.can(CallCapabilities.SUPPORT_HOLD);
+ boolean canVideoCall = call.can(CallCapabilities.SUPPORTS_VT_LOCAL)
+ && call.can(CallCapabilities.SUPPORTS_VT_REMOTE);
final boolean showMerge = !isGenericConference && canMerge;
- // Show either MERGE or ADD button, but not both.
- ui.showMerge(showMerge);
- ui.showAddCall(!showMerge);
- ui.enableAddCall(!showMerge && canAdd);
-
- // Show either HOLD or SWAP button, but not both.
- // If neither HOLD or SWAP is available:
- // (1) If the device normally can hold/swap, show HOLD in a disabled state.
- // (2) If the device doesn't have the concept of hold/swap, remove the button.
- ui.showHold(canHold || (!canSwap && supportHold));
- ui.showSwap(!canHold && canSwap);
- ui.setHold(call.getState() == Call.State.ONHOLD);
- ui.enableHold(canHold);
-
- ui.enableMute(call.can(CallCapabilities.MUTE));
+ ui.showChangeToVideoButton(canVideoCall);
- // Finally, update the "extra button row": It's displayed above the
- // "End" button, but only if necessary. Also, it's never displayed
- // while the dialpad is visible (since it would overlap.)
- //
- // The row contains two buttons:
- //
- // - "Manage conference" (used only on GSM devices)
- // - "Merge" button (used only on CDMA devices)
+ if (canVideoCall && (canHold || canSwap || supportHold)) {
+ ui.showHoldButton(false);
+ ui.showSwapButton(false);
+ ui.showAddCallButton(false);
+ ui.showMergeButton(false);
- mShowGenericMerge = isGenericConference && canMerge;
- mShowManageConference = (call.isConferenceCall() && !isGenericConference);
- updateExtraButtonRow();
+ ui.showOverflowButton(true);
+ } else {
+ // Show either MERGE or ADD button, but not both.
+ ui.showMergeButton(showMerge);
+ ui.showAddCallButton(!showMerge);
+ ui.enableAddCall(!showMerge && canAdd);
+
+ // Show either HOLD or SWAP button, but not both.
+ // If neither HOLD or SWAP is available:
+ // (1) If the device normally can hold/swap, show HOLD in a disabled state.
+ // (2) If the device doesn't have the concept of hold/swap, remove the button.
+ ui.showHoldButton(canHold || (!canSwap && supportHold));
+ ui.showSwapButton(!canHold && canSwap);
+ ui.setHold(call.getState() == Call.State.ONHOLD);
+ ui.enableHold(canHold);
+ }
}
private void updateExtraButtonRow() {
@@ -309,13 +359,20 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
void setEnabled(boolean on);
void setMute(boolean on);
void enableMute(boolean enabled);
+ void showAudioButton(boolean show);
+ void showChangeToVoiceButton(boolean show);
+ void showDialpadButton(boolean show);
void setHold(boolean on);
- void showHold(boolean show);
+ void showHoldButton(boolean show);
void enableHold(boolean enabled);
- void showMerge(boolean show);
- void showSwap(boolean show);
- void showAddCall(boolean show);
+ void showSwapButton(boolean show);
+ void showChangeToVideoButton(boolean show);
+ void showSwitchCameraButton(boolean show);
+ void showAddCallButton(boolean show);
void enableAddCall(boolean enabled);
+ void showMergeButton(boolean show);
+ void showPauseVideoButton(boolean show);
+ void showOverflowButton(boolean show);
void displayDialpad(boolean on, boolean animate);
boolean isDialpadVisible();
void setAudio(int mode);