Dbrant has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/335072 )
Change subject: Show notifications in heads-up style.
......................................................................
Show notifications in heads-up style.
This configures our notifications to appear as "heads-up" notifications,
meaning that they will pop up on top of the current app, in addition to
just showing a notification icon in the system bar.
This applies to Revert notifications, as well as Zero enter/exit
notifications.
The key was to set the DEFAULT_ALL flag on the notification, along with
the PRIORITY flag being set to high or max.
Change-Id: I24c8f54a5c6c6761e7ddcd5ad87469d751f0fcac
---
M app/src/main/java/org/wikipedia/notifications/NotificationPresenter.java
M app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
2 files changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia
refs/changes/72/335072/1
diff --git
a/app/src/main/java/org/wikipedia/notifications/NotificationPresenter.java
b/app/src/main/java/org/wikipedia/notifications/NotificationPresenter.java
index e621079..2ad6966 100644
--- a/app/src/main/java/org/wikipedia/notifications/NotificationPresenter.java
+++ b/app/src/main/java/org/wikipedia/notifications/NotificationPresenter.java
@@ -44,6 +44,8 @@
context), PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new
NotificationCompat.Builder(context)
+ .setDefaults(android.app.Notification.DEFAULT_ALL)
+ .setPriority(android.app.Notification.PRIORITY_HIGH)
.setAutoCancel(true);
switch (n.type()) {
@@ -60,6 +62,7 @@
icon = R.drawable.ic_rotate_left_white_24dp;
title = R.string.notification_reverted_title;
color = ContextCompat.getColor(context,
R.color.foundation_red);
+ builder.setPriority(android.app.Notification.PRIORITY_MAX);
builder.addAction(0,
context.getString(R.string.notification_button_view_edit_history),
historyIntent);
break;
case Notification.TYPE_EDIT_THANK:
diff --git a/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
b/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
index fe440bb..96b69d3 100644
--- a/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
+++ b/app/src/main/java/org/wikipedia/zero/WikipediaZeroHandler.java
@@ -299,6 +299,7 @@
private NotificationCompat.Builder createNotification(@NonNull Context
context) {
return (NotificationCompat.Builder) new
NotificationCompat.Builder(context)
+ .setDefaults(android.app.Notification.DEFAULT_ALL)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setContentTitle(context.getString(R.string.zero_wikipedia_zero_heading))
.setContentIntent(PendingIntent
--
To view, visit https://gerrit.wikimedia.org/r/335072
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I24c8f54a5c6c6761e7ddcd5ad87469d751f0fcac
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits