use of com.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class IssuesPagerAdapter method getItem.
@Override
public Fragment getItem(int position) {
IssueFragment fragment = new IssueFragment();
Bundle args = new Bundle();
if (repo != null) {
args.putString(EXTRA_REPOSITORY_NAME, repo.name());
User owner = repo.owner();
args.putString(EXTRA_REPOSITORY_OWNER, owner.login());
args.putParcelable(EXTRA_USER, owner);
} else {
Repository repo = repos.get(position);
args.putString(EXTRA_REPOSITORY_NAME, repo.name());
args.putString(EXTRA_REPOSITORY_OWNER, repo.owner().login());
Issue issue = store.getIssue(repo, issues[position]);
if (issue != null && issue.user() != null) {
Repository fullRepo = issue.repository();
if (fullRepo != null && fullRepo.owner() != null) {
args.putParcelable(EXTRA_USER, fullRepo.owner());
}
}
}
args.putInt(EXTRA_ISSUE_NUMBER, issues[position]);
args.putBoolean(EXTRA_CAN_WRITE_REPO, canWrite);
fragment.setArguments(args);
return fragment;
}
use of com.meisolsson.githubsdk.model.Issue 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.meisolsson.githubsdk.model.Issue 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.meisolsson.githubsdk.model.Issue in project PocketHub by pockethub.
the class SearchIssueListFragment method onListItemClick.
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
final Issue searchIssue = (Issue) l.getItemAtPosition(position);
startActivity(IssuesViewActivity.createIntent(searchIssue, repository));
}
Aggregations