use of me.jingbin.library.view.OnItemFilterClickListener in project CloudReader by youlookwhat.
the class TreeFragment method initRefreshView.
private void initRefreshView() {
RefreshHelper.setSwipeRefreshView(bindingView.srlWan);
bindingView.srlWan.setOnRefreshListener(() -> bindingView.srlWan.postDelayed(this::getTree, 150));
LinearLayoutManager layoutManager = new LinearLayoutManager(activity);
bindingView.xrvWan.setLayoutManager(layoutManager);
mTreeAdapter = new TreeAdapter(activity);
bindingView.xrvWan.setAdapter(mTreeAdapter);
HeaderItemTreeBinding oneBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.header_item_tree, null, false);
bindingView.xrvWan.addHeaderView(oneBinding.getRoot());
oneBinding.tvPosition.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!mTreeAdapter.isSelect()) {
GridLayoutManager layoutManager = new GridLayoutManager(activity, 2);
bindingView.xrvWan.setLayoutManager(layoutManager);
oneBinding.tvPosition.setText("选择类别");
mTreeAdapter.setSelect(true);
mTreeAdapter.notifyDataSetChanged();
bindingView.xrvWan.addItemDecoration(new SpacesItemDecoration(activity).setNoShowDivider(1, 0).setDrawable(R.drawable.shape_line));
} else {
LinearLayoutManager layoutManager = new LinearLayoutManager(activity);
bindingView.xrvWan.setLayoutManager(layoutManager);
oneBinding.tvPosition.setText("发现页内容订制");
mTreeAdapter.setSelect(false);
mTreeAdapter.notifyDataSetChanged();
if (bindingView.xrvWan.getItemDecorationCount() > 0) {
bindingView.xrvWan.removeItemDecorationAt(0);
}
}
}
});
bindingView.xrvWan.setOnItemClickListener(new OnItemFilterClickListener() {
@Override
public void onSingleClick(View v, int position) {
if (mTreeAdapter.isSelect()) {
if (mTreeAdapter.getSelectedPosition() == position) {
ToastUtil.showToastLong("当前已经是\"" + mTreeAdapter.getData().get(position).getName() + "\"");
return;
}
LinearLayoutManager layoutManager = new LinearLayoutManager(activity);
bindingView.xrvWan.setLayoutManager(layoutManager);
oneBinding.tvPosition.setText("发现页内容订制");
mTreeAdapter.setSelect(false);
mTreeAdapter.notifyDataSetChanged();
if (bindingView.xrvWan.getItemDecorationCount() > 0) {
bindingView.xrvWan.removeItemDecorationAt(0);
}
layoutManager.scrollToPositionWithOffset(position + bindingView.xrvWan.getCustomTopItemViewCount(), 0);
RxBus.getDefault().post(RxCodeConstants.FIND_CUSTOM, position);
}
}
});
}
use of me.jingbin.library.view.OnItemFilterClickListener in project CloudReader by youlookwhat.
the class FilmComingFragment method initRefreshView.
private void initRefreshView() {
bindingView.srlWan.setColorSchemeColors(CommonUtils.getColor(activity, R.color.colorTheme));
adapter = new FilmComingAdapter(activity);
bindingView.xrvWan.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
bindingView.xrvWan.setItemAnimator(null);
bindingView.xrvWan.setHasFixedSize(true);
bindingView.xrvWan.setLoadMoreEnabled(true);
viewModel.bookType.set(mType);
bindingView.xrvWan.setAdapter(adapter);
bindingView.xrvWan.setOnItemClickListener(new OnItemFilterClickListener() {
@Override
public void onSingleClick(View v, int position) {
ImageView imageView = v.findViewById(R.id.iv_top_photo);
ComingFilmBean.MoviecomingsBean bean = adapter.getItemData(position);
FilmItemBean filmItemBean = new FilmItemBean();
filmItemBean.setId(bean.getId());
filmItemBean.setDN(bean.getDirector());
filmItemBean.setTCn(bean.getTitle());
filmItemBean.setTEn(bean.getReleaseDate());
filmItemBean.setMovieType(bean.getType());
filmItemBean.setImg(bean.getImage());
filmItemBean.setLocationName(bean.getLocationName());
String actor1 = bean.getActor1();
String actor2 = bean.getActor2();
if (!TextUtils.isEmpty(actor2)) {
actor1 = actor1 + " / " + actor2;
}
filmItemBean.setActors(actor1);
FilmDetailActivity.start(activity, filmItemBean, imageView);
}
});
bindingView.srlWan.setOnRefreshListener(this::getHotFilm);
}
use of me.jingbin.library.view.OnItemFilterClickListener in project CloudReader by youlookwhat.
the class CoinRankFragment method initRefreshView.
private void initRefreshView() {
headerBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.header_coin_rank, (ViewGroup) bindingView.xrvWan.getParent(), false);
RefreshHelper.initLinear(bindingView.xrvWan, true, 1);
RefreshHelper.setSwipeRefreshView(bindingView.srlWan);
mAdapter = new CoinAdapter(activity, true);
bindingView.xrvWan.setAdapter(mAdapter);
bindingView.xrvWan.addHeaderView(headerBinding.getRoot());
headerBinding.ivCoinRank.setVisibility(View.INVISIBLE);
bindingView.srlWan.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
bindingView.xrvWan.postDelayed(new Runnable() {
@Override
public void run() {
viewModel.setPage(1);
getCoinRank();
}
}, 150);
}
});
bindingView.xrvWan.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
if (!bindingView.srlWan.isRefreshing()) {
int page = viewModel.getPage();
viewModel.setPage(++page);
getCoinRank();
} else {
bindingView.xrvWan.loadMoreComplete();
}
}
});
bindingView.xrvWan.setOnItemClickListener(new OnItemFilterClickListener() {
@Override
protected void onSingleClick(View v, int position) {
CoinLogBean bean = mAdapter.getItemData(position);
MyShareActivity.start(activity, DataUtil.getName(bean.getUsername(), bean.getNickname()), bean.getUserId());
}
});
}
use of me.jingbin.library.view.OnItemFilterClickListener in project CloudReader by youlookwhat.
the class FilmShowingFragment method initRefreshView.
private void initRefreshView() {
viewModel.bookType.set(mType);
bindingView.srlWan.setColorSchemeColors(CommonUtils.getColor(activity, R.color.colorTheme));
adapter = new FilmAdapter(activity);
bindingView.xrvWan.setLayoutManager(new LinearLayoutManager(activity));
bindingView.xrvWan.setItemAnimator(null);
bindingView.xrvWan.setHasFixedSize(true);
bindingView.xrvWan.setLoadMoreEnabled(true);
bindingView.xrvWan.setAdapter(adapter);
bindingView.xrvWan.setOnItemClickListener(new OnItemFilterClickListener() {
@Override
public void onSingleClick(View v, int position) {
ImageView imageView = v.findViewById(R.id.iv_one_photo);
FilmItemBean itemData = adapter.getItemData(position);
FilmDetailActivity.start(activity, itemData, imageView);
}
});
bindingView.srlWan.setOnRefreshListener(this::getHotFilm);
}
use of me.jingbin.library.view.OnItemFilterClickListener in project CloudReader by youlookwhat.
the class WelfareFragment method initRecycleView.
private void initRecycleView() {
int width = (DensityUtil.getDisplayWidth() - 36) / 2;
mWelfareAdapter = new BaseBindingAdapter<GankIoDataBean.ResultBean, ItemWelfareBinding>(R.layout.item_welfare) {
@Override
protected void bindView(BaseBindingHolder holder, GankIoDataBean.ResultBean bean, ItemWelfareBinding binding, int position) {
DensityUtil.setWidthHeight(binding.ivWelfare, width, 852 / 1280f);
DensityUtil.setWidthHeight(binding.viewMask, width, 852 / 1280f);
binding.setBean(bean);
}
};
RefreshHelper.initStaggeredGrid(bindingView.xrvWelfare, 2, 12);
bindingView.xrvWelfare.setAdapter(mWelfareAdapter);
bindingView.xrvWelfare.setOnLoadMoreListener(new ByRecyclerView.OnLoadMoreListener() {
@Override
public void onLoadMore() {
int page = viewModel.getPage();
page++;
viewModel.setPage(page);
loadWelfareData();
}
}, 300);
bindingView.xrvWelfare.setOnItemClickListener(new OnItemFilterClickListener() {
@Override
public void onSingleClick(View v, int position) {
ViewBigImageActivity.startImageList(getContext(), position, imgList, imgTitleList);
}
});
viewModel.getImageAndTitle().observe(getViewLifecycleOwner(), new Observer<ArrayList<ArrayList<String>>>() {
@Override
public void onChanged(@Nullable ArrayList<ArrayList<String>> arrayLists) {
if (arrayLists != null && arrayLists.size() == 2) {
imgList.addAll(arrayLists.get(0));
imgTitleList.addAll(arrayLists.get(1));
}
}
});
}
Aggregations