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