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()));
}
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());
}
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());
}
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);
}
}
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);
}
}
Aggregations