use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class IssuePagerActivity method updateViews.
private void updateViews(@NonNull Issue issueModel) {
User userModel = issueModel.getUser();
title.setText(issueModel.getTitle());
detailsIcon.setVisibility(View.VISIBLE);
if (userModel != null) {
size.setVisibility(View.GONE);
String username;
CharSequence parsedDate;
if (issueModel.getState() == IssueState.closed) {
username = issueModel.getClosedBy() != null ? issueModel.getClosedBy().getLogin() : "N/A";
parsedDate = issueModel.getClosedAt() != null ? ParseDateFormat.getTimeAgo(issueModel.getClosedAt()) : "N/A";
} else {
parsedDate = ParseDateFormat.getTimeAgo(issueModel.getCreatedAt());
username = issueModel.getUser() != null ? issueModel.getUser().getLogin() : "N/A";
}
date.setText(SpannableBuilder.builder().append(ContextCompat.getDrawable(this, issueModel.getState() == IssueState.open ? R.drawable.ic_issue_opened_small : R.drawable.ic_issue_closed_small)).append(" ").append(getString(issueModel.getState().getStatus())).append(" ").append(getString(R.string.by)).append(" ").append(username).append(" ").append(parsedDate));
avatarLayout.setUrl(userModel.getAvatarUrl(), userModel.getLogin(), false, LinkParserHelper.isEnterprise(issueModel.getHtmlUrl()));
}
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class IssuePagerPresenter method isOwner.
@Override
public boolean isOwner() {
if (getIssue() == null)
return false;
User userModel = getIssue() != null ? getIssue().getUser() : null;
Login me = Login.getUser();
PullsIssuesParser parser = PullsIssuesParser.getForIssue(getIssue().getHtmlUrl());
return (userModel != null && userModel.getLogin().equalsIgnoreCase(me.getLogin())) || (parser != null && parser.getLogin().equalsIgnoreCase(me.getLogin()));
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class FilterIssuesActivity method getAssigneesAdapter.
private UsersAdapter getAssigneesAdapter() {
if (assigneesAdapter == null) {
if (!getPresenter().getAssignees().isEmpty()) {
User user = new User();
user.setLogin(getString(R.string.clear));
getPresenter().getAssignees().add(0, user);
}
assigneesAdapter = new UsersAdapter(getPresenter().getAssignees(), false, true);
assigneesAdapter.setListener(new BaseViewHolder.OnItemClickListener<User>() {
@Override
public void onItemClick(int position, View v, User item) {
appendAssignee(item);
}
@Override
public void onItemLongClick(int position, View v, User item) {
}
});
}
return assigneesAdapter;
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendMemberEvent.
private void appendMemberEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
User user = eventsModel.getPayload().getMember();
spannableBuilder.bold("added").append(" ").append(user != null ? user.getLogin() + " " : "").append("as a collaborator").append(" ").append("to").append(" ").append(eventsModel.getRepo().getName());
}
use of com.fastaccess.data.dao.model.User in project FastHub by k0shk0sh.
the class PullRequestPagerActivity method updateViews.
private void updateViews(@NonNull PullRequest pullRequest) {
setTitle(String.format("#%s", pullRequest.getNumber()));
if (getSupportActionBar() != null) {
getSupportActionBar().setSubtitle(pullRequest.getRepoId());
}
date.setText(SpannableBuilder.builder().append(getPresenter().getMergeBy(pullRequest, getApplicationContext())));
size.setVisibility(View.GONE);
User userModel = pullRequest.getUser();
if (userModel != null) {
title.setText(SpannableBuilder.builder().append(userModel.getLogin()).append("/").append(pullRequest.getTitle()));
avatarLayout.setUrl(userModel.getAvatarUrl(), userModel.getLogin(), false, LinkParserHelper.isEnterprise(pullRequest.getUrl()));
} else {
title.setText(SpannableBuilder.builder().append(pullRequest.getTitle()));
}
detailsIcon.setVisibility(View.VISIBLE);
}
Aggregations