Display audio view when video call is in pause
This commit is contained in:
parent
35f05e03be
commit
be01630313
1 changed files with 35 additions and 14 deletions
|
@ -86,6 +86,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
private Animation slideOutLeftToRight, slideInRightToLeft, slideInBottomToTop, slideInTopToBottom, slideOutBottomToTop, slideOutTopToBottom;
|
||||
private CountDownTimer timer;
|
||||
private AcceptCallUpdateDialog callUpdateDialog;
|
||||
private boolean isVideoCallPaused = false;
|
||||
|
||||
public static InCallActivity instance() {
|
||||
return instance;
|
||||
|
@ -126,6 +127,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
// Fragment already created, no need to create it again (else it will generate a memory leak with duplicated fragments)
|
||||
isSpeakerEnabled = savedInstanceState.getBoolean("Speaker");
|
||||
isMicMuted = savedInstanceState.getBoolean("Mic");
|
||||
isVideoCallPaused = savedInstanceState.getBoolean("VideoCallPaused");
|
||||
refreshInCallActions();
|
||||
return;
|
||||
}
|
||||
|
@ -152,6 +154,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
protected void onSaveInstanceState(Bundle outState) {
|
||||
outState.putBoolean("Speaker", isSpeakerEnabled);
|
||||
outState.putBoolean("Mic", isMicMuted);
|
||||
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
@ -337,7 +340,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
|
||||
private void switchVideo(final boolean displayVideo) {
|
||||
final LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
final LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
if (call == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -349,13 +352,26 @@ public class InCallActivity extends FragmentActivity implements
|
|||
LinphoneCallParams params = call.getCurrentParamsCopy();
|
||||
params.setVideoEnabled(false);
|
||||
LinphoneManager.getLc().updateCall(call, params);
|
||||
|
||||
showAudioView();
|
||||
} else {
|
||||
LinphoneManager.getInstance().addVideo();
|
||||
|
||||
showVideoView();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showAudioView() {
|
||||
video.setBackgroundResource(R.drawable.video_on);
|
||||
|
||||
LinphoneManager.startProximitySensorForActivity(InCallActivity.this);
|
||||
replaceFragmentVideoByAudio();
|
||||
setCallControlsVisibleAndRemoveCallbacks();
|
||||
} else {
|
||||
LinphoneManager.getInstance().addVideo();
|
||||
}
|
||||
|
||||
private void showVideoView() {
|
||||
isSpeakerEnabled = true;
|
||||
LinphoneManager.getInstance().routeAudioToSpeaker();
|
||||
speaker.setBackgroundResource(R.drawable.speaker_on);
|
||||
|
@ -365,9 +381,6 @@ public class InCallActivity extends FragmentActivity implements
|
|||
replaceFragmentAudioByVideo();
|
||||
displayVideoCallControlsIfHidden();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void replaceFragmentVideoByAudio() {
|
||||
audioCallFragment = new AudioCallFragment();
|
||||
|
@ -434,6 +447,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
} else {
|
||||
lc.pauseCall(call);
|
||||
if (isVideoEnabled) {
|
||||
isVideoCallPaused = true;
|
||||
showAudioView();
|
||||
}
|
||||
pause.setImageResource(R.drawable.pause_on);
|
||||
}
|
||||
} else {
|
||||
|
@ -442,6 +459,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
LinphoneCall callToResume = pausedCalls.get(0);
|
||||
if ((call != null && callToResume.equals(call)) || call == null) {
|
||||
lc.resumeCall(callToResume);
|
||||
if (isVideoCallPaused) {
|
||||
isVideoCallPaused = false;
|
||||
showVideoView();
|
||||
}
|
||||
pause.setImageResource(R.drawable.pause_off);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue