Fix incoming call dialog destruction on remote hang.

This commit is contained in:
Guillaume Beraudo 2011-03-24 11:28:45 +01:00
parent 244cae9246
commit 3cebf59104

View file

@ -90,6 +90,7 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
private static final String CURRENT_ADDRESS = "org.linphone.current-address"; private static final String CURRENT_ADDRESS = "org.linphone.current-address";
private static final String CURRENT_DISPLAYNAME = "org.linphone.current-displayname"; private static final String CURRENT_DISPLAYNAME = "org.linphone.current-displayname";
private static final int INCOMING_CALL_DIALOG_ID = 1;
/** /**
* @return null if not ready yet * @return null if not ready yet
@ -262,6 +263,11 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
private void exitCallMode() { private void exitCallMode() {
// Remove dialog if existing
try {
dismissDialog(INCOMING_CALL_DIALOG_ID);
} catch (Throwable e) {/* Exception if never created */}
if (useIncallActivity) { if (useIncallActivity) {
LinphoneActivity.instance().closeIncallActivity(); LinphoneActivity.instance().closeIncallActivity();
} else { } else {
@ -294,6 +300,12 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
private void callPending(final LinphoneCall call) { private void callPending(final LinphoneCall call) {
showDialog(INCOMING_CALL_DIALOG_ID);
}
@Override
protected Dialog onCreateDialog(int id, Bundle b) {
String from = LinphoneManager.getInstance().extractIncomingRemoteName(); String from = LinphoneManager.getInstance().extractIncomingRemoteName();
View incomingCallView = getLayoutInflater().inflate(R.layout.incoming_call, null); View incomingCallView = getLayoutInflater().inflate(R.layout.incoming_call, null);
@ -314,20 +326,18 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
boolean videoMuted = !(prefVideoEnable && prefAutoShareMyCamera); boolean videoMuted = !(prefVideoEnable && prefAutoShareMyCamera);
AndroidCameraRecordManager.getInstance().setMuted(videoMuted); AndroidCameraRecordManager.getInstance().setMuted(videoMuted);
call.enableCamera(prefAutoShareMyCamera); LinphoneManager.getLc().getCurrentCall().enableCamera(prefAutoShareMyCamera);
} }
}); });
((HangCallButton) incomingCallView.findViewById(R.id.Decline)).setExternalClickListener(new OnClickListener() { ((HangCallButton) incomingCallView.findViewById(R.id.Decline)).setExternalClickListener(new OnClickListener() {
public void onClick(View v) {dialog.dismiss();} public void onClick(View v) {dialog.dismiss();}
}); });
dialog.show(); return dialog;
} }
public void newOutgoingCall(Intent intent) { public void newOutgoingCall(Intent intent) {
if (Intent.ACTION_CALL.equalsIgnoreCase(intent.getAction())) { if (Intent.ACTION_CALL.equalsIgnoreCase(intent.getAction())) {
mAddress.setText(intent.getData().getSchemeSpecificPart()); mAddress.setText(intent.getData().getSchemeSpecificPart());