Display encryption icon during call

This commit is contained in:
Sylvain Berfini 2012-06-22 11:54:12 +02:00
parent 26e8e0c80d
commit d38965b693
3 changed files with 22 additions and 5 deletions

View file

@ -381,7 +381,7 @@ public class InCallActivity extends FragmentActivity implements
public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
String authenticationToken) { String authenticationToken) {
if (status != null) { if (status != null) {
status.setEncryption(true); status.refreshEncryptionIcon();
} }
} }

View file

@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RegistrationState;
import android.app.Activity; import android.app.Activity;
@ -66,7 +67,6 @@ public class StatusFragment extends Fragment {
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
isAttached = true;
if (activity instanceof LinphoneActivity) { if (activity instanceof LinphoneActivity) {
((LinphoneActivity) activity).updateStatusFragment(this); ((LinphoneActivity) activity).updateStatusFragment(this);
@ -75,6 +75,8 @@ public class StatusFragment extends Fragment {
((InCallActivity) activity).updateStatusFragment(this); ((InCallActivity) activity).updateStatusFragment(this);
isInCall = true; isInCall = true;
} }
isAttached = true;
} }
@Override @Override
@ -161,6 +163,11 @@ public class StatusFragment extends Fragment {
if (isInCall) { if (isInCall) {
startCallQuality(); startCallQuality();
refreshEncryptionIcon();
// We are obviously connected
statusLed.setImageResource(R.drawable.connected_led);
statusText.setText(getString(R.string.status_connected));
} }
} }
@ -174,9 +181,20 @@ public class StatusFragment extends Fragment {
} }
} }
public void setEncryption(boolean b) { public void refreshEncryptionIcon() {
if (encryption != null) { if (encryption != null) {
//TODO LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
MediaEncryption mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
encryption.setVisibility(View.VISIBLE);
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified())) {
encryption.setImageResource(R.drawable.secure);
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) {
encryption.setImageResource(R.drawable.maybe_secure);
} else {
encryption.setImageResource(R.drawable.not_secure);
}
} }
} }
} }

View file

@ -36,7 +36,6 @@ import android.view.View;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
//FIXME : preview gone after coming back from audio only
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
*/ */