summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuresh Koleti <skolet@codeaurora.org>2014-11-07 16:51:54 +0530
committerArne Coucheron <arco68@gmail.com>2014-12-13 01:45:57 +0100
commitcab229e2b22638a803c37615b30ba1d139ec7230 (patch)
tree2b6c5122e3b08f46e8dab08b64dc845486d49bb1
parent97982cd3f3a8508e159ed70fd4b1c6a9a2fa3ac2 (diff)
downloadpackages_apps_InCallUI-cab229e2b22638a803c37615b30ba1d139ec7230.tar.gz
packages_apps_InCallUI-cab229e2b22638a803c37615b30ba1d139ec7230.tar.bz2
packages_apps_InCallUI-cab229e2b22638a803c37615b30ba1d139ec7230.zip
IMS-VT: Cleanup video views when not required
- Hide video views when not required. Change-Id: Idf33a35594ceb5892fbf8aba18177446c7df20f0 CRs-Fixed: 754002
-rw-r--r--src/com/android/incallui/VideoCallFragment.java66
-rw-r--r--src/com/android/incallui/VideoCallPresenter.java34
2 files changed, 90 insertions, 10 deletions
diff --git a/src/com/android/incallui/VideoCallFragment.java b/src/com/android/incallui/VideoCallFragment.java
index 99cb47e3..e7914296 100644
--- a/src/com/android/incallui/VideoCallFragment.java
+++ b/src/com/android/incallui/VideoCallFragment.java
@@ -542,13 +542,11 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
}
/**
- * Toggles visibility of the video UI.
+ * Inflate video surfaces.
*
* @param show {@code True} if the video surfaces should be shown.
*/
- @Override
- public void showVideoUi(boolean show) {
- Log.d(this, "showVideoUi " + show);
+ private void inflateVideoUi(boolean show) {
int visibility = show ? View.VISIBLE : View.GONE;
getView().setVisibility(visibility);
@@ -556,12 +554,70 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
inflateVideoCallViews();
}
- if (mVideoViews != null ) {
+ if (mVideoViews != null) {
mVideoViews.setVisibility(visibility);
}
}
/**
+ * Show Tranmission UI and hide Reception UI.
+ */
+ public void showVideoTransmissionUi() {
+ inflateVideoUi(true);
+
+ View incomingVideoView = mVideoViews.findViewById(R.id.incomingVideo);
+ View previewVideoView = mVideoViews.findViewById(R.id.previewVideo);
+
+ if (incomingVideoView != null) {
+ incomingVideoView.setVisibility(View.INVISIBLE);
+ }
+ if (previewVideoView != null) {
+ previewVideoView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ /**
+ * Show Reception UI and hide Tranmission UI.
+ */
+ public void showVideoReceptionUi() {
+ inflateVideoUi(true);
+
+ View incomingVideoView = mVideoViews.findViewById(R.id.incomingVideo);
+ View previewVideoView = mVideoViews.findViewById(R.id.previewVideo);
+
+ if (incomingVideoView != null) {
+ incomingVideoView.setVisibility(View.VISIBLE);
+ }
+ if (previewVideoView != null) {
+ previewVideoView.setVisibility(View.INVISIBLE);
+ }
+ }
+
+ /**
+ * Show all video views.
+ */
+ public void showVideoBidrectionalUi() {
+ inflateVideoUi(true);
+
+ View incomingVideoView = mVideoViews.findViewById(R.id.incomingVideo);
+ View previewVideoView = mVideoViews.findViewById(R.id.previewVideo);
+
+ if (incomingVideoView != null) {
+ incomingVideoView.setVisibility(View.VISIBLE);
+ }
+ if (previewVideoView != null) {
+ previewVideoView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ /**
+ * Hide all video views.
+ */
+ public void hideVideoUi() {
+ inflateVideoUi(false);
+ }
+
+ /**
* Displays a message on the UI that the video call quality has changed.
*
*/
diff --git a/src/com/android/incallui/VideoCallPresenter.java b/src/com/android/incallui/VideoCallPresenter.java
index 00e1236e..4c43e4a8 100644
--- a/src/com/android/incallui/VideoCallPresenter.java
+++ b/src/com/android/incallui/VideoCallPresenter.java
@@ -494,14 +494,14 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* TODO(vt): Need to adjust size and orientation of preview surface here.
*/
private void enterVideoMode(int newVideoState) {
- Log.d(this, "enterVideoMode mVideoCall=" + mVideoCall);
+ Log.d(this, "enterVideoMode mVideoCall= " + mVideoCall + " videoState: " + newVideoState);
VideoCallUi ui = getUi();
if (ui == null) {
Log.e(this, "Error VideoCallUi is null so returning");
return;
}
- ui.showVideoUi(true);
+ showVideoUi(newVideoState);
InCallPresenter.getInstance().setInCallAllowsOrientationChange(true);
// Communicate the current camera to telephony and make a request for the camera
@@ -578,18 +578,39 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
InCallPresenter.getInstance().setInCallAllowsOrientationChange(false);
- ui.showVideoUi(false);
+ mCurrentVideoState = VideoProfile.VideoState.AUDIO_ONLY;
+ showVideoUi(mCurrentVideoState);
if (mPreVideoAudioMode != AudioModeProvider.AUDIO_MODE_INVALID) {
TelecomAdapter.getInstance().setAudioRoute(mPreVideoAudioMode);
mPreVideoAudioMode = AudioModeProvider.AUDIO_MODE_INVALID;
}
- mCurrentVideoState = VideoProfile.VideoState.AUDIO_ONLY;
enableCamera(false);
}
/**
+ * Show video Ui depends on video state.
+ */
+ private void showVideoUi(int videoState) {
+ VideoCallUi ui = getUi();
+ if (ui == null) {
+ Log.e(this, "showVideoUi, VideoCallUi is null returning");
+ return;
+ }
+
+ if (VideoProfile.VideoState.isBidirectional(videoState)) {
+ ui.showVideoBidrectionalUi();
+ } else if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) {
+ ui.showVideoTransmissionUi();
+ } else if (VideoProfile.VideoState.isReceptionEnabled(videoState)) {
+ ui.showVideoReceptionUi();
+ } else {
+ ui.hideVideoUi();
+ }
+ }
+
+ /**
* Handles peer video pause state changes.
*
* @param call The call which paused or un-pausedvideo transmission.
@@ -860,7 +881,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* Defines the VideoCallUI interactions.
*/
public interface VideoCallUi extends Ui {
- void showVideoUi(boolean show);
+ void showVideoBidrectionalUi();
+ void showVideoTransmissionUi();
+ void showVideoReceptionUi();
+ void hideVideoUi();
void showVideoQualityChanged(int videoQuality);
boolean isDisplayVideoSurfaceCreated();
boolean isPreviewVideoSurfaceCreated();