Beispiel #1
0
 public static void readUserActivityProperties(
     TodorooCursor<UserActivity> unionCursor, UserActivity activity) {
   activity.setValue(UserActivity.CREATED_AT, unionCursor.getLong(0));
   activity.setValue(UserActivity.UUID, unionCursor.getString(1));
   activity.setValue(UserActivity.ACTION, unionCursor.getString(2));
   activity.setValue(UserActivity.MESSAGE, unionCursor.getString(3));
   activity.setValue(UserActivity.TARGET_ID, unionCursor.getString(4));
   activity.setValue(UserActivity.TARGET_NAME, unionCursor.getString(5));
   activity.setValue(UserActivity.PICTURE, unionCursor.getString(6));
   activity.setValue(UserActivity.USER_UUID, unionCursor.getString(7));
 }
Beispiel #2
0
  @SuppressWarnings("nls")
  private void addComment(
      String message, String actionCode, String uuid, String title, boolean usePicture) {
    // Allow for users to just add picture
    if (TextUtils.isEmpty(message) && usePicture) {
      message = " ";
    }
    UserActivity userActivity = new UserActivity();
    userActivity.setValue(UserActivity.MESSAGE, message);
    userActivity.setValue(UserActivity.ACTION, actionCode);
    userActivity.setValue(UserActivity.USER_UUID, Task.USER_ID_SELF);
    userActivity.setValue(UserActivity.TARGET_ID, uuid);
    userActivity.setValue(UserActivity.TARGET_NAME, title);
    userActivity.setValue(UserActivity.CREATED_AT, DateUtilities.now());
    if (usePicture && pendingCommentPicture != null) {
      JSONObject pictureJson =
          RemoteModel.PictureHelper.savePictureJson(activity, pendingCommentPicture);
      if (pictureJson != null) userActivity.setValue(UserActivity.PICTURE, pictureJson.toString());
    }

    userActivityDao.createNew(userActivity);
    if (commentField != null) commentField.setText(""); // $NON-NLS-1$

    pendingCommentPicture = usePicture ? null : pendingCommentPicture;
    if (usePicture) {
      if (activity != null)
        activity.getIntent().removeExtra(TaskEditFragment.TOKEN_PICTURE_IN_PROGRESS);
    }
    if (pictureButton != null) pictureButton.setImageResource(cameraButton);
    StatisticsService.reportEvent(StatisticsConstants.ACTFM_TASK_COMMENT);

    setUpListAdapter();
    for (UpdatesChangedListener l : listeners) {
      l.commentAdded();
    }
  }