+ /**
+ * Factory method to create intents that allow to start an ACTION_INIT_OBSERVED_LIST command.
+ *
+ * @param context Android context of the caller component.
+ * @return Intent that starts a command ACTION_INIT_OBSERVED_LIST when
+ * {@link Context#startService(Intent)} is called.
+ */
+ public static Intent makeInitIntent(Context context) {
+ Intent i = new Intent(context, FileObserverService.class);
+ i.setAction(ACTION_INIT_OBSERVED_LIST);
+ return i;
+ }
+
+
+ /**
+ * Factory method to create intents that allow to start or stop the observance of a file.
+ *
+ * @param context Android context of the caller component.
+ * @param file OCFile to start or stop to watch.
+ * @param account OC account containing file.
+ * @param watchIt 'True' creates an intent to watch, 'false' an intent to stop watching.
+ * @return Intent to start or stop the observance of a file through a call
+ * to {@link Context#startService(Intent)}.
+ */
+ public static Intent makeObservedFileIntent(
+ Context context, OCFile file, Account account, boolean watchIt) {
+ Intent intent = new Intent(context, FileObserverService.class);
+ intent.setAction(
+ watchIt ?
+ FileObserverService.CMD_ADD_OBSERVED_FILE
+ :
+ FileObserverService.CMD_DEL_OBSERVED_FILE
+ );
+ intent.putExtra(FileObserverService.KEY_CMD_ARG_FILE, file);
+ intent.putExtra(FileObserverService.KEY_CMD_ARG_ACCOUNT, account);
+ return intent;