mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-17 03:51:03 +01:00
convert contact photo from uri to bytearray directly, without creating a bitmap
This commit is contained in:
parent
9860b8118c
commit
76a1d2c3d6
@ -1303,10 +1303,7 @@ class ContactsHelper(val context: Context) {
|
|||||||
var fullSizePhotoData: ByteArray? = null
|
var fullSizePhotoData: ByteArray? = null
|
||||||
if (contact.photoUri.isNotEmpty()) {
|
if (contact.photoUri.isNotEmpty()) {
|
||||||
val photoUri = Uri.parse(contact.photoUri)
|
val photoUri = Uri.parse(contact.photoUri)
|
||||||
val bitmap = MediaStore.Images.Media.getBitmap(context.contentResolver, photoUri)
|
fullSizePhotoData = context.contentResolver.openInputStream(photoUri)?.readBytes()
|
||||||
|
|
||||||
fullSizePhotoData = bitmap.getByteArray()
|
|
||||||
bitmap.recycle()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val results = context.contentResolver.applyBatch(AUTHORITY, operations)
|
val results = context.contentResolver.applyBatch(AUTHORITY, operations)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user