Exemplo n.º 1
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()));
 }
Exemplo n.º 2
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Inflate the menu; this adds items to the action bar if it is present.
   getMenuInflater().inflate(R.menu.issue_activity, menu);
   MenuItem menuItem = menu.findItem(R.id.action_follow);
   final FollowersManager followersManager = new FollowersManager(this);
   final UsersManager usersManager = new UsersManager(this);
   menuItem.setChecked(
       followersManager.userFollowsIssue(
           usersManager.getCurrentUser().getId(), mIssuesEntity.getId()));
   return true;
 }
Exemplo n.º 3
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    final int itemId = item.getItemId();

    switch (itemId) {
      case R.id.action_follow:
        final UsersManager usersManager = new UsersManager(this);
        final FollowersManager followersManager = new FollowersManager(this);
        final Long currentUserId = usersManager.getCurrentUser().getId();
        final Long issueId = mIssuesEntity.getId();
        followersManager.toggleUserFollowsIssue(currentUserId, issueId);
        mTxtFollowers.setText(followersManager.humanPhraseFromIssueId(issueId, currentUserId));
        item.setChecked(followersManager.userFollowsIssue(currentUserId, issueId));
        return true;
      case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }