1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 04:35:57 +00:00

Small improvement

This commit is contained in:
M66B 2021-09-28 18:21:32 +02:00
parent cc6ecd7fe1
commit 88336e16f4

View file

@ -47,6 +47,7 @@ import androidx.core.graphics.drawable.IconCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.PreferenceManager;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
@ -228,9 +229,13 @@ class Shortcuts {
if (avatar != null &&
Helper.hasPermission(context, Manifest.permission.READ_CONTACTS)) {
// Create icon from bitmap because launcher might not have contacts permission
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(
context.getContentResolver(), avatar);
bitmap = BitmapFactory.decodeStream(is);
ContentResolver resolver = context.getContentResolver();
try (InputStream is = ContactsContract.Contacts
.openContactPhotoInputStream(resolver, avatar)) {
bitmap = BitmapFactory.decodeStream(is);
} catch (IOException ex) {
Log.e(ex);
}
}
boolean identicon = false;