47
47
*/
48
48
public class Widget extends AppWidgetProvider {
49
49
50
- private static final String TAG = Widget .class .getSimpleName ();
51
-
52
50
private static final String LIST_ITEM_CLICK = "list_item" ;
53
51
private static final String ITEM_ARG = "item_extra" ;
54
52
@@ -64,17 +62,18 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
64
62
RemoteViews widget = new RemoteViews (context .getPackageName (), R .layout .widget_profile );
65
63
widget .setRemoteAdapter (R .id .profile_list , svcIntent );
66
64
67
- widget .setPendingIntentTemplate (R .id .profile_list , getPendingIntent (context , LIST_ITEM_CLICK ));
65
+ widget .setPendingIntentTemplate (R .id .profile_list , getPendingIntent (context ));
68
66
69
67
appWidgetManager .updateAppWidget (appWidgetId , widget );
70
68
}
71
69
}
72
70
73
- private PendingIntent getPendingIntent (Context context , String action ) {
71
+ private PendingIntent getPendingIntent (Context context ) {
74
72
Intent intent = new Intent (context , getClass ());
75
- intent .setAction (action );
73
+ intent .setAction (LIST_ITEM_CLICK );
76
74
return PendingIntent .getBroadcast (context , 0 , intent , Build .VERSION .SDK_INT >=
77
- android .os .Build .VERSION_CODES .M ? PendingIntent .FLAG_MUTABLE : 0 );
75
+ android .os .Build .VERSION_CODES .M ? Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .S ?
76
+ PendingIntent .FLAG_MUTABLE : PendingIntent .FLAG_IMMUTABLE : 0 );
78
77
}
79
78
80
79
@ Override
0 commit comments