Fix speaker

This commit is contained in:
Sylvain Berfini 2012-07-06 16:19:28 +02:00
parent 378cce4d7b
commit 7d61ddd0e7

View file

@ -42,7 +42,6 @@ import android.view.animation.AnimationUtils;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
//FIXME : Speaker
//FIXME : Chronometer for calls //FIXME : Chronometer for calls
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
@ -219,6 +218,10 @@ public class InCallActivity extends FragmentActivity implements
LinphoneManager.getLc().updateCall(call, params); LinphoneManager.getLc().updateCall(call, params);
replaceFragmentVideoByAudio(); replaceFragmentVideoByAudio();
isSpeakerEnabled = false;
LinphoneManager.getInstance().routeAudioToReceiver();
speaker.setImageResource(R.drawable.speaker_off);
video.setImageResource(R.drawable.video_on); video.setImageResource(R.drawable.video_on);
setCallControlsVisibleAndRemoveCallbacks(); setCallControlsVisibleAndRemoveCallbacks();
@ -227,10 +230,15 @@ public class InCallActivity extends FragmentActivity implements
LinphoneManager.getInstance().addVideo(); LinphoneManager.getInstance().addVideo();
} }
isSpeakerEnabled = true;
LinphoneManager.getInstance().routeAudioToSpeaker();
speaker.setImageResource(R.drawable.speaker_on);
replaceFragmentAudioByVideo(); replaceFragmentAudioByVideo();
video.setImageResource(R.drawable.video_off); video.setImageResource(R.drawable.video_off);
displayVideoCallControlsIfHidden(); displayVideoCallControlsIfHidden();
} }
LinphoneManager.getLc().enableSpeaker(true);
} }
}); });
} }
@ -243,7 +251,6 @@ public class InCallActivity extends FragmentActivity implements
try { try {
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
} catch (Exception e) { } catch (Exception e) {
transaction.commit();
} }
} }
@ -256,7 +263,6 @@ public class InCallActivity extends FragmentActivity implements
try { try {
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
} catch (Exception e) { } catch (Exception e) {
transaction.commit();
} }
} }
@ -280,6 +286,7 @@ public class InCallActivity extends FragmentActivity implements
LinphoneManager.getInstance().routeAudioToReceiver(); LinphoneManager.getInstance().routeAudioToReceiver();
speaker.setImageResource(R.drawable.speaker_off); speaker.setImageResource(R.drawable.speaker_off);
} }
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
} }
private void pause() { private void pause() {
@ -409,7 +416,6 @@ public class InCallActivity extends FragmentActivity implements
} }
isMicMuted = LinphoneManager.getLc().isMicMuted(); isMicMuted = LinphoneManager.getLc().isMicMuted();
isSpeakerEnabled = LinphoneManager.getLc().isSpeakerEnabled();
enableAndRefreshInCallActions(); enableAndRefreshInCallActions();
} }
} }