Search in sources :

Example 1 with MilestonesAdapter

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

the class FilterIssuesActivity method getMilestonesAdapter.

private MilestonesAdapter getMilestonesAdapter() {
    if (milestonesAdapter == null) {
        if (!getPresenter().getMilestones().isEmpty()) {
            MilestoneModel milestone = new MilestoneModel();
            milestone.setTitle(getString(R.string.clear));
            getPresenter().getMilestones().add(0, milestone);
        }
        milestonesAdapter = new MilestonesAdapter(getPresenter().getMilestones());
        milestonesAdapter.setListener(new BaseViewHolder.OnItemClickListener<MilestoneModel>() {

            @Override
            public void onItemClick(int position, View v, MilestoneModel item) {
                appendMilestone(item);
            }

            @Override
            public void onItemLongClick(int position, View v, MilestoneModel item) {
            }
        });
    }
    return milestonesAdapter;
}
Also used : MilestonesAdapter(com.fastaccess.ui.adapter.MilestonesAdapter) BaseViewHolder(com.fastaccess.ui.widgets.recyclerview.BaseViewHolder) MilestoneModel(com.fastaccess.data.dao.MilestoneModel) 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 2 with MilestonesAdapter

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

the class MilestoneDialogFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    if (getArguments() == null) {
        return;
    }
    String login = getArguments().getString(BundleConstant.EXTRA);
    String repo = getArguments().getString(BundleConstant.ID);
    if (login == null || repo == null) {
        return;
    }
    stateLayout.setEmptyText(R.string.no_milestones);
    toolbar.setTitle(R.string.milestone);
    toolbar.setOnMenuItemClickListener(item -> onAddMilestone());
    if (onMilestoneSelected != null)
        toolbar.inflateMenu(R.menu.add_menu);
    toolbar.setNavigationIcon(R.drawable.ic_clear);
    toolbar.setNavigationOnClickListener(v -> {
        if (getParentFragment() instanceof BaseDialogFragment) {
            ((BaseDialogFragment) getParentFragment()).dismiss();
        }
    });
    recycler.addDivider();
    adapter = new MilestonesAdapter(getPresenter().getMilestones());
    if (onMilestoneSelected != null)
        adapter.setListener(getPresenter());
    recycler.setEmptyView(stateLayout, refresh);
    recycler.setAdapter(adapter);
    recycler.addKeyLineDivider();
    if (savedInstanceState == null || (getPresenter().getMilestones().isEmpty() && !getPresenter().isApiCalled())) {
        getPresenter().onLoadMilestones(login, repo);
    }
    stateLayout.setOnReloadListener(v -> getPresenter().onLoadMilestones(login, repo));
    refresh.setOnRefreshListener(() -> getPresenter().onLoadMilestones(login, repo));
    fastScroller.attachRecyclerView(recycler);
}
Also used : MilestonesAdapter(com.fastaccess.ui.adapter.MilestonesAdapter) BaseDialogFragment(com.fastaccess.ui.base.BaseDialogFragment)

Aggregations

MilestonesAdapter (com.fastaccess.ui.adapter.MilestonesAdapter)2 SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 BindView (butterknife.BindView)1 MilestoneModel (com.fastaccess.data.dao.MilestoneModel)1 BaseDialogFragment (com.fastaccess.ui.base.BaseDialogFragment)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