Fix notification light

This commit is contained in:
Torsten Grote
2018-02-28 12:53:22 -03:00
parent a8ed86575d
commit c44a3d01b9
2 changed files with 12 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ import android.net.Uri;
import android.support.annotation.StringRes;
import android.support.annotation.UiThread;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.content.ContextCompat;
import org.briarproject.bramble.api.Multiset;
import org.briarproject.bramble.api.contact.ContactId;
@@ -170,9 +171,13 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
@TargetApi(26)
private void createNotificationChannel(String channelId,
@StringRes int name) {
notificationManager.createNotificationChannel(
NotificationChannel nc =
new NotificationChannel(channelId, appContext.getString(name),
IMPORTANCE_DEFAULT));
IMPORTANCE_DEFAULT);
nc.enableLights(true);
nc.setLightColor(
ContextCompat.getColor(appContext, R.color.briar_green_light));
notificationManager.createNotificationChannel(nc);
}
@Override

View File

@@ -6,6 +6,8 @@ import android.support.annotation.ColorRes;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import org.briarproject.briar.R;
import static android.support.v4.app.NotificationCompat.VISIBILITY_PRIVATE;
import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET;
@@ -17,6 +19,9 @@ public class BriarNotificationBuilder extends NotificationCompat.Builder {
// Auto-cancel does not fire the delete intent, see
// https://issuetracker.google.com/issues/36961721
setAutoCancel(true);
setLights(ContextCompat.getColor(context, R.color.briar_green_light),
750, 500);
}
public BriarNotificationBuilder setColorRes(@ColorRes int res) {