ui: better filtering on lock display, fix position.
diff --git a/src/org/sflphone/client/HomeActivity.java b/src/org/sflphone/client/HomeActivity.java
index 09b77eb..244d705 100644
--- a/src/org/sflphone/client/HomeActivity.java
+++ b/src/org/sflphone/client/HomeActivity.java
@@ -43,6 +43,7 @@
import android.app.Activity;
import android.app.AlertDialog;
+import android.content.pm.PackageManager;
import android.support.v4.app.*;
import org.sflphone.R;
import org.sflphone.fragments.AboutFragment;
@@ -122,8 +123,6 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
-
setContentView(R.layout.activity_home);
// Bind to LocalService
@@ -384,6 +383,8 @@
public void onServiceConnected(ComponentName className, IBinder binder) {
service = ISipService.Stub.asInterface(binder);
+
+
try {
fMenu = new MenuFragment();
diff --git a/src/org/sflphone/fragments/CallFragment.java b/src/org/sflphone/fragments/CallFragment.java
index 24ac9f7..2843864 100644
--- a/src/org/sflphone/fragments/CallFragment.java
+++ b/src/org/sflphone/fragments/CallFragment.java
@@ -399,9 +399,11 @@
}
private void enableZRTP(final SecureSipCall secured) {
-
- if(secured.isInitialized()){
+ Log.i(TAG, "enable ZRTP");
+ if (secured.isInitialized()) {
+ Log.i(TAG, "Call initialized ");
if (secured.needSASConfirmation()) {
+ Log.i(TAG, "needSASConfirmation");
final Button sas = (Button) mSecuritySwitch.findViewById(R.id.confirm_sas);
sas.setText("Confirm SAS: " + secured.getSAS());
sas.setOnClickListener(new OnClickListener() {
@@ -409,25 +411,29 @@
public void onClick(View v) {
try {
mCallbacks.getService().confirmSAS(secured.getCallId());
- ImageView lock = (ImageView) mSecuritySwitch.findViewById(R.id.lock_image);
- lock.setImageDrawable(getResources().getDrawable(R.drawable.green_lock));
- mSecuritySwitch.showNext();
+ showLock(R.drawable.green_lock);
} catch (RemoteException e) {
e.printStackTrace();
}
}
});
mSecuritySwitch.setVisibility(View.VISIBLE);
+ } else if (secured.supportZRTP()) {
+ Log.i(TAG, "supportZRTP");
+ showLock(R.drawable.green_lock);
} else {
- ImageView lock = (ImageView) mSecuritySwitch.findViewById(R.id.lock_image);
- lock.setImageDrawable(getResources().getDrawable(R.drawable.red_lock));
-
- mSecuritySwitch.showNext();
- mSecuritySwitch.setVisibility(View.VISIBLE);
+ showLock(R.drawable.red_lock);
}
}
}
+ private void showLock(int resId) {
+ ImageView lock = (ImageView) mSecuritySwitch.findViewById(R.id.lock_image);
+ lock.setImageDrawable(getResources().getDrawable(resId));
+ mSecuritySwitch.showNext();
+ mSecuritySwitch.setVisibility(View.VISIBLE);
+ }
+
private void initIncomingCallDisplay() {
Log.i(TAG, "Start incoming display");
diff --git a/src/org/sflphone/fragments/ContactListFragment.java b/src/org/sflphone/fragments/ContactListFragment.java
index ab6c2af..b7bd3a7 100644
--- a/src/org/sflphone/fragments/ContactListFragment.java
+++ b/src/org/sflphone/fragments/ContactListFragment.java
@@ -173,9 +173,9 @@
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_contact_list, container, false);
mHeader = (LinearLayout) inflater.inflate(R.layout.frag_contact_list_header, null);
- mContactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_list);
+ mContactList = (StickyListHeadersListView) inflatedView.findViewById(R.id.contacts_stickylv);
- ((LinearLayout) inflatedView.findViewById(R.id.drag_view)).setOnTouchListener(new OnTouchListener() {
+ inflatedView.findViewById(R.id.drag_view).setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -183,7 +183,7 @@
}
});
- ((ImageButton) inflatedView.findViewById(R.id.contact_search_button)).setOnClickListener(new OnClickListener() {
+ inflatedView.findViewById(R.id.contact_search_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -195,7 +195,7 @@
}
});
- ((RelativeLayout) inflatedView.findViewById(R.id.slider_button)).setOnClickListener(new OnClickListener() {
+ inflatedView.findViewById(R.id.slider_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/src/org/sflphone/model/SecureSipCall.java b/src/org/sflphone/model/SecureSipCall.java
index 8b4b7b0..ff59671 100644
--- a/src/org/sflphone/model/SecureSipCall.java
+++ b/src/org/sflphone/model/SecureSipCall.java
@@ -34,6 +34,7 @@
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.Log;
public class SecureSipCall extends SipCall {
@@ -79,19 +80,29 @@
private String SAS;
private boolean needSASConfirmation;
+
+ public boolean supportZRTP() {
+ return !zrtpNotSupported;
+ }
+
private boolean zrtpNotSupported;
- private boolean alertIfZrtpNotSupported;
- private boolean displaySASOnHold;
+
+ // static preferences of account
+ private final boolean displaySas;
+ private final boolean alertIfZrtpNotSupported;
+ private final boolean displaySASOnHold;
private boolean isInitialized;
- public SecureSipCall(SipCall call, Bundle secure){
+ public SecureSipCall(SipCall call, Bundle secure) {
super(call);
isInitialized = false;
- needSASConfirmation = secure.getBoolean(SecureSipCall.DISPLAY_SAS, false);
+ displaySas = secure.getBoolean(SecureSipCall.DISPLAY_SAS, false);
+ needSASConfirmation = displaySas; // At first this is equal
alertIfZrtpNotSupported = secure.getBoolean(SecureSipCall.DISPLAY_WARNING_ZRTP_NOT_SUPPORTED, false);
displaySASOnHold = secure.getBoolean(SecureSipCall.DISPLAY_SAS_ONCE, false);
+ zrtpNotSupported = false;
}
public boolean needSASConfirmation() {
@@ -110,20 +121,27 @@
this.SAS = SAS;
}
- public SecureSipCall(Parcel in){
+ public SecureSipCall(Parcel in) {
super(in);
SAS = in.readString();
- needSASConfirmation = in.readByte() == 1;
+ displaySas = in.readByte() == 1;
isInitialized = in.readByte() == 1;
-
+ alertIfZrtpNotSupported = in.readByte() == 1;
+ displaySASOnHold = in.readByte() == 1;
+ zrtpNotSupported = in.readByte() == 1;
+ needSASConfirmation = in.readByte() == 1;
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeString(SAS);
- out.writeByte((byte) (needSASConfirmation ? 1 : 0));
+ out.writeByte((byte) (displaySas ? 1 : 0));
out.writeByte((byte) (isInitialized ? 1 : 0));
+ out.writeByte((byte) (alertIfZrtpNotSupported ? 1 : 0));
+ out.writeByte((byte) (displaySASOnHold ? 1 : 0));
+ out.writeByte((byte) (zrtpNotSupported ? 1 : 0));
+ out.writeByte((byte) (needSASConfirmation ? 1 : 0));
}
public static final Parcelable.Creator<SecureSipCall> CREATOR = new Parcelable.Creator<SecureSipCall>() {
@@ -137,7 +155,7 @@
};
public void sasConfirmedByZrtpLayer(boolean verified) {
-
+ // Not used
}
public void setZrtpNotSupported(boolean zrtpNotSupported) {