Search in sources :

Example 1 with LabelsAdapter

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

the class FilterIssuesActivity method getLabelsAdapter.

private LabelsAdapter getLabelsAdapter() {
    if (labelsAdapter == null) {
        if (!getPresenter().getLabels().isEmpty()) {
            LabelModel label = new LabelModel();
            label.setName(getString(R.string.clear));
            getPresenter().getLabels().add(0, label);
        }
        labelsAdapter = new LabelsAdapter(getPresenter().getLabels(), null);
        labelsAdapter.setListener(new BaseViewHolder.OnItemClickListener<LabelModel>() {

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

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

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

the class LabelsDialogFragment method onFragmentCreated.

@Override
protected void onFragmentCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    stateLayout.setEmptyText(R.string.no_labels);
    recycler.setEmptyView(stateLayout, refresh);
    refresh.setOnRefreshListener(() -> getPresenter().onCallApi(1, null));
    stateLayout.setOnReloadListener(v -> getPresenter().onCallApi(1, null));
    recycler.addDivider();
    title.setText(R.string.labels);
    add.setVisibility(View.VISIBLE);
    labelModels = getArguments().getParcelableArrayList(BundleConstant.EXTRA);
    if (labelModels == null) {
        labelModels = new ArrayList<>();
    }
    add.setVisibility(callback == null ? View.GONE : View.VISIBLE);
    adapter = new LabelsAdapter(getPresenter().getLabels(), this);
    recycler.setAdapter(adapter);
    fastScroller.attachRecyclerView(recycler);
    recycler.addOnScrollListener(getLoadMore());
    if (getPresenter().getLabels().isEmpty() && !getPresenter().isApiCalled()) {
        getPresenter().onCallApi(1, null);
    }
}
Also used : LabelsAdapter(com.fastaccess.ui.adapter.LabelsAdapter)

Aggregations

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