use of me.yluo.ruisiapp.adapter.HotNewListAdapter in project Ruisi by freedom10086.
the class FrageHotsNews method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
((RadioButton) mRootView.findViewById(R.id.btn_1)).setText("新帖");
mRootView.findViewById(R.id.btn_2).setVisibility(View.GONE);
((RadioButton) mRootView.findViewById(R.id.btn_3)).setText("热贴");
postList = mRootView.findViewById(R.id.recycler_view);
refreshLayout = mRootView.findViewById(R.id.refresh_layout);
refreshLayout.setColorSchemeResources(R.color.red_light, R.color.green_light, R.color.blue_light, R.color.orange_light);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getActivity());
postList.setLayoutManager(mLayoutManager);
postList.addItemDecoration(new MyListDivider(getActivity(), MyListDivider.VERTICAL));
// 设置可以滑出底栏
postList.setClipToPadding(false);
postList.setPadding(0, 0, 0, (int) getResources().getDimension(R.dimen.bottombarHeight));
adapter = new HotNewListAdapter(getActivity(), mydataset, galleryDatas);
postList.setAdapter(adapter);
postList.addOnScrollListener(new LoadMoreListener((LinearLayoutManager) mLayoutManager, this, 10));
refreshLayout.setOnRefreshListener(this::refresh);
RadioGroup swictchMes = mRootView.findViewById(R.id.btn_change);
swictchMes.setOnCheckedChangeListener((radioGroup, id) -> {
int pos = -1;
if (id == R.id.btn_1) {
pos = TYPE_NEW;
} else {
pos = TYPE_HOT;
}
if (pos != currentType) {
currentType = pos;
refreshLayout.setRefreshing(true);
refresh();
}
});
return mRootView;
}
Aggregations