From ebef6b94037a2a028635a5371f3d8e0f97c7d206 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 10 May 2016 08:39:54 -0700 Subject: Cleanup of video pause button. The "pause video" button had a few issues that needed to be cleaned up: 1. The accessibility text for the button was always "pause video". I've changed this so that it says, "Turn on camera" or "Turn off camera" to better indicate what pushing the button will do. 2. When the user accepts an incoming request to initiate a 1-way video call, the button state would not be correct (the user's camera is disabled, but the button would not reflect that). Bug: 27944419 Bug: 28550284 Change-Id: I2594971ec21b5714ca2d750894a93b758f7a80e5 --- InCallUI/res/layout/call_button_fragment.xml | 2 +- InCallUI/res/values/strings.xml | 6 ++++-- .../com/android/incallui/CallButtonFragment.java | 21 +++++++++++++-------- .../com/android/incallui/CallButtonPresenter.java | 4 +++- InCallUI/src/com/android/incallui/VideoUtils.java | 8 ++++++++ 5 files changed, 29 insertions(+), 12 deletions(-) (limited to 'InCallUI') 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 @@ diff --git a/InCallUI/res/values/strings.xml b/InCallUI/res/values/strings.xml index 57a1b5389..7701cdb2d 100644 --- a/InCallUI/res/values/strings.xml +++ b/InCallUI/res/values/strings.xml @@ -313,8 +313,10 @@ Switch camera - - Pause video + + Turn on camera + + Turn off camera More options 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