コード例 #1
0
  @Override
  public void onTextSet(String tag, String actualText) {

    if (ACTION_UPDATE_TAG.equals(tag)) {
      final ActionsManager actionsManager = new ActionsManager(this);
      final String timeStamp = TimeStampUtils.dateToTimeStamp(new Date());
      final UsersManager usersManager = new UsersManager(this);
      final UsersEntity currentUser = usersManager.getCurrentUser();

      ActionsEntity entity =
          new ActionsEntity(
              null,
              mIssuesEntity.getId(),
              timeStamp,
              "Atualização",
              actualText,
              currentUser.getId());
      actionsManager.refresh(entity);

    } else if (ACTION_CLOSE_TAG.equals(tag)) {
      final IssuesManager issuesManager = new IssuesManager(this);
      final ActionsManager actionsManager = new ActionsManager(this);
      final UsersManager usersManager = new UsersManager(this);
      final UsersEntity currentUser = usersManager.getCurrentUser();

      mIssuesEntity.setState(IssueUtils.STATE_CLOSED);
      issuesManager.refresh(mIssuesEntity);
      mImgFlagAndClockType.setImageResource(
          DashboardUtils.getImageResourceIdForStateFlagTypeAndClockType(
              mIssuesEntity.getState(),
              mIssuesEntity.getFlagType(),
              mIssuesEntity.getClockType(),
              true));

      final String timeStamp = TimeStampUtils.dateToTimeStamp(new Date());
      ActionsEntity entity =
          new ActionsEntity(
              null,
              mIssuesEntity.getId(),
              timeStamp,
              "Fechamento",
              actualText,
              currentUser.getId());
      actionsManager.refresh(entity);

    } else {
      throw new IllegalArgumentException("Invalid tag=" + tag);
    }
  }
コード例 #2
0
 private void refreshScreen() {
   mImgFlagAndClockType.setImageResource(
       DashboardUtils.getImageResourceIdForStateFlagTypeAndClockType(
           mIssuesEntity.getState(),
           mIssuesEntity.getFlagType(),
           mIssuesEntity.getClockType(),
           true));
   mTxtSummary.setText(mIssuesEntity.getSummary());
   mTxtAcronymId.setText(mIssuesEntity.getAcronymId());
   mTxtDescription.setText(mIssuesEntity.getDescription());
   final UsersManager usersManager = new UsersManager(this);
   final String reportPhrase =
       "por "
           + usersManager.userFromId(mIssuesEntity.getReporterId()).getShortName()
           + " em "
           + TimeStampUtils.timeStampToFormattedString(mIssuesEntity.getTimeStamp());
   mTxtReporter.setText(reportPhrase);
   mTxtOwner.setText(
       mIssuesEntity.getOwnerId() == null
           ? "(não atribuído)"
           : usersManager.userFromId(mIssuesEntity.getOwnerId()).getShortName());
   final FollowersManager followersManager = new FollowersManager(this);
   mTxtFollowers.setText(
       followersManager.humanPhraseFromIssueId(
           mIssuesEntity.getId(), new UsersManager(this).getCurrentUser().getId()));
 }
コード例 #3
0
 public void newComment(View view) {
   final String newCommentString = mEdtNewComment.getText().toString().trim();
   if (!TextUtils.isEmpty(newCommentString)) {
     CommentsEntity entity =
         new CommentsEntity(
             null,
             mCurrentAction.getId(),
             TimeStampUtils.dateToTimeStamp(new Date()),
             newCommentString,
             mCurrentUser.getId());
     new CommentsManager(this).refresh(entity);
     finish();
   }
 }
コード例 #4
0
 private void addActionAssignToMe() {
   final UsersManager usersManager = new UsersManager(this);
   final UsersEntity currentUser = usersManager.getCurrentUser();
   if (!currentUser.getId().equals(mIssuesEntity.getOwnerId())) {
     final IssuesManager issuesManager = new IssuesManager(this);
     mIssuesEntity.setOwnerId(currentUser.getId());
     issuesManager.refresh(mIssuesEntity);
     mTxtOwner.setText(currentUser.getShortName());
     final String timeStamp = TimeStampUtils.dateToTimeStamp(new Date());
     ActionsManager actionsManager = new ActionsManager(this);
     ActionsEntity actionsEntity =
         new ActionsEntity(
             null,
             mIssuesEntity.getId(),
             timeStamp,
             "Atribuição",
             currentUser.getShortName() + " assumiu o incidente",
             currentUser.getId());
     actionsManager.refresh(actionsEntity);
   }
 }
コード例 #5
0
  @Override
  public void onStringSelected(String tag, int chosenIndex) {
    if (ACTION_TYPE_DIALOG.equals(tag)) {
      addNewAction(chosenIndex);
    } else if (CHANGE_FLAG_DIALOG.equals(tag)) {
      final IssuesManager issuesManager = new IssuesManager(this);
      final ActionsManager actionsManager = new ActionsManager(this);
      final UsersManager usersManager = new UsersManager(this);
      final int oldFlagType = mIssuesEntity.getFlagType();
      mIssuesEntity.setFlagType(chosenIndex);
      issuesManager.refresh(mIssuesEntity);
      mImgFlagAndClockType.setImageResource(
          DashboardUtils.getImageResourceIdForStateFlagTypeAndClockType(
              mIssuesEntity.getState(),
              mIssuesEntity.getFlagType(),
              mIssuesEntity.getClockType(),
              true));

      final String timeStamp = TimeStampUtils.dateToTimeStamp(new Date());
      final String[] flagMeaningArray = getResources().getStringArray(R.array.flags_meaning_list);
      ActionsEntity actionsEntity =
          new ActionsEntity(
              null,
              mIssuesEntity.getId(),
              timeStamp,
              "Mudança de importância",
              "Incidente mudou de '"
                  + flagMeaningArray[oldFlagType]
                  + "' para '"
                  + flagMeaningArray[mIssuesEntity.getFlagType()]
                  + "'",
              usersManager.getCurrentUser().getId());
      actionsManager.refresh(actionsEntity);
    } else {
      throw new IllegalArgumentException("Invalid tag=" + tag);
    }
  }