Search in sources :

Example 1 with StyledText

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

the class IconAndViewTextManager method update.

protected void update(int position, GitHubEvent event) {
    newsListAdapter.getAvatars().bind(newsListAdapter.imageViewAgent(0), event.actor());
    StyledText main = new StyledText();
    StyledText details = new StyledText();
    String icon = setIconAndFormatStyledText(event, main, details);
    if (icon != null) {
        ViewUtils.setGone(newsListAdapter.setTextAgent(3, icon), false);
    } else {
        newsListAdapter.setGoneAgent(3, true);
    }
    newsListAdapter.setTextAgent(1, main);
    if (!TextUtils.isEmpty(details)) {
        ViewUtils.setGone(newsListAdapter.setTextAgent(2, details), false);
    } else {
        newsListAdapter.setGoneAgent(2, true);
    }
    newsListAdapter.setTextAgent(4, TimeUtils.getRelativeTime(event.createdAt()));
}
Also used : StyledText(com.github.pockethub.android.ui.StyledText)

Example 2 with StyledText

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

the class UserRepositoryListAdapter method update.

@Override
protected void update(int position, Repository repository) {
    StyledText name = new StyledText();
    if (!login.equals(repository.owner().login())) {
        name.foreground(repository.owner().login(), descriptionColor).foreground('/', descriptionColor);
    }
    name.bold(repository.name());
    setText(5, name);
    updateDetails(repository.description(), repository.language(), repository.watchersCount(), repository.forksCount(), repository.isPrivate(), repository.isFork(), repository.mirrorUrl());
}
Also used : StyledText(com.github.pockethub.android.ui.StyledText)

Example 3 with StyledText

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

the class GistListAdapter method update.

@Override
protected void update(int position, Gist gist) {
    setText(0, gist.id());
    String description = gist.description();
    if (!TextUtils.isEmpty(description)) {
        setText(1, description);
    } else {
        setText(1, R.string.no_description_given);
    }
    User user = gist.owner();
    avatars.bind(imageView(5), user);
    StyledText authorText = new StyledText();
    if (user != null) {
        authorText.bold(user.login());
    } else {
        authorText.bold(anonymous);
    }
    authorText.append(' ');
    authorText.append(gist.createdAt());
    setText(2, authorText);
    setNumber(3, gist.comments());
    setNumber(4, gist.files().size());
}
Also used : User(com.meisolsson.githubsdk.model.User) StyledText(com.github.pockethub.android.ui.StyledText)

Example 4 with StyledText

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

the class EditIssueActivity method updateAssignee.

private void updateAssignee() {
    User assignee = issue.assignee();
    String login = assignee != null ? assignee.login() : null;
    if (!TextUtils.isEmpty(login)) {
        assigneeText.setText(new StyledText().bold(login));
        assigneeAvatar.setVisibility(VISIBLE);
        avatars.bind(assigneeAvatar, assignee);
    } else {
        assigneeAvatar.setVisibility(GONE);
        assigneeText.setText(R.string.unassigned);
    }
}
Also used : User(com.meisolsson.githubsdk.model.User) StyledText(com.github.pockethub.android.ui.StyledText)

Example 5 with StyledText

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

the class CommitDiffListFragment method addCommitDetails.

private void addCommitDetails(Commit commit) {
    adapter.addHeader(commitHeader);
    commitMessage.setText(commit.commit().message());
    String commitAuthor = CommitUtils.getAuthor(commit);
    String commitCommitter = CommitUtils.getCommitter(commit);
    if (commitAuthor != null) {
        CommitUtils.bindAuthor(commit, avatars, authorAvatar);
        authorName.setText(commitAuthor);
        StyledText styledAuthor = new StyledText();
        styledAuthor.append(getString(R.string.authored));
        Date commitAuthorDate = CommitUtils.getAuthorDate(commit);
        if (commitAuthorDate != null) {
            styledAuthor.append(' ').append(commitAuthorDate);
        }
        authorDate.setText(styledAuthor);
        ViewUtils.setGone(authorArea, false);
    } else {
        ViewUtils.setGone(authorArea, true);
    }
    if (isDifferentCommitter(commitAuthor, commitCommitter)) {
        CommitUtils.bindCommitter(commit, avatars, committerAvatar);
        committerName.setText(commitCommitter);
        StyledText styledCommitter = new StyledText();
        styledCommitter.append(getString(R.string.committed));
        Date commitCommitterDate = CommitUtils.getCommitterDate(commit);
        if (commitCommitterDate != null) {
            styledCommitter.append(' ').append(commitCommitterDate);
        }
        committerDate.setText(styledCommitter);
        ViewUtils.setGone(committerArea, false);
    } else {
        ViewUtils.setGone(committerArea, true);
    }
}
Also used : StyledText(com.github.pockethub.android.ui.StyledText) Date(java.util.Date)

Aggregations

StyledText (com.github.pockethub.android.ui.StyledText)16 TextView (android.widget.TextView)3 User (com.meisolsson.githubsdk.model.User)3 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 GitHubFile (com.meisolsson.githubsdk.model.GitHubFile)2 Date (java.util.Date)2 Resources (android.content.res.Resources)1 Paint (android.graphics.Paint)1 Rect (android.graphics.Rect)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 Folder (com.github.pockethub.android.core.code.FullTree.Folder)1 FullCommit (com.github.pockethub.android.core.commit.FullCommit)1 Commit (com.meisolsson.githubsdk.model.Commit)1 GitHubEvent (com.meisolsson.githubsdk.model.GitHubEvent)1 Label (com.meisolsson.githubsdk.model.Label)1 Milestone (com.meisolsson.githubsdk.model.Milestone)1 GitComment (com.meisolsson.githubsdk.model.git.GitComment)1