コード例 #1
0
  @Override
  public void onDialogResult(int requestCode, int resultCode, Bundle arguments) {
    if (RESULT_OK != resultCode) return;

    switch (requestCode) {
      case ISSUE_MILESTONE_UPDATE:
        issue.milestone = MilestoneDialogFragment.getSelected(arguments);
        updateMilestone();
        break;
      case ISSUE_ASSIGNEE_UPDATE:
        User assignee = AssigneeDialogFragment.getSelected(arguments);
        if (assignee != null) issue.assignee = assignee;
        else {
          User user = new User();
          user.login = "";
          issue.assignee = user;
        }
        updateAssignee();
        break;
      case ISSUE_LABELS_UPDATE:
        issue.labels = LabelsDialogFragment.getSelected(arguments);
        updateLabels();
        break;
    }
  }
コード例 #2
0
  @Override
  public void onDialogResult(int requestCode, int resultCode, Bundle arguments) {
    if (RESULT_OK != resultCode) return;

    switch (requestCode) {
      case ISSUE_MILESTONE_UPDATE:
        milestoneTask.edit(MilestoneDialogFragment.getSelected(arguments));
        break;
      case ISSUE_ASSIGNEE_UPDATE:
        assigneeTask.edit(AssigneeDialogFragment.getSelected(arguments));
        break;
      case ISSUE_LABELS_UPDATE:
        ArrayList<Label> labels = LabelsDialogFragment.getSelected(arguments);
        if (labels != null && !labels.isEmpty())
          labelsTask.edit(labels.toArray(new Label[labels.size()]));
        else labelsTask.edit(null);
        break;
      case ISSUE_CLOSE:
        stateTask.edit(true);
        break;
      case ISSUE_REOPEN:
        stateTask.edit(false);
        break;
      case COMMENT_DELETE:
        final Comment comment = (Comment) arguments.getSerializable(EXTRA_COMMENT);
        new DeleteCommentTask(getActivity(), repositoryId, comment) {
          @Override
          protected void onSuccess(Comment comment) throws Exception {
            super.onSuccess(comment);
            // TODO: update the commit without reloading the full issue
            refreshIssue();
          }
        }.start();
        break;
    }
  }