use of com.github.pockethub.android.Intents.Builder in project PocketHub by pockethub.
the class EditCommentActivity method createIntent.
/**
* Create intent to edit a comment
*
* @param repoId
* @param issueNumber
* @param user
* @return intent
*/
public static Intent createIntent(Repository repoId, int issueNumber, GitHubComment comment, User user) {
Builder builder = new Builder("issue.comment.edit.VIEW");
builder.repo(repoId);
builder.add(EXTRA_COMMENT, comment);
builder.add(EXTRA_ISSUE_NUMBER, issueNumber);
builder.add(EXTRA_USER, user);
return builder.toIntent();
}
use of com.github.pockethub.android.Intents.Builder in project PocketHub by pockethub.
the class IssuesViewActivity method createIntent.
/**
* Create an intent to show issues with an initial selected issue
*
* @param issues
* @param position
* @return intent
*/
public static Intent createIntent(Collection<? extends Issue> issues, int position) {
final int count = issues.size();
int[] numbers = new int[count];
boolean[] pullRequests = new boolean[count];
ArrayList<Repository> repos = new ArrayList<>(count);
int index = 0;
for (Issue issue : issues) {
numbers[index] = issue.number();
pullRequests[index] = IssueUtils.isPullRequest(issue);
index++;
Repository repoId = null;
Repository issueRepo = issue.repository();
if (issueRepo != null) {
User owner = issueRepo.owner();
if (owner != null) {
repoId = InfoUtils.createRepoFromData(owner.login(), issueRepo.name());
}
}
if (repoId == null) {
repoId = InfoUtils.createRepoFromUrl(issue.htmlUrl());
}
repos.add(repoId);
}
Builder builder = new Builder("issues.VIEW");
builder.add(EXTRA_ISSUE_NUMBERS, numbers);
builder.add(EXTRA_REPOSITORIES, repos);
builder.add(EXTRA_POSITION, position);
builder.add(EXTRA_PULL_REQUESTS, pullRequests);
return builder.toIntent();
}
use of com.github.pockethub.android.Intents.Builder in project PocketHub by pockethub.
the class IssuesViewActivity method createIntent.
/**
* Create an intent to show issues with an initial selected issue
*
* @param issues
* @param repository
* @param position
* @return intent
*/
public static Intent createIntent(final Collection<? extends Issue> issues, final Repository repository, final int position) {
int[] numbers = new int[issues.size()];
boolean[] pullRequests = new boolean[issues.size()];
int index = 0;
for (Issue issue : issues) {
numbers[index] = issue.number();
pullRequests[index] = IssueUtils.isPullRequest(issue);
index++;
}
return new Builder("issues.VIEW").add(EXTRA_ISSUE_NUMBERS, numbers).add(EXTRA_REPOSITORY, repository).add(EXTRA_POSITION, position).add(EXTRA_PULL_REQUESTS, pullRequests).toIntent();
}
use of com.github.pockethub.android.Intents.Builder in project PocketHub by pockethub.
the class CommitCompareViewActivity method createIntent.
/**
* Create intent for this activity
*
* @param repository
* @param base
* @param head
* @return intent
*/
public static Intent createIntent(final Repository repository, final String base, final String head) {
Builder builder = new Builder("commits.compare.VIEW");
builder.add(EXTRA_BASE, base);
builder.add(EXTRA_HEAD, head);
builder.repo(repository);
return builder.toIntent();
}
Aggregations