Update notification icon colors
* changes depending on system theme * not automatically due to api limitation Co-Authored-By: Ivan K. <74150746+Attorelle@users.noreply.github.com>
This commit is contained in:
committed by
immat0x1
parent
7803e7b556
commit
a67addad7f
@@ -21,6 +21,7 @@ import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
@@ -3698,7 +3699,7 @@ public class NotificationsController extends BaseController {
|
||||
.setGroupSummary(true)
|
||||
.setShowWhen(true)
|
||||
.setWhen(((long) lastMessageObject.messageOwner.date) * 1000)
|
||||
.setColor(0xff11acfa);
|
||||
.setColor(setNotificationColor());
|
||||
|
||||
long[] vibrationPattern = null;
|
||||
Uri sound = null;
|
||||
@@ -3859,6 +3860,19 @@ public class NotificationsController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
private int setNotificationColor() {
|
||||
Configuration configuration = ApplicationLoader.applicationContext.getResources().getConfiguration();
|
||||
int nightModeFlags = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
|
||||
switch (nightModeFlags) {
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
return 0xffffffff;
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
return 0xff11acfa;
|
||||
}
|
||||
return 0xff11acfa;
|
||||
}
|
||||
|
||||
private boolean isSilentMessage(MessageObject messageObject) {
|
||||
return messageObject.messageOwner.silent || messageObject.isReactionPush;
|
||||
}
|
||||
@@ -4418,7 +4432,7 @@ public class NotificationsController extends BaseController {
|
||||
.setContentText(text.toString())
|
||||
.setAutoCancel(true)
|
||||
.setNumber(messageObjects.size())
|
||||
.setColor(0xff11acfa)
|
||||
.setColor(setNotificationColor())
|
||||
.setGroupSummary(false)
|
||||
.setWhen(date)
|
||||
.setShowWhen(true)
|
||||
|
||||
Reference in New Issue
Block a user