Search in sources :

Example 1 with IssueEventType

use of com.meisolsson.githubsdk.model.IssueEventType in project PocketHub by pockethub.

the class CommentListAdapter method updateEvent.

protected void updateEvent(final IssueEvent event) {
    TypefaceUtils.setOcticons(textView(0));
    String message = String.format("<b>%s</b> %s", event.actor().login(), event.event());
    avatars.bind(imageView(2), event.actor());
    IssueEventType eventType = event.event();
    switch(eventType) {
        case assigned:
        case unassigned:
            setText(0, TypefaceUtils.ICON_PERSON);
            textView(0).setTextColor(context.getResources().getColor(R.color.text_description));
            break;
        case labeled:
        case unlabeled:
            setText(0, TypefaceUtils.ICON_TAG);
            textView(0).setTextColor(context.getResources().getColor(R.color.text_description));
            break;
        case referenced:
            setText(0, TypefaceUtils.ICON_BOOKMARK);
            textView(0).setTextColor(context.getResources().getColor(R.color.text_description));
            break;
        case milestoned:
        case demilestoned:
            setText(0, TypefaceUtils.ICON_MILESTONE);
            textView(0).setTextColor(context.getResources().getColor(R.color.text_description));
            break;
        case closed:
            setText(0, TypefaceUtils.ICON_ISSUE_CLOSE);
            textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_closed));
            break;
        case reopened:
            setText(0, TypefaceUtils.ICON_ISSUE_REOPEN);
            textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_reopened));
            break;
        case renamed:
            setText(0, TypefaceUtils.ICON_EDIT);
            textView(0).setTextColor(context.getResources().getColor(R.color.text_description));
            break;
        case merged:
            message += String.format(" commit <b>%s</b> into <tt>%s</tt> from <tt>%s</tt>", event.commitId().substring(0, 6), issue.pullRequest().base().ref(), issue.pullRequest().head().ref());
            setText(0, TypefaceUtils.ICON_MERGE);
            textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_merged));
            break;
        case locked:
            setText(0, TypefaceUtils.ICON_LOCK);
            textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_lock));
            break;
        case unlocked:
            setText(0, TypefaceUtils.ICON_KEY);
            textView(0).setTextColor(context.getResources().getColor(R.color.issue_event_lock));
            break;
    }
    message += " " + TimeUtils.getRelativeTime(event.createdAt());
    setText(1, Html.fromHtml(message));
}
Also used : IssueEventType(com.meisolsson.githubsdk.model.IssueEventType)

Aggregations

IssueEventType (com.meisolsson.githubsdk.model.IssueEventType)1