11
11
import androidx .annotation .Nullable ;
12
12
import android .widget .RemoteViews ;
13
13
14
+ import org .jetbrains .annotations .NotNull ;
15
+
14
16
15
17
/**
16
18
* Interface for updating widget
@@ -22,12 +24,12 @@ public abstract class WidgetUpdater {
22
24
/**
23
25
* Channel Id of default {@link Notification}
24
26
*/
25
- private static final String NOTIFICATION_CHANNEL_ID = "widget updates" ;
27
+ static final String NOTIFICATION_CHANNEL_ID = "widget updates" ;
26
28
27
29
/**
28
30
* Channel Name of default {@link Notification}
29
31
*/
30
- private static final String channelName = "Update Widget" ;
32
+ static final String channelName = "Update Widget" ;
31
33
32
34
/**
33
35
* Update widget by passing {@link RemoteViews} and id into
@@ -53,17 +55,6 @@ public abstract class WidgetUpdater {
53
55
*/
54
56
@ TargetApi (Build .VERSION_CODES .O )
55
57
public Notification makeNotification (@ NonNull Context context ) {
56
- NotificationChannel chan = new NotificationChannel (NOTIFICATION_CHANNEL_ID , channelName , NotificationManager .IMPORTANCE_NONE );
57
- NotificationManager manager = (NotificationManager ) context .getSystemService (Context .NOTIFICATION_SERVICE );
58
- if (manager != null ) {
59
- manager .createNotificationChannel (chan );
60
- }
61
-
62
- Notification .Builder notificationBuilder = new Notification .Builder (context , NOTIFICATION_CHANNEL_ID );
63
- notificationBuilder .setOngoing (true );
64
- notificationBuilder .setContentTitle ("Update widget" )
65
- .setContentText ("Wait for finish updating" )
66
- .setSmallIcon (android .R .drawable .stat_notify_sync );
67
- return notificationBuilder .build ();
58
+ return NotificationDelegate .getNotification (context );
68
59
}
69
60
}
0 commit comments