Search in sources :

Example 1 with TextItem

use of com.github.pockethub.android.ui.item.TextItem in project PocketHub by pockethub.

the class CommitDiffListFragment method updateList.

private void updateList(Commit commit, List<GitComment> comments, List<FullCommitFile> files) {
    if (!isAdded()) {
        return;
    }
    this.commit = commit;
    this.comments = comments;
    this.files = files;
    updateHeader(commit);
    mainSection.removeFooter();
    filesSection.setHeader(new TextItem(R.layout.commit_file_details_header, R.id.tv_commit_file_summary, CommitUtils.formatStats(commit.files())));
    updateItems(comments, files);
}
Also used : TextItem(com.github.pockethub.android.ui.item.TextItem)

Example 2 with TextItem

use of com.github.pockethub.android.ui.item.TextItem 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));
    }
}
Also used : Commit(com.meisolsson.githubsdk.model.Commit) TextItem(com.github.pockethub.android.ui.item.TextItem) CommitItem(com.github.pockethub.android.ui.item.commit.CommitItem) ArrayList(java.util.ArrayList) GitHubFile(com.meisolsson.githubsdk.model.GitHubFile)

Aggregations

TextItem (com.github.pockethub.android.ui.item.TextItem)2 CommitItem (com.github.pockethub.android.ui.item.commit.CommitItem)1 Commit (com.meisolsson.githubsdk.model.Commit)1 GitHubFile (com.meisolsson.githubsdk.model.GitHubFile)1 ArrayList (java.util.ArrayList)1