use of com.fastaccess.ui.adapter.UsersAdapter in project FastHub by k0shk0sh.
the class ProfileFollowersFragment method onFragmentCreated.
@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
if (getArguments() == null) {
throw new NullPointerException("Bundle is null, username is required");
}
stateLayout.setEmptyText(R.string.no_followers);
stateLayout.setOnReloadListener(this);
refresh.setOnRefreshListener(this);
recycler.setEmptyView(stateLayout, refresh);
getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
adapter = new UsersAdapter(getPresenter().getFollowers());
adapter.setListener(getPresenter());
recycler.setAdapter(adapter);
recycler.addOnScrollListener(getLoadMore());
recycler.addKeyLineDivider();
if (getPresenter().getFollowers().isEmpty() && !getPresenter().isApiCalled()) {
onRefresh();
}
fastScroller.attachRecyclerView(recycler);
}
use of com.fastaccess.ui.adapter.UsersAdapter in project FastHub by k0shk0sh.
the class ReactionsDialogFragment method onFragmentCreated.
@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
toolbar.setNavigationIcon(R.drawable.ic_clear);
toolbar.setNavigationOnClickListener(v -> dismiss());
stateLayout.setEmptyText(R.string.no_reactions);
stateLayout.setOnReloadListener(v -> getPresenter().onCallApi(1, null));
refresh.setOnRefreshListener(() -> getPresenter().onCallApi(1, null));
recycler.setEmptyView(stateLayout, refresh);
adapter = new UsersAdapter(getPresenter().getUsers());
getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
recycler.setAdapter(adapter);
recycler.addOnScrollListener(getLoadMore());
if (savedInstanceState == null) {
getPresenter().onFragmentCreated(getArguments());
}
toolbar.setTitle(SpannableBuilder.builder().append(getString(R.string.reactions)).append(" ").append(CommentsHelper.getEmoji(getPresenter().getReactionType())));
fastScroller.attachRecyclerView(recycler);
}
use of com.fastaccess.ui.adapter.UsersAdapter in project FastHub by k0shk0sh.
the class SearchUsersFragment method onFragmentCreated.
@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
stateLayout.setEmptyText(R.string.no_search_results);
getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
stateLayout.setOnReloadListener(this);
refresh.setOnRefreshListener(this);
recycler.setEmptyView(stateLayout, refresh);
adapter = new UsersAdapter(getPresenter().getUsers());
adapter.setListener(getPresenter());
recycler.setAdapter(adapter);
recycler.addKeyLineDivider();
if (savedInstanceState != null) {
if (!InputHelper.isEmpty(searchQuery) && getPresenter().getUsers().isEmpty() && !getPresenter().isApiCalled()) {
onRefresh();
}
}
if (InputHelper.isEmpty(searchQuery)) {
stateLayout.showEmptyState();
}
fastScroller.attachRecyclerView(recycler);
}
use of com.fastaccess.ui.adapter.UsersAdapter in project FastHub by k0shk0sh.
the class RepoMiscDialogFragment method onFragmentCreated.
@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
if (getArguments() == null) {
throw new NullPointerException("Bundle is null, username is required");
}
switch(getPresenter().getType()) {
case RepoMiscMVp.FORKS:
toolbar.setTitle(R.string.forks);
stateLayout.setEmptyText(String.format("%s %s", getString(R.string.no), getString(R.string.forks)));
break;
case RepoMiscMVp.STARS:
toolbar.setTitle(R.string.stars);
stateLayout.setEmptyText(String.format("%s %s", getString(R.string.no), getString(R.string.stars)));
break;
case RepoMiscMVp.WATCHERS:
toolbar.setTitle(R.string.watchers);
stateLayout.setEmptyText(String.format("%s %s", getString(R.string.no), getString(R.string.watchers)));
break;
}
toolbar.setNavigationIcon(R.drawable.ic_clear);
toolbar.setNavigationOnClickListener(v -> dismiss());
stateLayout.setOnReloadListener(v -> getPresenter().onCallApi(1, null));
refresh.setOnRefreshListener(() -> getPresenter().onCallApi(1, null));
recycler.setEmptyView(stateLayout, refresh);
getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
adapter = new UsersAdapter(getPresenter().getList());
adapter.setListener(getPresenter());
recycler.setAdapter(adapter);
recycler.addOnScrollListener(getLoadMore());
recycler.addKeyLineDivider();
if (getPresenter().getList().isEmpty() && !getPresenter().isApiCalled()) {
getPresenter().onCallApi(1, null);
}
fastScroller.attachRecyclerView(recycler);
}
use of com.fastaccess.ui.adapter.UsersAdapter 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;
}
Aggregations