Notification account color

This commit is contained in:
M66B
2018-11-06 17:00:07 +00:00
parent 5e9bb1415d
commit 1e992c6741
2 changed files with 16 additions and 6 deletions

View File

@@ -169,11 +169,11 @@ public class ServiceSynchronize extends LifecycleService {
}
});
db.message().liveUnseenUnified().observe(this, new Observer<List<EntityMessage>>() {
db.message().liveUnseenUnified().observe(this, new Observer<List<TupleMessageEx>>() {
private List<Integer> notifying = new ArrayList<>();
@Override
public void onChanged(List<EntityMessage> messages) {
public void onChanged(List<TupleMessageEx> messages) {
NotificationManager nm = getSystemService(NotificationManager.class);
List<Notification> notifications = getNotificationUnseen(messages);
@@ -353,7 +353,7 @@ public class ServiceSynchronize extends LifecycleService {
return builder;
}
private List<Notification> getNotificationUnseen(List<EntityMessage> messages) {
private List<Notification> getNotificationUnseen(List<TupleMessageEx> messages) {
// https://developer.android.com/training/notify-user/group
List<Notification> notifications = new ArrayList<>();
@@ -443,7 +443,7 @@ public class ServiceSynchronize extends LifecycleService {
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
for (EntityMessage message : messages) {
for (TupleMessageEx message : messages) {
Bundle args = new Bundle();
args.putLong("id", message.id);
@@ -538,6 +538,9 @@ public class ServiceSynchronize extends LifecycleService {
mbuilder.addPerson(message.avatar);
}
if (message.accountColor != null)
mbuilder.setColor(message.accountColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
mbuilder.setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN);