use of com.github.pockethub.android.ui.item.commit.CommitItem in project PocketHub by pockethub.
the class CommitCompareListFragment method updateList.
private void updateList(CommitCompare compare) {
if (!isAdded()) {
return;
}
this.compare = compare;
progress.setVisibility(View.GONE);
list.setVisibility(View.VISIBLE);
List<Commit> commits = compare.commits();
if (!commits.isEmpty()) {
String comparingCommits = getString(R.string.comparing_commits);
String text = MessageFormat.format(comparingCommits, commits.size());
commitsSection.setHeader(new TextItem(R.layout.commit_details_header, R.id.tv_commit_summary, text));
List<CommitItem> items = new ArrayList<>();
for (Commit commit : commits) {
items.add(new CommitItem(avatars, commit));
}
commitsSection.update(items);
}
List<GitHubFile> files = compare.files();
if (!files.isEmpty()) {
filesSection.setHeader(new TextItem(R.layout.commit_compare_file_details_header, R.id.tv_commit_file_summary, CommitUtils.formatStats(files)));
filesSection.update(createFileSections(files));
}
}
use of com.github.pockethub.android.ui.item.commit.CommitItem in project PocketHub by pockethub.
the class CommitViewActivity method createIntent.
/**
* Create intent for this activity
*
* @param repository
* @param position
* @param commits
* @return intent
*/
public static Intent createIntent(final Repository repository, final int position, final Collection<Item> commits) {
String[] ids = new String[commits.size()];
int index = 0;
for (Item item : commits) {
Commit commit = ((CommitItem) item).getCommit();
ids[index++] = commit.sha();
}
return createIntent(repository, position, ids);
}
Aggregations