diff --git a/src/org/sflphone/fragments/CallFragment.java b/src/org/sflphone/fragments/CallFragment.java index 2afaf5f5752c44542855d67b1720647118283e40..0c60307c16a2abaaee7beeea7735a9bc5926bf45 100644 --- a/src/org/sflphone/fragments/CallFragment.java +++ b/src/org/sflphone/fragments/CallFragment.java @@ -400,13 +400,19 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa private void enableZRTP(final SecureSipCall secured) { Log.i(TAG, "enable ZRTP"); - if (secured.isInitialized()) { - Log.i(TAG, "Call initialized "); - if (secured.needSASConfirmation()) { + + switch (secured.displayModule()) { + case SecureSipCall.DISPLAY_GREEN_LOCK: + showLock(R.drawable.green_lock); + break; + case SecureSipCall.DISPLAY_RED_LOCK: + showLock(R.drawable.red_lock); + break; + case SecureSipCall.DISPLAY_CONFIRM_SAS: Log.i(TAG, "needSASConfirmation"); final Button sas = (Button) mSecuritySwitch.findViewById(R.id.confirm_sas); sas.setText("Confirm SAS: " + secured.getSAS()); - sas.setOnClickListener(new OnClickListener() { + sas.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { @@ -418,13 +424,12 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa } }); mSecuritySwitch.setVisibility(View.VISIBLE); - } else if (secured.supportZRTP()) { - Log.i(TAG, "supportZRTP"); - showLock(R.drawable.green_lock); - } else { - showLock(R.drawable.red_lock); - } + break; + case SecureSipCall.DISPLAY_NONE: + break; } + + } private void showLock(int resId) { @@ -468,10 +473,8 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa private void initOutGoingCallDisplay() { Log.i(TAG, "Start outgoing display"); - getBubbleForUser(getConference(), mBubbleModel.width / 2, mBubbleModel.height / 2); - // TODO off-thread image loading int angle_part = 360 / getConference().getParticipants().size(); double dX, dY; int radiusCalls = (int) (mBubbleModel.width / 2 - BUBBLE_SIZE); @@ -480,7 +483,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa dY = Math.sin(Math.toRadians(angle_part * i - 90)) * radiusCalls; getBubbleFor(getConference().getParticipants().get(i), (int) (mBubbleModel.width / 2 + dX), (int) (mBubbleModel.height / 2 + dY)); } - mBubbleModel.clearAttractors(); } diff --git a/src/org/sflphone/model/SecureSipCall.java b/src/org/sflphone/model/SecureSipCall.java index 086962cd30fa3fc11aad5520ed9e898c2ea8591c..ecc829557d704c9647d7f0b633d95bebc071e82a 100644 --- a/src/org/sflphone/model/SecureSipCall.java +++ b/src/org/sflphone/model/SecureSipCall.java @@ -34,7 +34,11 @@ package org.sflphone.model; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; +import android.os.RemoteException; import android.util.Log; +import android.view.View; +import android.widget.Button; +import org.sflphone.R; public class SecureSipCall extends SipCall { @@ -43,6 +47,11 @@ public class SecureSipCall extends SipCall { public static String DISPLAY_SAS_ONCE = "displaySasOnce"; public static String DISPLAY_WARNING_ZRTP_NOT_SUPPORTED = "notSuppWarning"; + public final static int DISPLAY_GREEN_LOCK = 0; + public final static int DISPLAY_RED_LOCK = 1; + public final static int DISPLAY_CONFIRM_SAS = 2; + public final static int DISPLAY_NONE = 3; + /* * srtp: @@ -170,4 +179,20 @@ public class SecureSipCall extends SipCall { public void setInitialized() { isInitialized = true; } + + /* + * returns what state should be visible during call + */ + public int displayModule() { + if (isInitialized()) { + if (needSASConfirmation()) { + return DISPLAY_CONFIRM_SAS; + } else if (supportZRTP()) { + return DISPLAY_GREEN_LOCK; + } else { + return DISPLAY_RED_LOCK; + } + } + return DISPLAY_NONE; + } } diff --git a/src/org/sflphone/service/CallManagerCallBack.java b/src/org/sflphone/service/CallManagerCallBack.java index 9564f391ca26b79ed15b395aa2c6283de28e4d5c..de76e6c5480660de54738341c1d71f6568440ffc 100644 --- a/src/org/sflphone/service/CallManagerCallBack.java +++ b/src/org/sflphone/service/CallManagerCallBack.java @@ -289,7 +289,8 @@ public class CallManagerCallBack extends Callback { Intent intent = new Intent(ZRTP_OFF); intent.putExtra("callID", callID); intent.putExtra("conference", mService.findConference(callID)); - mService.sendBroadcast(intent); } + mService.sendBroadcast(intent); + } @Override public void on_show_sas(String callID, String sas, boolean verified) {