Directly use the video activity in video call

This commit is contained in:
Sylvain Berfini 2012-04-10 16:31:52 +02:00
parent 24bf3ec4d7
commit 2b68eab7ae
3 changed files with 26 additions and 5 deletions

View file

@ -141,7 +141,10 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
// the above method takes care of Samsung Galaxy S // the above method takes care of Samsung Galaxy S
Toast.makeText(this, R.string.couldnt_accept_call, Toast.LENGTH_LONG); Toast.makeText(this, R.string.couldnt_accept_call, Toast.LENGTH_LONG);
} else { } else {
LinphoneActivity.instance().startIncallActivity(); if (mCall.getCurrentParamsCopy().getVideoEnabled())
LinphoneActivity.instance().startVideoActivity(mCall, 0);
else
LinphoneActivity.instance().startIncallActivity();
} }
} }
@Override @Override

View file

@ -190,7 +190,14 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
if(LinphoneManager.getLc().isInComingInvitePending()) { if(LinphoneManager.getLc().isInComingInvitePending()) {
startIncomingCallActivity(); startIncomingCallActivity();
} else { } else {
startIncallActivity(); LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall();
if (currentCall == null)
return;
if (currentCall.getCurrentParamsCopy().getVideoEnabled())
startVideoActivity(currentCall, 0);
else
startIncallActivity();
} }
return; return;
} }
@ -461,12 +468,17 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
} }
if (state==State.IncomingReceived) { if (state==State.IncomingReceived) {
if (call.getCurrentParamsCopy().getVideoEnabled()) startOrientationSensor(); if (call.getCurrentParamsCopy().getVideoEnabled())
startOrientationSensor();
startIncomingCallActivity(); startIncomingCallActivity();
} }
if (state == State.OutgoingInit) { if (state == State.OutgoingInit) {
if (call.getCurrentParamsCopy().getVideoEnabled()) startOrientationSensor(); if (call.getCurrentParamsCopy().getVideoEnabled()) {
startIncallActivity(); startOrientationSensor();
startVideoActivity(call, 0);
} else {
startIncallActivity();
}
} }
if (state == LinphoneCall.State.StreamsRunning && Version.isVideoCapable() && !call.isInConference()) { if (state == LinphoneCall.State.StreamsRunning && Version.isVideoCapable() && !call.isInConference()) {
@ -474,15 +486,18 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
// set in LinphoneManager#onCallStateChanged(OutgoingInit||IncomingReceived) // set in LinphoneManager#onCallStateChanged(OutgoingInit||IncomingReceived)
boolean videoEnabled = call.cameraEnabled() && call.getCurrentParamsCopy().getVideoEnabled(); boolean videoEnabled = call.cameraEnabled() && call.getCurrentParamsCopy().getVideoEnabled();
if (videoEnabled) { if (videoEnabled) {
finishActivity(incall_activity);
startVideoActivity(call, 1000); startVideoActivity(call, 1000);
} else { } else {
finishActivity(video_activity); finishActivity(video_activity);
startIncallActivity();
} }
} }
if (state == LinphoneCall.State.CallUpdatedByRemote && Version.isVideoCapable()) { if (state == LinphoneCall.State.CallUpdatedByRemote && Version.isVideoCapable()) {
if (VideoCallActivity.launched && !call.getCurrentParamsCopy().getVideoEnabled()) { if (VideoCallActivity.launched && !call.getCurrentParamsCopy().getVideoEnabled()) {
finishActivity(video_activity); finishActivity(video_activity);
startIncallActivity();
} }
} }

View file

@ -162,6 +162,9 @@ public class CameraView extends ViewGroup implements SurfaceHolder.Callback {
} }
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
if (mCamera == null)
return;
mCamera.stopPreview(); mCamera.stopPreview();
Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Camera.Parameters parameters = mCamera.getParameters(); Camera.Parameters parameters = mCamera.getParameters();