Search in sources :

Example 6 with User

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()));
    }
}
Also used : User(com.fastaccess.data.dao.model.User)

Example 7 with User

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()));
}
Also used : User(com.fastaccess.data.dao.model.User) Login(com.fastaccess.data.dao.model.Login) PullsIssuesParser(com.fastaccess.data.dao.PullsIssuesParser)

Example 8 with User

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;
}
Also used : UsersAdapter(com.fastaccess.ui.adapter.UsersAdapter) BaseViewHolder(com.fastaccess.ui.widgets.recyclerview.BaseViewHolder) User(com.fastaccess.data.dao.model.User) BindView(butterknife.BindView) ForegroundImageView(com.fastaccess.ui.widgets.ForegroundImageView) FontTextView(com.fastaccess.ui.widgets.FontTextView) View(android.view.View) DynamicRecyclerView(com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView) SuppressLint(android.annotation.SuppressLint)

Example 9 with User

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());
}
Also used : User(com.fastaccess.data.dao.model.User)

Example 10 with User

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);
}
Also used : User(com.fastaccess.data.dao.model.User)

Aggregations

User (com.fastaccess.data.dao.model.User)15 LabelModel (com.fastaccess.data.dao.LabelModel)4 Login (com.fastaccess.data.dao.model.Login)4 SpannableBuilder (com.fastaccess.ui.widgets.SpannableBuilder)4 NonNull (android.support.annotation.NonNull)3 MilestoneModel (com.fastaccess.data.dao.MilestoneModel)3 PullsIssuesParser (com.fastaccess.data.dao.PullsIssuesParser)3 PullRequest (com.fastaccess.data.dao.model.PullRequest)3 Intent (android.content.Intent)2 Bundle (android.os.Bundle)2 Nullable (android.support.annotation.Nullable)2 Collectors (com.annimon.stream.Collectors)2 Stream (com.annimon.stream.Stream)2 R (com.fastaccess.R)2 IssueRequestModel (com.fastaccess.data.dao.IssueRequestModel)2 LabelListModel (com.fastaccess.data.dao.LabelListModel)2 UsersListModel (com.fastaccess.data.dao.UsersListModel)2 BundleConstant (com.fastaccess.helper.BundleConstant)2 InputHelper (com.fastaccess.helper.InputHelper)2 RxHelper (com.fastaccess.helper.RxHelper)2