Fixed issue 1805: Crash when rotating the in-call view while video popup is shown
This commit is contained in:
parent
fc5b05d865
commit
a2f3250575
2 changed files with 64 additions and 50 deletions
62
src/org/linphone/AcceptCallUpdateDialogFragment.java
Normal file
62
src/org/linphone/AcceptCallUpdateDialogFragment.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package org.linphone;
|
||||
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public class AcceptCallUpdateDialogFragment extends DialogFragment {
|
||||
|
||||
public AcceptCallUpdateDialogFragment() {
|
||||
// Empty constructor required for DialogFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.accept_call_update_dialog, container);
|
||||
|
||||
getDialog().setTitle(R.string.call_update_title);
|
||||
|
||||
Button yes = (Button) view.findViewById(R.id.yes);
|
||||
yes.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (InCallActivity.isInstanciated()) {
|
||||
Log.d("Call Update Accepted");
|
||||
InCallActivity.instance().acceptCallUpdate(true);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
Button no = (Button) view.findViewById(R.id.no);
|
||||
no.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (InCallActivity.isInstanciated()) {
|
||||
Log.d("Call Update Denied");
|
||||
InCallActivity.instance().acceptCallUpdate(false);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
InCallActivity.instance().acceptCallUpdate(false);
|
||||
}
|
||||
}
|
|
@ -100,7 +100,6 @@ public class InCallActivity extends FragmentActivity implements
|
|||
private int cameraNumber;
|
||||
private Animation slideOutLeftToRight, slideInRightToLeft, slideInBottomToTop, slideInTopToBottom, slideOutBottomToTop, slideOutTopToBottom;
|
||||
private CountDownTimer timer;
|
||||
private AcceptCallUpdateDialog callUpdateDialog;
|
||||
private boolean isVideoCallPaused = false;
|
||||
|
||||
private TableLayout callsList;
|
||||
|
@ -1062,14 +1061,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
finish();
|
||||
}
|
||||
|
||||
private void acceptCallUpdate(boolean accept) {
|
||||
public void acceptCallUpdate(boolean accept) {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
}
|
||||
|
||||
if (callUpdateDialog != null) {
|
||||
callUpdateDialog.dismissAllowingStateLoss();
|
||||
}
|
||||
|
||||
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null) {
|
||||
|
@ -1213,7 +1208,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
|
||||
private void showAcceptCallUpdateDialog() {
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
callUpdateDialog = new AcceptCallUpdateDialog();
|
||||
AcceptCallUpdateDialogFragment callUpdateDialog = new AcceptCallUpdateDialogFragment();
|
||||
callUpdateDialog.show(fm, "Accept Call Update Dialog");
|
||||
}
|
||||
|
||||
|
@ -1343,49 +1338,6 @@ public class InCallActivity extends FragmentActivity implements
|
|||
videoCallFragment = fragment;
|
||||
}
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
class AcceptCallUpdateDialog extends DialogFragment {
|
||||
|
||||
public AcceptCallUpdateDialog() {
|
||||
// Empty constructor required for DialogFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.accept_call_update_dialog, container);
|
||||
|
||||
getDialog().setTitle(R.string.call_update_title);
|
||||
|
||||
Button yes = (Button) view.findViewById(R.id.yes);
|
||||
yes.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d("Call Update Accepted");
|
||||
acceptCallUpdate(true);
|
||||
}
|
||||
});
|
||||
|
||||
Button no = (Button) view.findViewById(R.id.no);
|
||||
no.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d("Call Update Denied");
|
||||
acceptCallUpdate(false);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
|
||||
callUpdateDialog = new AcceptCallUpdateDialog();
|
||||
callUpdateDialog.show(getSupportFragmentManager(), "Accept Call Update Dialog");
|
||||
}
|
||||
}
|
||||
|
||||
private void displayConferenceHeader() {
|
||||
LinearLayout conferenceHeader = (LinearLayout) inflater.inflate(R.layout.conference_header, container, false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue