1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Set notification color & category

(Lollipop specific)
This commit is contained in:
Christophe Beyls 2015-01-08 03:59:44 +01:00
parent 6461d9c464
commit 454c5f62e1

View file

@ -174,8 +174,11 @@ public class AlarmIntentService extends IntentService {
bigText = spannableBigText; bigText = spannableBigText;
} }
int notificationColor = getResources().getColor(R.color.fosdem_purple);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_stat_fosdem) .setSmallIcon(R.drawable.ic_stat_fosdem)
.setColor(notificationColor)
.setWhen(event.getStartTime().getTime()) .setWhen(event.getStartTime().getTime())
.setContentTitle(event.getTitle()) .setContentTitle(event.getTitle())
.setContentText(contentText) .setContentText(contentText)
@ -184,11 +187,12 @@ public class AlarmIntentService extends IntentService {
.setContentIntent(eventPendingIntent) .setContentIntent(eventPendingIntent)
.setAutoCancel(true) .setAutoCancel(true)
.setDefaults(defaultFlags) .setDefaults(defaultFlags)
.setPriority(NotificationCompat.PRIORITY_HIGH); .setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_EVENT);
// Blink the LED with FOSDEM color if enabled in the options // Blink the LED with FOSDEM color if enabled in the options
if (sharedPreferences.getBoolean(SettingsFragment.KEY_PREF_NOTIFICATIONS_LED, false)) { if (sharedPreferences.getBoolean(SettingsFragment.KEY_PREF_NOTIFICATIONS_LED, false)) {
notificationBuilder.setLights(getResources().getColor(R.color.fosdem_purple), 1000, 5000); notificationBuilder.setLights(notificationColor, 1000, 5000);
} }
// Android Wear extensions // Android Wear extensions