am e58fda79: Merge "Added colors to system notifications" into lmp-dev

* commit 'e58fda7997fd2313f0592e4bb0477d22fe5b6fb4':
  Added colors to system notifications
This commit is contained in:
Selim Cinek
2014-08-28 09:46:17 +00:00
committed by Android Git Automerger
2 changed files with 17 additions and 12 deletions

View File

@@ -90,7 +90,9 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
.setContentText(res.getString(R.string.bluetooth_notif_message, name)) .setContentText(res.getString(R.string.bluetooth_notif_message, name))
.setContentIntent(pending) .setContentIntent(pending)
.setAutoCancel(true) .setAutoCancel(true)
.setDefaults(Notification.DEFAULT_SOUND); .setDefaults(Notification.DEFAULT_SOUND)
.setColor(res.getColor(
com.android.internal.R.color.system_notification_accent_color));
NotificationManager manager = (NotificationManager) NotificationManager manager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE); context.getSystemService(Context.NOTIFICATION_SERVICE);

View File

@@ -122,17 +122,20 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
break; break;
} }
Notification notification = new Notification.Builder(context) Notification notification = new Notification.Builder(context)
.setContentTitle(title) .setContentTitle(title)
.setTicker(message) .setTicker(message)
.setContentText(message) .setContentText(message)
.setSmallIcon(android.R.drawable.stat_sys_data_bluetooth) .setSmallIcon(android.R.drawable.stat_sys_data_bluetooth)
.setAutoCancel(true) .setAutoCancel(true)
.setPriority(Notification.PRIORITY_MAX) .setPriority(Notification.PRIORITY_MAX)
.setOnlyAlertOnce(false) .setOnlyAlertOnce(false)
.setDefaults(Notification.DEFAULT_ALL) .setDefaults(Notification.DEFAULT_ALL)
.setContentIntent(PendingIntent.getActivity(context, 0, connectionAccessIntent, 0)) .setContentIntent(PendingIntent.getActivity(context, 0,
.setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0)) connectionAccessIntent, 0))
.build(); .setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0))
.setColor(context.getResources().getColor(
com.android.internal.R.color.system_notification_accent_color))
.build();
notification.flags |= Notification.FLAG_NO_CLEAR; /* cannot be set with the builder */ notification.flags |= Notification.FLAG_NO_CLEAR; /* cannot be set with the builder */