use of com.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class IssueUriMatcherTest method testHttpsUri.
/**
* Verify https uri
*/
public void testHttpsUri() {
Issue issue = IssueUriMatcher.getIssue(Uri.parse("http://github.com/defunkt/resque/issues/15"));
assertNotNull(issue);
assertEquals(15, issue.number().intValue());
assertNotNull(issue.repository());
assertEquals("resque", issue.repository().name());
assertNotNull(issue.repository().owner());
assertEquals("defunkt", issue.repository().owner().login());
}
use of com.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class IssueUriMatcherTest method testCommentUri.
/**
* Verify uri with comment fragment
*/
public void testCommentUri() {
Issue issue = IssueUriMatcher.getIssue(Uri.parse("https://github.com/defunkt/resque/issues/300#issuecomment-123456"));
assertNotNull(issue);
assertEquals(300, issue.number().intValue());
assertNotNull(issue.repository());
assertEquals("resque", issue.repository().name());
assertNotNull(issue.repository().owner());
assertEquals("defunkt", issue.repository().owner().login());
}
use of com.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class IssueFragment method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (RESULT_OK != resultCode || data == null) {
return;
}
switch(requestCode) {
case ISSUE_EDIT:
Issue editedIssue = data.getParcelableExtra(EXTRA_ISSUE);
bodyImageGetter.encode(editedIssue.id(), editedIssue.bodyHtml());
updateHeader(editedIssue);
return;
case COMMENT_CREATE:
GitHubComment comment = data.getParcelableExtra(EXTRA_COMMENT);
if (items != null) {
items.add(comment);
issue = issue.toBuilder().comments(issue.comments() + 1).build();
updateList(issue, items);
} else {
refreshIssue();
}
return;
case COMMENT_EDIT:
comment = data.getParcelableExtra(EXTRA_COMMENT);
if (items != null && comment != null) {
int commentPosition = findCommentPositionInItems(comment);
if (commentPosition >= 0) {
commentImageGetter.removeFromCache(comment.id());
replaceCommentInItems(commentPosition, comment);
updateList(issue, items);
}
} else {
refreshIssue();
}
}
}
use of com.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class IssueFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
repositoryId = InfoUtils.createRepoFromData(args.getString(EXTRA_REPOSITORY_OWNER), args.getString(EXTRA_REPOSITORY_NAME));
issueNumber = args.getInt(EXTRA_ISSUE_NUMBER);
user = args.getParcelable(EXTRA_USER);
canWrite = args.getBoolean(EXTRA_CAN_WRITE_REPO, false);
BaseActivity dialogActivity = (BaseActivity) getActivity();
ProgressObserverAdapter<Issue> observer = new ProgressObserverAdapter<Issue>(getActivity()) {
@Override
public void onNext(Issue issue) {
super.onNext(issue);
updateHeader(issue);
refreshIssue();
}
};
milestoneTask = new EditMilestoneTask(dialogActivity, repositoryId, issueNumber, observer);
assigneeTask = new EditAssigneeTask(dialogActivity, repositoryId, issueNumber, observer);
labelsTask = new EditLabelsTask(dialogActivity, repositoryId, issueNumber, observer);
stateTask = new EditStateTask(dialogActivity, repositoryId, issueNumber, observer);
}
use of com.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class IssuesFragment method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == ISSUE_FILTER_EDIT && data != null) {
IssueFilter newFilter = data.getParcelableExtra(EXTRA_ISSUE_FILTER);
if (!filter.equals(newFilter)) {
filter = newFilter;
updateFilterSummary();
pager.reset();
refreshWithProgress();
return;
}
}
if (requestCode == ISSUE_VIEW) {
notifyDataSetChanged();
forceRefresh();
return;
}
if (requestCode == ISSUE_CREATE && resultCode == RESULT_OK) {
Issue created = data.getParcelableExtra(EXTRA_ISSUE);
forceRefresh();
startActivityForResult(IssuesViewActivity.createIntent(created, repository), ISSUE_VIEW);
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
Aggregations