Search in sources :

Example 11 with Builder

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();
}
Also used : Builder(com.github.pockethub.android.Intents.Builder)

Example 12 with Builder

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();
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) Issue(com.meisolsson.githubsdk.model.Issue) User(com.meisolsson.githubsdk.model.User) Builder(com.github.pockethub.android.Intents.Builder) ArrayList(java.util.ArrayList)

Example 13 with Builder

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();
}
Also used : Issue(com.meisolsson.githubsdk.model.Issue) Builder(com.github.pockethub.android.Intents.Builder)

Example 14 with Builder

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();
}
Also used : Builder(com.github.pockethub.android.Intents.Builder)

Aggregations

Builder (com.github.pockethub.android.Intents.Builder)14 Gist (com.meisolsson.githubsdk.model.Gist)2 Issue (com.meisolsson.githubsdk.model.Issue)2 MenuItem (android.view.MenuItem)1 GistItem (com.github.pockethub.android.ui.item.gist.GistItem)1 Repository (com.meisolsson.githubsdk.model.Repository)1 User (com.meisolsson.githubsdk.model.User)1 Item (com.xwray.groupie.Item)1 ArrayList (java.util.ArrayList)1