@@ -21,6 +21,7 @@ public class NotificationTarget extends SimpleTarget<Bitmap> {
21
21
private final RemoteViews remoteViews ;
22
22
private final Context context ;
23
23
private final int notificationId ;
24
+ private final String notificationTag ;
24
25
private final Notification notification ;
25
26
private final int viewId ;
26
27
@@ -29,35 +30,58 @@ public class NotificationTarget extends SimpleTarget<Bitmap> {
29
30
* Notification in order to update it that uses {@link #SIZE_ORIGINAL} as the target width and
30
31
* height.
31
32
*
32
- * @param context Context to use in the AppWidgetManager initialization.
33
- * @param viewId The id of the ImageView view that will load the image.
34
- * @param remoteViews RemoteViews object which contains the ImageView that will load the
35
- * bitmap.
36
- * @param notification The Notification object that we want to update.
37
- * @param notificationId The notificationId of the Notification that we want to load the Bitmap.
33
+ * @param context Context to use in the AppWidgetManager initialization.
34
+ * @param viewId The id of the ImageView view that will load the image.
35
+ * @param remoteViews RemoteViews object which contains the ImageView that will load the
36
+ * bitmap.
37
+ * @param notification The Notification object that we want to update.
38
+ * @param notificationId The notificationId of the Notification that we want to load the Bitmap.
38
39
*/
39
40
public NotificationTarget (Context context ,
40
41
int viewId , RemoteViews remoteViews , Notification notification , int notificationId ) {
41
- this (context , SIZE_ORIGINAL , SIZE_ORIGINAL , viewId , remoteViews , notification , notificationId );
42
+ this (context , viewId , remoteViews , notification , notificationId , null );
42
43
}
43
44
44
45
/**
45
- * Constructor using a Notification object and a notificationId to get a handle on the
46
- * Notification in order to update it.
46
+ * Constructor using a Notification object, a notificationId, and a notificationTag to get a
47
+ * handle on the Notification in order to update it that uses {@link #SIZE_ORIGINAL} as the
48
+ * target width and height.
47
49
*
48
- * @param context Context to use in the AppWidgetManager initialization.
49
- * @param width Desired width of the bitmap that will be loaded.(Need to be manually put
50
- * because of RemoteViews limitations.)
51
- * @param height Desired height of the bitmap that will be loaded. (Need to be manually
52
- * put because of RemoteViews limitations.)
53
- * @param viewId The id of the ImageView view that will load the image.
54
- * @param remoteViews RemoteViews object which contains the ImageView that will load the
55
- * bitmap.
56
- * @param notification The Notification object that we want to update.
57
- * @param notificationId The notificationId of the Notification that we want to load the Bitmap.
50
+ * @param context Context to use in the AppWidgetManager initialization.
51
+ * @param viewId The id of the ImageView view that will load the image.
52
+ * @param remoteViews RemoteViews object which contains the ImageView that will load the
53
+ * bitmap.
54
+ * @param notification The Notification object that we want to update.
55
+ * @param notificationId The notificationId of the Notification that we want to load the Bitmap.
56
+ * @param notificationTag The notificationTag of the Notification that we want to load the Bitmap.
57
+ * May be {@code null}.
58
58
*/
59
- public NotificationTarget (Context context , int width , int height ,
60
- int viewId , RemoteViews remoteViews , Notification notification , int notificationId ) {
59
+ public NotificationTarget (Context context , int viewId , RemoteViews remoteViews ,
60
+ Notification notification , int notificationId , String notificationTag ) {
61
+ this (context , SIZE_ORIGINAL , SIZE_ORIGINAL , viewId , remoteViews , notification , notificationId ,
62
+ notificationTag );
63
+ }
64
+
65
+ /**
66
+ * Constructor using a Notification object, a notificationId, and a notificationTag to get a
67
+ * handle on the Notification in order to update it.
68
+ *
69
+ * @param context Context to use in the AppWidgetManager initialization.
70
+ * @param width Desired width of the bitmap that will be loaded.(Need to be manually put
71
+ * because of RemoteViews limitations.)
72
+ * @param height Desired height of the bitmap that will be loaded. (Need to be manually
73
+ * put because of RemoteViews limitations.)
74
+ * @param viewId The id of the ImageView view that will load the image.
75
+ * @param remoteViews RemoteViews object which contains the ImageView that will load the
76
+ * bitmap.
77
+ * @param notification The Notification object that we want to update.
78
+ * @param notificationId The notificationId of the Notification that we want to load the Bitmap.
79
+ * @param notificationTag The notificationTag of the Notification that we want to load the
80
+ * Bitmap. May be {@code null}.
81
+ */
82
+ public NotificationTarget (Context context , int width , int height , int viewId ,
83
+ RemoteViews remoteViews , Notification notification , int notificationId ,
84
+ String notificationTag ) {
61
85
super (width , height );
62
86
this .context = Preconditions .checkNotNull (context , "Context must not be null!" );
63
87
this .notification =
@@ -66,6 +90,7 @@ public NotificationTarget(Context context, int width, int height,
66
90
Preconditions .checkNotNull (remoteViews , "RemoteViews object can not be null!" );
67
91
this .viewId = viewId ;
68
92
this .notificationId = notificationId ;
93
+ this .notificationTag = notificationTag ;
69
94
}
70
95
71
96
/**
@@ -74,7 +99,7 @@ public NotificationTarget(Context context, int width, int height,
74
99
private void update () {
75
100
NotificationManager manager =
76
101
(NotificationManager ) this .context .getSystemService (Context .NOTIFICATION_SERVICE );
77
- manager .notify (this .notificationId , this .notification );
102
+ manager .notify (this .notificationTag , this . notificationId , this .notification );
78
103
}
79
104
80
105
@ Override
0 commit comments