|
|
|
@ -119,8 +119,7 @@ public class ContactInfo {
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
|
|
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS))
|
|
|
|
|
try {
|
|
|
|
|
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
|
|
|
|
|
ContentResolver resolver = context.getContentResolver();
|
|
|
|
|
try (Cursor cursor = resolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
|
|
|
|
|
new String[]{
|
|
|
|
@ -151,10 +150,10 @@ public class ContactInfo {
|
|
|
|
|
info.displayName = cursor.getString(colDisplayName);
|
|
|
|
|
info.lookupUri = lookupUri;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (info.bitmap == null) {
|
|
|
|
|
int dp = Helper.dp2pixels(context, 48);
|
|
|
|
@ -213,7 +212,8 @@ public class ContactInfo {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void init(final Context context, Handler handler) {
|
|
|
|
|
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
|
|
|
|
|
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS))
|
|
|
|
|
try {
|
|
|
|
|
ContentObserver observer = new ContentObserver(handler) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onChange(boolean selfChange, Uri uri) {
|
|
|
|
@ -226,15 +226,13 @@ public class ContactInfo {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
emailLookup = getEmailLookup(context);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Uri uri = ContactsContract.CommonDataKinds.Email.CONTENT_URI;
|
|
|
|
|
Log.i("Observing uri=" + uri);
|
|
|
|
|
context.getContentResolver().registerContentObserver(uri, true, observer);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -266,6 +264,8 @@ public class ContactInfo {
|
|
|
|
|
null)) {
|
|
|
|
|
if (cursor != null && cursor.moveToNext())
|
|
|
|
|
untrusted = cursor.getLong(0);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
Log.i("Untrusted group=" + untrusted);
|
|
|
|
|
|
|
|
|
@ -303,6 +303,8 @@ public class ContactInfo {
|
|
|
|
|
Uri uri = ContactsContract.Contacts.getLookupUri(contactId, lookupKey);
|
|
|
|
|
all.put(email, uri);
|
|
|
|
|
}
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|