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
Toast.makeText(this, R.string.couldnt_accept_call, Toast.LENGTH_LONG);
} else {
LinphoneActivity.instance().startIncallActivity();
if (mCall.getCurrentParamsCopy().getVideoEnabled())
LinphoneActivity.instance().startVideoActivity(mCall, 0);
else
LinphoneActivity.instance().startIncallActivity();
}
}
@Override

View file

@ -190,7 +190,14 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
if(LinphoneManager.getLc().isInComingInvitePending()) {
startIncomingCallActivity();
} else {
startIncallActivity();
LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall();
if (currentCall == null)
return;
if (currentCall.getCurrentParamsCopy().getVideoEnabled())
startVideoActivity(currentCall, 0);
else
startIncallActivity();
}
return;
}
@ -461,12 +468,17 @@ public class LinphoneActivity extends TabActivity implements ContactPicked
}
if (state==State.IncomingReceived) {
if (call.getCurrentParamsCopy().getVideoEnabled()) startOrientationSensor();
if (call.getCurrentParamsCopy().getVideoEnabled())
startOrientationSensor();
startIncomingCallActivity();
}
if (state == State.OutgoingInit) {
if (call.getCurrentParamsCopy().getVideoEnabled()) startOrientationSensor();
startIncallActivity();
if (call.getCurrentParamsCopy().getVideoEnabled()) {
startOrientationSensor();
startVideoActivity(call, 0);
} else {
startIncallActivity();
}
}
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)
boolean videoEnabled = call.cameraEnabled() && call.getCurrentParamsCopy().getVideoEnabled();
if (videoEnabled) {
finishActivity(incall_activity);
startVideoActivity(call, 1000);
} else {
finishActivity(video_activity);
startIncallActivity();
}
}
if (state == LinphoneCall.State.CallUpdatedByRemote && Version.isVideoCapable()) {
if (VideoCallActivity.launched && !call.getCurrentParamsCopy().getVideoEnabled()) {
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) {
if (mCamera == null)
return;
mCamera.stopPreview();
Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Camera.Parameters parameters = mCamera.getParameters();