Account color is a pro feature

pull/146/head
M66B 7 years ago
parent 15163fb1b0
commit 73d704d688

@ -38,10 +38,10 @@ See also [this FAQ](https://github.com/M66B/open-source-email/blob/master/FAQ.md
* Dark/black theme * Dark/black theme
* Account colors * Account colors
* Multiple select * Multiple select
* Standard replies * Reply templates
* Sort on time, unread or starred * Sort on time, unread or starred
* Search on server * Search on server
* Preview sender/subject in new messages status bar notification * Preview sender/subject/photo in new message notifications
* Encryption/decryption ([OpenPGP](https://www.openpgp.org/)) * Encryption/decryption ([OpenPGP](https://www.openpgp.org/))
* Export settings * Export settings

@ -508,39 +508,40 @@ public class ServiceSynchronize extends LifecycleService {
.addAction(actionArchive.build()) .addAction(actionArchive.build())
.addAction(actionTrash.build()); .addAction(actionTrash.build());
if (pro) if (pro) {
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(message.subject); mbuilder.setContentText(message.subject);
if (!TextUtils.isEmpty(message.avatar)) { if (!TextUtils.isEmpty(message.avatar)) {
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = getContentResolver().query( cursor = getContentResolver().query(
Uri.parse(message.avatar), Uri.parse(message.avatar),
new String[]{ContactsContract.Contacts._ID}, new String[]{ContactsContract.Contacts._ID},
null, null, null); null, null, null);
if (cursor.moveToNext()) { if (cursor.moveToNext()) {
Uri photo = Uri.withAppendedPath( Uri photo = Uri.withAppendedPath(
ContactsContract.Contacts.CONTENT_URI, ContactsContract.Contacts.CONTENT_URI,
cursor.getLong(0) + "/photo"); cursor.getLong(0) + "/photo");
mbuilder.setLargeIcon(Icon.createWithContentUri(photo)); mbuilder.setLargeIcon(Icon.createWithContentUri(photo));
}
} finally {
if (cursor != null)
cursor.close();
} }
} finally {
if (cursor != null) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
cursor.close(); mbuilder.addPerson(new Person.Builder()
.setUri(message.avatar)
.build());
else
mbuilder.addPerson(message.avatar);
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) if (message.accountColor != null)
mbuilder.addPerson(new Person.Builder() mbuilder.setColor(message.accountColor);
.setUri(message.avatar)
.build());
else
mbuilder.addPerson(message.avatar);
} }
if (message.accountColor != null)
mbuilder.setColor(message.accountColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
mbuilder.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN); mbuilder.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN);

Loading…
Cancel
Save