Search in sources :

Example 6 with UsersAdapter

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

the class OrgListDialogFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    toolbar.setTitle(R.string.organizations);
    toolbar.inflateMenu(R.menu.add_menu);
    toolbar.getMenu().findItem(R.id.add).setIcon(R.drawable.ic_info_outline).setTitle(R.string.no_orgs_dialog_title);
    toolbar.setOnMenuItemClickListener(item -> {
        MessageDialogView.newInstance(getString(R.string.no_orgs_dialog_title), getString(R.string.no_orgs_description), false, true).show(getChildFragmentManager(), MessageDialogView.TAG);
        return true;
    });
    toolbar.setNavigationIcon(R.drawable.ic_clear);
    toolbar.setNavigationOnClickListener(v -> dismiss());
    stateLayout.setEmptyText(R.string.no_orgs);
    stateLayout.setOnReloadListener(v -> getPresenter().onLoadOrgs());
    refresh.setOnRefreshListener(() -> getPresenter().onLoadOrgs());
    recycler.setEmptyView(stateLayout, refresh);
    adapter = new UsersAdapter(getPresenter().getOrgs());
    recycler.setAdapter(adapter);
    recycler.addKeyLineDivider();
    if (savedInstanceState == null) {
        getPresenter().onLoadOrgs();
    }
    fastScroller.attachRecyclerView(recycler);
}
Also used : UsersAdapter(com.fastaccess.ui.adapter.UsersAdapter)

Example 7 with UsersAdapter

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

the class RepoContributorsFragment 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_contributors);
    stateLayout.setOnReloadListener(this);
    refresh.setOnRefreshListener(this);
    recycler.setEmptyView(stateLayout, refresh);
    recycler.addKeyLineDivider();
    adapter = new UsersAdapter(getPresenter().getUsers(), true);
    adapter.setListener(getPresenter());
    getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
    recycler.setAdapter(adapter);
    recycler.addOnScrollListener(getLoadMore());
    if (savedInstanceState == null) {
        getPresenter().onFragmentCreated(getArguments());
    } else if (getPresenter().getUsers().isEmpty() && !getPresenter().isApiCalled()) {
        onRefresh();
    }
    fastScroller.attachRecyclerView(recycler);
}
Also used : UsersAdapter(com.fastaccess.ui.adapter.UsersAdapter)

Example 8 with UsersAdapter

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

the class TeamMembersFragment 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_members);
    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);
}
Also used : UsersAdapter(com.fastaccess.ui.adapter.UsersAdapter)

Example 9 with UsersAdapter

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

the class ProfileFollowingFragment 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_followings);
    stateLayout.setOnReloadListener(this);
    refresh.setOnRefreshListener(this);
    recycler.setEmptyView(stateLayout, refresh);
    getLoadMore().initialize(getPresenter().getCurrentPage(), getPresenter().getPreviousTotal());
    adapter = new UsersAdapter(getPresenter().getFollowing());
    adapter.setListener(getPresenter());
    recycler.setAdapter(adapter);
    recycler.addOnScrollListener(getLoadMore());
    recycler.addKeyLineDivider();
    if (getPresenter().getFollowing().isEmpty() && !getPresenter().isApiCalled()) {
        onRefresh();
    }
    fastScroller.attachRecyclerView(recycler);
}
Also used : UsersAdapter(com.fastaccess.ui.adapter.UsersAdapter)

Example 10 with UsersAdapter

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

the class OrgMembersFragment 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_members);
    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);
}
Also used : UsersAdapter(com.fastaccess.ui.adapter.UsersAdapter)

Aggregations

UsersAdapter (com.fastaccess.ui.adapter.UsersAdapter)10 SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 BindView (butterknife.BindView)1 User (com.fastaccess.data.dao.model.User)1 FontTextView (com.fastaccess.ui.widgets.FontTextView)1 ForegroundImageView (com.fastaccess.ui.widgets.ForegroundImageView)1 BaseViewHolder (com.fastaccess.ui.widgets.recyclerview.BaseViewHolder)1 DynamicRecyclerView (com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView)1