Fix popup of video and zrtp on rotation
This commit is contained in:
parent
9754923a82
commit
6a8c3c7464
2 changed files with 27 additions and 7 deletions
|
@ -108,7 +108,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
private StatusFragment status;
|
private StatusFragment status;
|
||||||
private CallAudioFragment audioCallFragment;
|
private CallAudioFragment audioCallFragment;
|
||||||
private CallVideoFragment videoCallFragment;
|
private CallVideoFragment videoCallFragment;
|
||||||
private boolean isSpeakerEnabled = false, isMicMuted = false, isTransferAllowed;
|
private boolean isSpeakerEnabled = false, isMicMuted = false, isTransferAllowed, isVideoAsk;
|
||||||
private LinearLayout mControlsLayout;
|
private LinearLayout mControlsLayout;
|
||||||
private Numpad numpad;
|
private Numpad numpad;
|
||||||
private int cameraNumber;
|
private int cameraNumber;
|
||||||
|
@ -258,6 +258,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
TimeRemind = savedInstanceState.getLong("TimeRemind");
|
TimeRemind = savedInstanceState.getLong("TimeRemind");
|
||||||
createTimerForDialog(TimeRemind);
|
createTimerForDialog(TimeRemind);
|
||||||
}
|
}
|
||||||
|
if (status != null && savedInstanceState.getBoolean("AskingZrtp")) {
|
||||||
|
status.setisZrtpAsk(savedInstanceState.getBoolean("AskingZrtp"));
|
||||||
|
}
|
||||||
refreshInCallActions();
|
refreshInCallActions();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -313,8 +316,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled());
|
outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled());
|
||||||
outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted());
|
outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted());
|
||||||
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
||||||
outState.putBoolean("AskingVideo", (dialog != null));
|
outState.putBoolean("AskingVideo", isVideoAsk);
|
||||||
outState.putLong("TimeRemind", TimeRemind);
|
outState.putLong("TimeRemind", TimeRemind);
|
||||||
|
if (status != null) outState.putBoolean("AskingZrtp", status.getisZrtpAsk());
|
||||||
if (dialog != null) dialog.dismiss();
|
if (dialog != null) dialog.dismiss();
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
@ -1124,6 +1128,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
delete.setText(R.string.accept);
|
delete.setText(R.string.accept);
|
||||||
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||||
cancel.setText(R.string.decline);
|
cancel.setText(R.string.decline);
|
||||||
|
isVideoAsk = true;
|
||||||
|
|
||||||
delete.setOnClickListener(new OnClickListener() {
|
delete.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1136,7 +1141,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
} else {
|
} else {
|
||||||
checkAndRequestPermission(Manifest.permission.CAMERA, PERMISSIONS_REQUEST_CAMERA);
|
checkAndRequestPermission(Manifest.permission.CAMERA, PERMISSIONS_REQUEST_CAMERA);
|
||||||
}
|
}
|
||||||
|
isVideoAsk = false;
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
dialog = null;
|
dialog = null;
|
||||||
}
|
}
|
||||||
|
@ -1148,6 +1153,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
if (CallActivity.isInstanciated()) {
|
if (CallActivity.isInstanciated()) {
|
||||||
CallActivity.instance().acceptCallUpdate(false);
|
CallActivity.instance().acceptCallUpdate(false);
|
||||||
}
|
}
|
||||||
|
isVideoAsk = false;
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
dialog = null;
|
dialog = null;
|
||||||
}
|
}
|
||||||
|
@ -1170,6 +1176,10 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
refreshIncallUi();
|
refreshIncallUi();
|
||||||
handleViewIntent();
|
handleViewIntent();
|
||||||
|
|
||||||
|
if (status != null && status.getisZrtpAsk() && lc != null) {
|
||||||
|
status.showZRTPDialog(lc.getCurrentCall());
|
||||||
|
}
|
||||||
|
|
||||||
if (!isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) {
|
if (!isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) {
|
||||||
LinphoneManager.getInstance().enableProximitySensing(true);
|
LinphoneManager.getInstance().enableProximitySensing(true);
|
||||||
removeCallbacks();
|
removeCallbacks();
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class StatusFragment extends Fragment {
|
||||||
private TextView statusText, voicemailCount;
|
private TextView statusText, voicemailCount;
|
||||||
private ImageView statusLed, callQuality, encryption, menu, voicemail;
|
private ImageView statusLed, callQuality, encryption, menu, voicemail;
|
||||||
private Runnable mCallQualityUpdater;
|
private Runnable mCallQualityUpdater;
|
||||||
private boolean isInCall, isAttached = false;
|
private boolean isInCall, isAttached = false, isZrtpAsk;
|
||||||
private LinphoneCoreListenerBase mListener;
|
private LinphoneCoreListenerBase mListener;
|
||||||
private Dialog ZRTPdialog = null;
|
private Dialog ZRTPdialog = null;
|
||||||
private int mDisplayedQuality = -1;
|
private int mDisplayedQuality = -1;
|
||||||
|
@ -388,7 +388,7 @@ public class StatusFragment extends Fragment {
|
||||||
|
|
||||||
if(ZRTPdialog == null || !ZRTPdialog.isShowing()) {
|
if(ZRTPdialog == null || !ZRTPdialog.isShowing()) {
|
||||||
String token = call.getAuthenticationToken();
|
String token = call.getAuthenticationToken();
|
||||||
|
|
||||||
if (token == null){
|
if (token == null){
|
||||||
Log.w("Can't display ZRTP popup, no token !");
|
Log.w("Can't display ZRTP popup, no token !");
|
||||||
return;
|
return;
|
||||||
|
@ -397,7 +397,7 @@ public class StatusFragment extends Fragment {
|
||||||
Log.w("Can't display ZRTP popup, token is invalid ("+token+")");
|
Log.w("Can't display ZRTP popup, token is invalid ("+token+")");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZRTPdialog = new Dialog(getActivity());
|
ZRTPdialog = new Dialog(getActivity());
|
||||||
ZRTPdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
ZRTPdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorC));
|
Drawable d = new ColorDrawable(ContextCompat.getColor(getActivity(), R.color.colorC));
|
||||||
|
@ -406,7 +406,7 @@ public class StatusFragment extends Fragment {
|
||||||
ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
ZRTPdialog.getWindow().setBackgroundDrawable(d);
|
ZRTPdialog.getWindow().setBackgroundDrawable(d);
|
||||||
String zrtpToRead, zrtpToListen;
|
String zrtpToRead, zrtpToListen;
|
||||||
|
isZrtpAsk = true;
|
||||||
|
|
||||||
if (call.getDirection().equals(CallDirection.Incoming)) {
|
if (call.getDirection().equals(CallDirection.Incoming)) {
|
||||||
zrtpToRead = token.substring(0,2);
|
zrtpToRead = token.substring(0,2);
|
||||||
|
@ -432,6 +432,7 @@ public class StatusFragment extends Fragment {
|
||||||
if (encryption != null) {
|
if (encryption != null) {
|
||||||
encryption.setImageResource(R.drawable.security_ok);
|
encryption.setImageResource(R.drawable.security_ok);
|
||||||
}
|
}
|
||||||
|
isZrtpAsk = false;
|
||||||
ZRTPdialog.dismiss();
|
ZRTPdialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -445,10 +446,19 @@ public class StatusFragment extends Fragment {
|
||||||
encryption.setImageResource(R.drawable.security_ko);
|
encryption.setImageResource(R.drawable.security_ko);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isZrtpAsk = false;
|
||||||
ZRTPdialog.dismiss();
|
ZRTPdialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ZRTPdialog.show();
|
ZRTPdialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getisZrtpAsk() {
|
||||||
|
return isZrtpAsk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setisZrtpAsk(boolean bool) {
|
||||||
|
isZrtpAsk = bool;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue