Disable proximity listener on video

This commit is contained in:
Sylvain Berfini 2012-10-30 11:04:02 +01:00
parent 4e19827310
commit c9511926e4

View file

@ -339,7 +339,8 @@ public class InCallActivity extends FragmentActivity implements
params.setVideoEnabled(false); params.setVideoEnabled(false);
LinphoneManager.getLc().updateCall(call, params); LinphoneManager.getLc().updateCall(call, params);
video.setBackgroundResource(R.drawable.video_on); video.setBackgroundResource(R.drawable.video_on);
LinphoneManager.startProximitySensorForActivity(InCallActivity.this);
replaceFragmentVideoByAudio(); replaceFragmentVideoByAudio();
setCallControlsVisibleAndRemoveCallbacks(); setCallControlsVisibleAndRemoveCallbacks();
} else { } else {
@ -348,7 +349,8 @@ public class InCallActivity extends FragmentActivity implements
LinphoneManager.getInstance().routeAudioToSpeaker(); LinphoneManager.getInstance().routeAudioToSpeaker();
speaker.setBackgroundResource(R.drawable.speaker_on); speaker.setBackgroundResource(R.drawable.speaker_on);
video.setBackgroundResource(R.drawable.video_off); video.setBackgroundResource(R.drawable.video_off);
LinphoneManager.stopProximitySensorForActivity(InCallActivity.this);
replaceFragmentAudioByVideo(); replaceFragmentAudioByVideo();
displayVideoCallControlsIfHidden(); displayVideoCallControlsIfHidden();
} }
@ -966,11 +968,11 @@ public class InCallActivity extends FragmentActivity implements
protected void onResume() { protected void onResume() {
instance = this; instance = this;
LinphoneManager.addListener(this); LinphoneManager.addListener(this);
LinphoneManager.startProximitySensorForActivity(this);
if (isVideoEnabled) { if (isVideoEnabled) {
displayVideoCallControlsIfHidden(); displayVideoCallControlsIfHidden();
} else { } else {
LinphoneManager.startProximitySensorForActivity(this);
setCallControlsVisibleAndRemoveCallbacks(); setCallControlsVisibleAndRemoveCallbacks();
} }
@ -985,8 +987,10 @@ public class InCallActivity extends FragmentActivity implements
mControlsHandler.removeCallbacks(mControls); mControlsHandler.removeCallbacks(mControls);
} }
mControls = null; mControls = null;
LinphoneManager.stopProximitySensorForActivity(this); if (!isVideoEnabled) {
LinphoneManager.stopProximitySensorForActivity(this);
}
LinphoneManager.removeListener(this); LinphoneManager.removeListener(this);
} }