Fix contact small issues

This commit is contained in:
Sylvain Berfini 2012-09-06 17:58:42 +02:00
parent 473311187f
commit a3b9b544e6
3 changed files with 12 additions and 8 deletions

View file

@ -154,11 +154,15 @@ public final class ContactHelper {
} }
String[] projection = {android.provider.ContactsContract.CommonDataKinds.Photo.PHOTO}; String[] projection = {android.provider.ContactsContract.CommonDataKinds.Photo.PHOTO};
Cursor photoCursor = resolver.query(photoUri, projection, null, null, null); Cursor photoCursor = resolver.query(photoUri, projection, null, null, null);
boolean valid = testPhotoUriAndCloseCursor(photoCursor); String maybeDisplayName = c.getString(c.getColumnIndex(nameCol));
if (valid) { boolean isPhotoValid = testPhotoUriAndCloseCursor(photoCursor);
if (isPhotoValid) {
foundPhotoUri = photoUri; foundPhotoUri = photoUri;
displayName = c.getString(c.getColumnIndex(nameCol)); displayName = maybeDisplayName;
c.close(); return true;
} else if (maybeDisplayName != null) {
foundPhotoUri = null;
displayName = maybeDisplayName;
return true; return true;
} }
} }

View file

@ -25,7 +25,6 @@ import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.MediaEncryption; import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.Log;
import org.linphone.ui.SlidingDrawer; import org.linphone.ui.SlidingDrawer;
import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener; import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener;
@ -323,9 +322,6 @@ public class StatusFragment extends Fragment {
} }
encryption.setVisibility(View.VISIBLE); encryption.setVisibility(View.VISIBLE);
Log.e("MediaEncryption = " + mediaEncryption);
Log.e("TokenVerified = " + call.isAuthenticationTokenVerified());
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);
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) { } else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) {

View file

@ -67,6 +67,10 @@ public class ApiFivePlus {
intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName); intent.putExtra(ContactsContract.Intents.Insert.NAME, displayName);
if (Version.sdkAboveOrEqual(Version.API09_GINGERBREAD_23)) { if (Version.sdkAboveOrEqual(Version.API09_GINGERBREAD_23)) {
if (sipUri.startsWith("sip:")) {
sipUri = sipUri.substring(4);
}
ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ArrayList<ContentValues> data = new ArrayList<ContentValues>();
ContentValues sipAddressRow = new ContentValues(); ContentValues sipAddressRow = new ContentValues();
sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE); sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);