Search in sources :

Example 1 with ReleasesAdapter

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

the class RepoReleasesFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    if (getArguments() == null) {
        throw new NullPointerException("Bundle is null, therefore, issues can't be proceeded.");
    }
    stateLayout.setEmptyText(R.string.no_releases);
    stateLayout.setOnReloadListener(this);
    refresh.setOnRefreshListener(this);
    recycler.setEmptyView(stateLayout, refresh);
    recycler.addDivider();
    adapter = new ReleasesAdapter(getPresenter().getReleases());
    adapter.setListener(getPresenter());
    getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
    recycler.setAdapter(adapter);
    recycler.addOnScrollListener(getLoadMore());
    if (savedInstanceState == null) {
        getPresenter().onFragmentCreated(getArguments());
    } else if (getPresenter().getReleases().isEmpty() && !getPresenter().isApiCalled()) {
        onRefresh();
    }
    fastScroller.attachRecyclerView(recycler);
}
Also used : ReleasesAdapter(com.fastaccess.ui.adapter.ReleasesAdapter)

Aggregations

ReleasesAdapter (com.fastaccess.ui.adapter.ReleasesAdapter)1