Skip to content

Commit

Permalink
Show the 'reviewed' and 'review_dismissed' events
Browse files Browse the repository at this point in the history
Closes #277
  • Loading branch information
jonan committed Mar 21, 2017
1 parent 1b1589c commit 1f68fdf
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ public class TimelineEvent {
public static final String EVENT_RENAMED = "renamed";
public static final String EVENT_REMOVED_FROM_PROJECT = "removed_from_project";
public static final String EVENT_REOPENED = "reopened";
public static final String EVENT_REVIEWED = "reviewed";
public static final String EVENT_REVIEW_DISMISSED = "review_dismissed";
public static final String EVENT_REVIEW_REQUESTED = "review_requested";
public static final String EVENT_REVIEW_REQUEST_REMOVED = "review_request_removed";
public static final String EVENT_REVIEWED = "reviewed";
public static final String EVENT_SUBSCRIBED = "subscribed";
public static final String EVENT_UNASSIGNED = "unassigned";
public static final String EVENT_UNLABELED = "unlabeled";
Expand All @@ -53,6 +54,8 @@ public class TimelineEvent {

public long id;

public User user;

public User actor;

public CommitAuthor author;
Expand All @@ -79,6 +82,8 @@ public class TimelineEvent {

public Date updated_at;

public Date submitted_at;

public String body;

public String body_html;
Expand Down
36 changes: 32 additions & 4 deletions app/src/main/java/com/github/mobile/ui/issue/EventListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
Expand Down Expand Up @@ -104,10 +105,17 @@ private void updateEvent(final TimelineEvent event) {
String eventString = event.event;

User actor;
if (eventString.equals(TimelineEvent.EVENT_ASSIGNED) || eventString.equals(TimelineEvent.EVENT_UNASSIGNED)) {
switch (eventString) {
case TimelineEvent.EVENT_ASSIGNED:
case TimelineEvent.EVENT_UNASSIGNED:
actor = event.assignee;
} else {
break;
case TimelineEvent.EVENT_REVIEWED:
actor = event.user;
break;
default:
actor = event.actor;
break;
}

String message = String.format("<b>%s</b> ", actor == null ? "ghost" : actor.login);
Expand Down Expand Up @@ -169,6 +177,16 @@ private void updateEvent(final TimelineEvent event) {
setText(0, TypefaceUtils.ICON_X);
textView(0).setTextColor(resources.getColor(R.color.issue_event_normal));
break;
case TimelineEvent.EVENT_REVIEWED:
message += resources.getString(R.string.issue_event_reviewed);
setText(0, TypefaceUtils.ICON_EYE);
textView(0).setTextColor(resources.getColor(R.color.issue_event_normal));
break;
case TimelineEvent.EVENT_REVIEW_DISMISSED:
message += resources.getString(R.string.issue_event_review_dismissed);
setText(0, TypefaceUtils.ICON_X);
textView(0).setTextColor(resources.getColor(R.color.issue_event_normal));
break;
case TimelineEvent.EVENT_MILESTONED:
message += String.format(resources.getString(R.string.issue_event_milestone_added), "<b>" + event.milestone.title + "</b>");
setText(0, TypefaceUtils.ICON_MILESTONE);
Expand Down Expand Up @@ -239,8 +257,18 @@ private void updateEvent(final TimelineEvent event) {
break;
}

if (event.created_at != null) {
message += " " + TimeUtils.getRelativeTime(event.created_at);
Date date;
switch (eventString) {
case TimelineEvent.EVENT_REVIEWED:
date = event.submitted_at;
break;
default:
date = event.created_at;
break;
}

if (date != null) {
message += " " + TimeUtils.getRelativeTime(date);
}
setText(1, Html.fromHtml(message));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public class IssueFragment extends DialogFragment implements OnItemClickListener
TimelineEvent.EVENT_REMOVED_FROM_PROJECT,
TimelineEvent.EVENT_MENTIONED,
TimelineEvent.EVENT_SUBSCRIBED,
TimelineEvent.EVENT_UNSUBSCRIBED,
TimelineEvent.EVENT_REVIEWED);
TimelineEvent.EVENT_UNSUBSCRIBED);

private int issueNumber;

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
<string name="issue_event_cross_referenced">referenced this issue in %1$s</string>
<string name="issue_event_review_requested">requested review from %1$s</string>
<string name="issue_event_review_request_removed">removed their request for review from %1$s</string>
<string name="issue_event_reviewed">reviewed</string>
<string name="issue_event_review_dismissed">dismissed their review</string>
<string name="issue_event_closed">closed this</string>
<string name="issue_event_closed_from_commit">closed this from commit %1$s</string>
<string name="issue_event_reopened">reopened this</string>
Expand Down

0 comments on commit 1f68fdf

Please sign in to comment.