mirror of https://github.com/M66B/FairEmail.git
Fixed notification large bitmap icon
This commit is contained in:
parent
bd58041ab1
commit
0680b842d5
|
@ -639,20 +639,26 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
try {
|
||||
cursor = getContentResolver().query(
|
||||
Uri.parse(message.avatar),
|
||||
new String[]{ContactsContract.Contacts._ID},
|
||||
new String[]{
|
||||
ContactsContract.Contacts._ID,
|
||||
ContactsContract.Contacts.LOOKUP_KEY
|
||||
},
|
||||
null, null, null);
|
||||
if (cursor.moveToNext()) {
|
||||
Uri photo = Uri.withAppendedPath(
|
||||
ContactsContract.Contacts.CONTENT_URI,
|
||||
cursor.getLong(0) + "/photo");
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
Uri uri = ContactsContract.Contacts.getLookupUri(
|
||||
cursor.getLong(0), cursor.getString(1));
|
||||
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(
|
||||
getContentResolver(), photo);
|
||||
getContentResolver(), uri);
|
||||
mbuilder.setLargeIcon(BitmapFactory.decodeStream(is));
|
||||
} else
|
||||
} else {
|
||||
Uri photo = Uri.withAppendedPath(
|
||||
ContactsContract.Contacts.CONTENT_URI,
|
||||
cursor.getLong(0) + "/photo");
|
||||
mbuilder.setLargeIcon(Icon.createWithContentUri(photo));
|
||||
}
|
||||
}
|
||||
} catch (SecurityException ex) {
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
|
|
Loading…
Reference in New Issue