Search in sources :

Example 1 with CommitCommentItem

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

the class CommitDiffListFragment method updateItems.

private void updateItems(List<GitComment> comments, List<FullCommitFile> files) {
    filesSection.update(createFileSections(files));
    List<CommitCommentItem> items = new ArrayList<>();
    for (GitComment comment : comments) {
        items.add(new CommitCommentItem(avatars, commentImageGetter, comment));
    }
    commentSection.update(items);
}
Also used : ArrayList(java.util.ArrayList) CommitCommentItem(com.github.pockethub.android.ui.item.commit.CommitCommentItem) GitComment(com.meisolsson.githubsdk.model.git.GitComment)

Example 2 with CommitCommentItem

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

the class CommitDiffListFragment method createFileSections.

private List<Section> createFileSections(List<FullCommitFile> files) {
    List<Section> sections = new ArrayList<>();
    for (FullCommitFile file : files) {
        Section section = new Section(new CommitFileHeaderItem(getActivity(), file.getFile()));
        List<CharSequence> lines = diffStyler.get(file.getFile().filename());
        int number = 0;
        for (CharSequence line : lines) {
            section.add(new CommitFileLineItem(diffStyler, line));
            for (GitComment comment : file.get(number)) {
                section.add(new CommitCommentItem(avatars, commentImageGetter, comment, true));
            }
            number++;
        }
        sections.add(section);
    }
    return sections;
}
Also used : FullCommitFile(com.github.pockethub.android.core.commit.FullCommitFile) CommitFileHeaderItem(com.github.pockethub.android.ui.item.commit.CommitFileHeaderItem) CommitFileLineItem(com.github.pockethub.android.ui.item.commit.CommitFileLineItem) ArrayList(java.util.ArrayList) CommitCommentItem(com.github.pockethub.android.ui.item.commit.CommitCommentItem) GitComment(com.meisolsson.githubsdk.model.git.GitComment) Section(com.xwray.groupie.Section)

Aggregations

CommitCommentItem (com.github.pockethub.android.ui.item.commit.CommitCommentItem)2 GitComment (com.meisolsson.githubsdk.model.git.GitComment)2 ArrayList (java.util.ArrayList)2 FullCommitFile (com.github.pockethub.android.core.commit.FullCommitFile)1 CommitFileHeaderItem (com.github.pockethub.android.ui.item.commit.CommitFileHeaderItem)1 CommitFileLineItem (com.github.pockethub.android.ui.item.commit.CommitFileLineItem)1 Section (com.xwray.groupie.Section)1