Fix status when leaving/coming back in call

This commit is contained in:
Sylvain Berfini 2012-09-19 17:03:12 +02:00
parent 5c20b51d19
commit 96d19d6c14

View file

@ -275,14 +275,19 @@ public class StatusFragment extends Fragment {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
LinphoneCore lc = LinphoneManager.getLc();
LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); LinphoneCall call = lc.getCurrentCall();
if (isInCall && (call != null || LinphoneManager.getLc().getConferenceSize() > 1)) { if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
startCallQuality();
if (call != null) { if (call != null) {
startCallQuality();
refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled()); refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
} }
exit.setVisibility(View.GONE);
statusText.setVisibility(View.GONE);
encryption.setVisibility(View.VISIBLE);
// We are obviously connected // We are obviously connected
statusLed.setImageResource(R.drawable.led_connected); statusLed.setImageResource(R.drawable.led_connected);
statusText.setText(getString(R.string.status_connected)); statusText.setText(getString(R.string.status_connected));
@ -291,6 +296,11 @@ public class StatusFragment extends Fragment {
drawer.lock(); drawer.lock();
} }
} else { } else {
exit.setVisibility(View.VISIBLE);
statusText.setVisibility(View.VISIBLE);
background.setVisibility(View.VISIBLE);
encryption.setVisibility(View.GONE);
if (drawer != null && getResources().getBoolean(R.bool.lock_statusbar)) { if (drawer != null && getResources().getBoolean(R.bool.lock_statusbar)) {
drawer.lock(); drawer.lock();
} else if (drawer != null) { } else if (drawer != null) {
@ -314,15 +324,12 @@ public class StatusFragment extends Fragment {
} }
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) { public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
if (call != null && encryption != null) { if (call != null) {
MediaEncryption mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption(); MediaEncryption mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
exit.setVisibility(View.GONE);
statusText.setVisibility(View.GONE);
if (isVideoEnabled) { if (isVideoEnabled) {
background.setVisibility(View.GONE); background.setVisibility(View.GONE);
} }
encryption.setVisibility(View.VISIBLE);
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified())) { if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified())) {
encryption.setImageResource(R.drawable.security_ok); encryption.setImageResource(R.drawable.security_ok);
@ -342,11 +349,6 @@ public class StatusFragment extends Fragment {
} else { } else {
encryption.setOnClickListener(null); encryption.setOnClickListener(null);
} }
} else {
exit.setVisibility(View.VISIBLE);
statusText.setVisibility(View.VISIBLE);
background.setVisibility(View.VISIBLE);
encryption.setVisibility(View.GONE);
} }
} }