summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-03-13 17:20:34 -0700
committerYorke Lee <yorkelee@google.com>2015-03-17 14:14:58 -0700
commit99210688614b22e4be28803acf96ba2d0a2312ce (patch)
treebb37f892fcb0e9777bc88ddf1ed391da78575d79
parentcc630693631303cfb8c26a422466ae51cee49946 (diff)
Add VideoCallFragment back into InCallUI
Statically add VideoCallFragment into the view hierarchy so that video calls can be shown in the UI. Change-Id: I8afbaaa750371a4afe3946d268882f46f5ec7eb4
-rw-r--r--InCallUI/res/layout-land/call_card_fragment.xml12
-rw-r--r--InCallUI/res/layout/call_card_fragment.xml10
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/InCallVideoCallListener.java6
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallFragment.java10
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java16
6 files changed, 50 insertions, 8 deletions
diff --git a/InCallUI/res/layout-land/call_card_fragment.xml b/InCallUI/res/layout-land/call_card_fragment.xml
index 4c76b95de..ed4d41162 100644
--- a/InCallUI/res/layout-land/call_card_fragment.xml
+++ b/InCallUI/res/layout-land/call_card_fragment.xml
@@ -37,7 +37,7 @@
<fragment android:name="com.android.incallui.CallButtonFragment"
android:id="@+id/callButtonFragment"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<FrameLayout
@@ -66,6 +66,14 @@
android:background="@android:color/white"
android:src="@drawable/img_no_image_automirrored" />
+ <fragment android:name="com.android.incallui.VideoCallFragment"
+ android:id="@+id/videoCallFragment"
+ android:layout_alignParentTop="true"
+ android:layout_gravity="top|center_horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone" />
+
<include layout="@layout/manage_conference_call_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -91,7 +99,7 @@
android:indeterminate="true" />
</FrameLayout>
- <!-- Placeholder for the dialpad which is replaced with the dialpad fragment when shown. -->
+ <!-- Placeholder for various fragments that are added dynamically underneath the caller info. -->
<FrameLayout
android:id="@+id/answer_and_dialpad_container"
android:layout_toEndOf="@id/primary_call_info_container"
diff --git a/InCallUI/res/layout/call_card_fragment.xml b/InCallUI/res/layout/call_card_fragment.xml
index 920f8cb4d..548eed4ed 100644
--- a/InCallUI/res/layout/call_card_fragment.xml
+++ b/InCallUI/res/layout/call_card_fragment.xml
@@ -98,7 +98,15 @@
android:layout_height="wrap_content"
android:layout_alignTop="@id/photo" />
- <!-- Placeholder for various fragments that are added dynamically underneath the caller info -->
+ <fragment android:name="com.android.incallui.VideoCallFragment"
+ android:layout_alignParentStart="true"
+ android:layout_gravity="start|center_vertical"
+ android:id="@+id/videoCallFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone" />
+
+ <!-- Placeholder for various fragments that are added dynamically underneath the caller info. -->
<FrameLayout
android:id="@+id/answer_and_dialpad_container"
android:layout_below="@id/primary_call_info_container"
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 9d1585660..3478b7dde 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -1264,6 +1264,10 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener,
* and landscape. {@Code False} if the in-call UI should be locked in portrait.
*/
public void setInCallAllowsOrientationChange(boolean allowOrientationChange) {
+ if (mInCallActivity == null) {
+ return;
+ }
+
if (!allowOrientationChange) {
mInCallActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
} else {
diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java
index 363bd4144..3d975dbb7 100644
--- a/InCallUI/src/com/android/incallui/InCallVideoCallListener.java
+++ b/InCallUI/src/com/android/incallui/InCallVideoCallListener.java
@@ -130,7 +130,9 @@ public class InCallVideoCallListener extends VideoCall.Listener {
*/
@Override
public void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities) {
- InCallVideoCallListenerNotifier.getInstance().cameraDimensionsChanged(
- mCall, cameraCapabilities.getWidth(), cameraCapabilities.getHeight());
+ if (cameraCapabilities != null) {
+ InCallVideoCallListenerNotifier.getInstance().cameraDimensionsChanged(
+ mCall, cameraCapabilities.getWidth(), cameraCapabilities.getHeight());
+ }
}
}
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java
index 7cc945ac9..6e4abfc26 100644
--- a/InCallUI/src/com/android/incallui/VideoCallFragment.java
+++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java
@@ -34,6 +34,8 @@ import android.view.ViewTreeObserver;
*/
public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
VideoCallPresenter.VideoCallUi> implements VideoCallPresenter.VideoCallUi {
+ private static final String TAG = VideoCallFragment.class.getSimpleName();
+ private static final boolean DEBUG = false;
/**
* Used to indicate that the surface dimensions are not set.
@@ -138,6 +140,10 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
* @param view The {@link TextureView}.
*/
public void recreateView(TextureView view) {
+ if (DEBUG) {
+ Log.i(TAG, "recreateView: " + view);
+ }
+
if (mTextureView == view) {
return;
}
@@ -163,6 +169,9 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width,
int height) {
boolean surfaceCreated;
+ if (DEBUG) {
+ Log.i(TAG, "onSurfaceTextureAvailable: " + surfaceTexture);
+ }
// Where there is no saved {@link SurfaceTexture} available, use the newly created one.
// If a saved {@link SurfaceTexture} is available, we are re-creating after an
// orientation change.
@@ -334,7 +343,6 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
-
super.onCreateView(inflater, container, savedInstanceState);
final View view = inflater.inflate(R.layout.video_call_fragment, container, false);
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index c566264c1..04d304b21 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -62,6 +62,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
InCallDetailsListener, SurfaceChangeListener, VideoEventListener,
InCallVideoCallListenerNotifier.SessionModificationListener {
+ private static final String TAG = VideoCallPresenter.class.getSimpleName();
+
+ public static final boolean DEBUG = false;
+
/**
* Determines the device orientation (portrait/lanscape).
*/
@@ -211,6 +215,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* @param surface The surface which was created.
*/
public void onSurfaceCreated(int surface) {
+ if (DEBUG) {
+ Log.i(TAG, "onSurfaceCreated: " + surface);
+ }
final VideoCallUi ui = getUi();
if (ui == null || mVideoCall == null) {
@@ -400,6 +407,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
* TODO(vt): Need to adjust size and orientation of preview surface here.
*/
private void enterVideoMode() {
+ if (DEBUG) {
+ Log.i(TAG, "enterVideoMode");
+ }
VideoCallUi ui = getUi();
if (ui == null) {
return;
@@ -422,7 +432,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
getInCallCameraManager();
mVideoCall.setCamera(cameraManager.getActiveCameraId());
mVideoCall.requestCameraCapabilities();
-
+ if (DEBUG) {
+ Log.i(TAG, "isDisplayVideoSurfacedCreated: " + ui.isDisplayVideoSurfaceCreated());
+ }
if (ui.isDisplayVideoSurfaceCreated()) {
mVideoCall.setDisplaySurface(ui.getDisplayVideoSurface());
}
@@ -561,7 +573,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
@Override
public void onDowngradeToAudio(Call call) {
- // Implementing to satsify interface.
+ // Implementing to satisfy interface.
}
/**