Search in sources :

Example 1 with IssuesTimelineAdapter

use of com.fastaccess.ui.adapter.IssuesTimelineAdapter in project FastHub by k0shk0sh.

the class CommitCommentsFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    if (savedInstanceState == null)
        getPresenter().onFragmentCreated(getArguments());
    stateLayout.setEmptyText(R.string.no_comments);
    recycler.setEmptyView(stateLayout, refresh);
    recycler.setItemViewCacheSize(30);
    refresh.setOnRefreshListener(this);
    stateLayout.setOnReloadListener(this);
    adapter = new IssuesTimelineAdapter(getPresenter().getComments(), this, true, this, getArguments().getString(BundleConstant.EXTRA), null);
    adapter.setListener(getPresenter());
    getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
    recycler.setAdapter(adapter);
    recycler.addOnScrollListener(getLoadMore());
    recycler.addNormalSpacingDivider();
    if (getPresenter().getComments().isEmpty() && !getPresenter().isApiCalled()) {
        onRefresh();
    }
    fastScroller.attachRecyclerView(recycler);
}
Also used : IssuesTimelineAdapter(com.fastaccess.ui.adapter.IssuesTimelineAdapter)

Example 2 with IssuesTimelineAdapter

use of com.fastaccess.ui.adapter.IssuesTimelineAdapter in project FastHub by k0shk0sh.

the class PullRequestTimelineFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    if (getPullRequest() == null) {
        throw new NullPointerException("PullRequest went missing!!!");
    }
    boolean isMerged = getPresenter().isMerged(getPullRequest());
    adapter = new IssuesTimelineAdapter(getPresenter().getEvents(), this, true, this, isMerged, getPresenter(), getPullRequest().getLogin(), getPullRequest().getUser().getLogin());
    stateLayout.setEmptyText(R.string.no_events);
    recycler.setEmptyView(stateLayout, refresh);
    refresh.setOnRefreshListener(this);
    stateLayout.setOnReloadListener(this);
    adapter.setListener(getPresenter());
    recycler.setAdapter(adapter);
    fastScroller.setVisibility(View.VISIBLE);
    fastScroller.attachRecyclerView(recycler);
    recycler.addDivider(TimelineCommentsViewHolder.class);
    getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
    recycler.addOnScrollListener(getLoadMore());
    if (savedInstanceState == null) {
        onSetHeader(new TimelineModel(getPullRequest()));
        onRefresh();
    } else if (getPresenter().getEvents().isEmpty() || getPresenter().getEvents().size() == 1) {
        onRefresh();
    }
}
Also used : IssuesTimelineAdapter(com.fastaccess.ui.adapter.IssuesTimelineAdapter) TimelineModel(com.fastaccess.data.dao.TimelineModel)

Example 3 with IssuesTimelineAdapter

use of com.fastaccess.ui.adapter.IssuesTimelineAdapter in project FastHub by k0shk0sh.

the class IssueTimelineFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    if (getIssue() == null) {
        throw new NullPointerException("Issue went missing!!!");
    }
    getPresenter().setCommentId(getCommentId());
    if (issueCallback != null && issueCallback.getData() != null) {
        adapter = new IssuesTimelineAdapter(getPresenter().getEvents(), this, true, this, issueCallback.getData().getLogin(), issueCallback.getData().getUser().getLogin());
    } else {
        adapter = new IssuesTimelineAdapter(getPresenter().getEvents(), this, true, this, "", "");
    }
    recycler.setVerticalScrollBarEnabled(false);
    stateLayout.setEmptyText(R.string.no_events);
    recycler.setEmptyView(stateLayout, refresh);
    refresh.setOnRefreshListener(this);
    stateLayout.setOnReloadListener(this);
    adapter.setListener(getPresenter());
    recycler.setAdapter(adapter);
    fastScroller.setVisibility(View.VISIBLE);
    fastScroller.attachRecyclerView(recycler);
    recycler.addDivider(TimelineCommentsViewHolder.class);
    getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
    recycler.addOnScrollListener(getLoadMore());
    if (savedInstanceState == null) {
        onSetHeader(TimelineModel.constructHeader(getIssue()));
        onRefresh();
    } else if (getPresenter().getEvents().isEmpty() || getPresenter().getEvents().size() == 1) {
        onRefresh();
    }
}
Also used : IssuesTimelineAdapter(com.fastaccess.ui.adapter.IssuesTimelineAdapter)

Aggregations

IssuesTimelineAdapter (com.fastaccess.ui.adapter.IssuesTimelineAdapter)3 TimelineModel (com.fastaccess.data.dao.TimelineModel)1