diff options
-rw-r--r-- | InCallUI/res/layout/call_button_fragment.xml | 2 | ||||
-rw-r--r-- | InCallUI/res/values/strings.xml | 6 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonFragment.java | 21 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonPresenter.java | 4 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/VideoUtils.java | 8 |
5 files changed, 29 insertions, 12 deletions
diff --git a/InCallUI/res/layout/call_button_fragment.xml b/InCallUI/res/layout/call_button_fragment.xml index 6dbfbf73a..802e3de62 100644 --- a/InCallUI/res/layout/call_button_fragment.xml +++ b/InCallUI/res/layout/call_button_fragment.xml @@ -126,7 +126,7 @@ <ToggleButton android:id="@+id/pauseVideoButton" style="@style/InCallCompoundButton" android:background="@drawable/btn_compound_video_off" - android:contentDescription="@string/onscreenPauseVideoText" + android:contentDescription="@string/onscreenTurnOffCameraText" android:visibility="gone" /> <!-- "Change to audio call" for video calls. --> diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index a15a2ff3f..d18c893ad 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -326,8 +326,10 @@ <!-- 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> - <!-- Text for the onscreen "Pause video" button. --> - <string name="onscreenPauseVideoText">Pause video</string> + <!-- Text for the onscreen "turn on camera" button. --> + <string name="onscreenTurnOnCameraText">Turn on camera</string> + <!-- Text for the onscreen "turn off camera" button. --> + <string name="onscreenTurnOffCameraText">Turn off camera</string> <!-- Text for the onscreen overflow button, to see additional actions which can be done. --> <string name="onscreenOverflowText">More options</string> diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 5a25b6a7b..6b633eaf3 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -65,7 +65,6 @@ public class CallButtonFragment implements CallButtonPresenter.CallButtonUi, OnMenuItemClickListener, OnDismissListener, View.OnClickListener { - private static final int INVALID_INDEX = -1; private int mButtonMaxVisible; // The button is currently visible in the UI private static final int BUTTON_VISIBLE = 1; @@ -182,7 +181,7 @@ public class CallButtonFragment super.onActivityCreated(savedInstanceState); // set the buttons - updateAudioButtons(getPresenter().getSupportedAudio()); + updateAudioButtons(); } @Override @@ -425,8 +424,14 @@ public class CallButtonFragment } @Override - public void setVideoPaused(boolean isPaused) { - mPauseVideoButton.setSelected(isPaused); + public void setVideoPaused(boolean isVideoPaused) { + mPauseVideoButton.setSelected(isVideoPaused); + + if (isVideoPaused) { + mPauseVideoButton.setContentDescription(getText(R.string.onscreenTurnOnCameraText)); + } else { + mPauseVideoButton.setContentDescription(getText(R.string.onscreenTurnOffCameraText)); + } } @Override @@ -505,7 +510,7 @@ public class CallButtonFragment @Override public void setAudio(int mode) { - updateAudioButtons(getPresenter().getSupportedAudio()); + updateAudioButtons(); refreshAudioModePopup(); if (mPrevAudioMode != mode) { @@ -516,7 +521,7 @@ public class CallButtonFragment @Override public void setSupportedAudio(int modeMask) { - updateAudioButtons(modeMask); + updateAudioButtons(); refreshAudioModePopup(); } @@ -555,7 +560,7 @@ public class CallButtonFragment public void onDismiss(PopupMenu menu) { Log.d(this, "- onDismiss: " + menu); mAudioModePopupVisible = false; - updateAudioButtons(getPresenter().getSupportedAudio()); + updateAudioButtons(); } /** @@ -600,7 +605,7 @@ public class CallButtonFragment * Updates the audio button so that the appriopriate visual layers * are visible based on the supported audio formats. */ - private void updateAudioButtons(int supportedModes) { + private void updateAudioButtons() { final boolean bluetoothSupported = isSupported(CallAudioState.ROUTE_BLUETOOTH); final boolean speakerSupported = isSupported(CallAudioState.ROUTE_SPEAKER); diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index e8c2d4b13..df1cd6645 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -366,7 +366,6 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto private void updateButtonsState(Call call) { Log.v(this, "updateButtonsState"); final CallButtonUi ui = getUi(); - final boolean isVideo = VideoUtils.isVideoCall(call); // Common functionality (audio, hold, etc). @@ -398,6 +397,9 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto ui.showButton(BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio); ui.showButton(BUTTON_SWITCH_CAMERA, isVideo); ui.showButton(BUTTON_PAUSE_VIDEO, isVideo); + if (isVideo) { + getUi().setVideoPaused(!VideoUtils.isTransmissionEnabled(call)); + } ui.showButton(BUTTON_DIALPAD, true); ui.showButton(BUTTON_MERGE, showMerge); diff --git a/InCallUI/src/com/android/incallui/VideoUtils.java b/InCallUI/src/com/android/incallui/VideoUtils.java index 8641d60ec..a2eb8bcf2 100644 --- a/InCallUI/src/com/android/incallui/VideoUtils.java +++ b/InCallUI/src/com/android/incallui/VideoUtils.java @@ -45,6 +45,14 @@ public class VideoUtils { return VideoProfile.isBidirectional(call.getVideoState()); } + public static boolean isTransmissionEnabled(Call call) { + if (!CompatUtils.isVideoCompatible()) { + return false; + } + + return VideoProfile.isTransmissionEnabled(call.getVideoState()); + } + public static boolean isIncomingVideoCall(Call call) { if (!VideoUtils.isVideoCall(call)) { return false; |