6
6
*/
7
7
package it .niedermann .owncloud .notes .widget .notelist ;
8
8
9
+ import static it .niedermann .owncloud .notes .edit .EditNoteActivity .PARAM_NOTE_ID ;
9
10
import static it .niedermann .owncloud .notes .shared .util .WidgetUtil .pendingIntentFlagCompat ;
10
11
11
12
import android .app .PendingIntent ;
25
26
import it .niedermann .owncloud .notes .R ;
26
27
import it .niedermann .owncloud .notes .edit .EditNoteActivity ;
27
28
import it .niedermann .owncloud .notes .persistence .NotesRepository ;
28
- import it .niedermann .owncloud .notes .persistence .entity .NotesListWidgetData ;
29
29
30
30
public class NoteListWidget extends AppWidgetProvider {
31
31
private static final String TAG = NoteListWidget .class .getSimpleName ();
@@ -50,9 +50,16 @@ static void updateAppWidget(Context context, AppWidgetManager awm, int[] appWidg
50
50
createNewNoteIntent .setAction ("android.intent.action.SEND" );
51
51
createNewNoteIntent .setPackage (context .getPackageName ());
52
52
53
+ // TODO distinguish between add and view
54
+ // TODO add note it
55
+ createNewNoteIntent .putExtra (PARAM_NOTE_ID , -1L );
56
+
57
+ int pendingIntentFlags = pendingIntentFlagCompat (PendingIntent .FLAG_UPDATE_CURRENT | Intent .FILL_IN_COMPONENT );
58
+ PendingIntent createNewNotePendingIntent = PendingIntent .getActivity (context , 0 , createNewNoteIntent , pendingIntentFlags );
59
+
53
60
views = new RemoteViews (context .getPackageName (), R .layout .widget_note_list );
54
61
views .setRemoteAdapter (R .id .note_list_widget_lv , serviceIntent );
55
- views .setPendingIntentTemplate (R .id .note_list_widget_lv , PendingIntent . getActivity ( context , 0 , createNewNoteIntent , pendingIntentFlagCompat ( PendingIntent . FLAG_UPDATE_CURRENT | Intent . FILL_IN_COMPONENT )) );
62
+ views .setPendingIntentTemplate (R .id .note_list_widget_lv , createNewNotePendingIntent );
56
63
views .setEmptyView (R .id .note_list_widget_lv , R .id .widget_note_list_placeholder_tv );
57
64
58
65
awm .notifyAppWidgetViewDataChanged (appWidgetId , R .id .note_list_widget_lv );
0 commit comments