Load of rework on EncryptActivity, still some TODOs

This commit is contained in:
mar-v-in
2014-07-20 17:09:34 +02:00
parent bc9922263c
commit 2913a78b18
11 changed files with 610 additions and 591 deletions

View File

@@ -236,14 +236,19 @@ public class ContactHelper {
}
public static Bitmap photoFromFingerprint(ContentResolver contentResolver, String fingerprint) {
int rawContactId = findRawContactId(contentResolver, fingerprint);
if (rawContactId == -1) return null;
Uri rawContactUri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, rawContactId);
Uri contactUri = ContactsContract.RawContacts.getContactLookupUri(contentResolver, rawContactUri);
InputStream photoInputStream =
ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, contactUri);
if (photoInputStream == null) return null;
return BitmapFactory.decodeStream(photoInputStream);
if (fingerprint == null) return null;
try {
int rawContactId = findRawContactId(contentResolver, fingerprint);
if (rawContactId == -1) return null;
Uri rawContactUri = ContentUris.withAppendedId(ContactsContract.RawContacts.CONTENT_URI, rawContactId);
Uri contactUri = ContactsContract.RawContacts.getContactLookupUri(contentResolver, rawContactUri);
InputStream photoInputStream =
ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, contactUri);
if (photoInputStream == null) return null;
return BitmapFactory.decodeStream(photoInputStream);
} catch (Throwable ignored) {
return null;
}
}
/**