convert contact photo from uri to bytearray directly, without creating a bitmap

This commit is contained in:
tibbi 2020-04-29 21:27:47 +02:00
parent 9860b8118c
commit 76a1d2c3d6
1 changed files with 1 additions and 4 deletions

View File

@ -1303,10 +1303,7 @@ class ContactsHelper(val context: Context) {
var fullSizePhotoData: ByteArray? = null
if (contact.photoUri.isNotEmpty()) {
val photoUri = Uri.parse(contact.photoUri)
val bitmap = MediaStore.Images.Media.getBitmap(context.contentResolver, photoUri)
fullSizePhotoData = bitmap.getByteArray()
bitmap.recycle()
fullSizePhotoData = context.contentResolver.openInputStream(photoUri)?.readBytes()
}
val results = context.contentResolver.applyBatch(AUTHORITY, operations)