use of com.scwang.smartrefresh.layout.header.ClassicsHeader in project SmartRefreshLayout by scwang90.
the class EmptyLayoutExampleFragmentInner method onViewCreated.
@Override
public void onViewCreated(@NonNull View root, @Nullable Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
final Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().finish();
}
});
mRefreshLayout = (RefreshLayout) root.findViewById(refreshLayout);
mRefreshLayout.setRefreshHeader(new ClassicsHeader(getContext()).setSpinnerStyle(SpinnerStyle.FixedBehind).setPrimaryColorId(R.color.colorPrimary).setAccentColorId(android.R.color.white));
mRefreshLayout.setOnRefreshListener(this);
mRecyclerView = (RecyclerView) root.findViewById(recyclerView);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(), VERTICAL));
mEmptyLayout = root.findViewById(R.id.empty);
ImageView image = (ImageView) root.findViewById(R.id.empty_image);
image.setImageResource(R.drawable.ic_empty);
TextView empty = (TextView) root.findViewById(R.id.empty_text);
empty.setText("暂无数据下拉刷新");
/*主动演示刷新*/
if (mIsNeedDemo) {
mRefreshLayout.getLayout().postDelayed(new Runnable() {
@Override
public void run() {
if (mIsNeedDemo) {
mRefreshLayout.autoRefresh();
}
}
}, 3000);
mRefreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener() {
@Override
public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) {
mIsNeedDemo = false;
}
});
}
}
use of com.scwang.smartrefresh.layout.header.ClassicsHeader in project SmartRefreshLayout by scwang90.
the class ViewPagerExampleFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View root, @Nullable Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
final Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().finish();
}
});
mRefreshLayout = (RefreshLayout) root.findViewById(refreshLayout);
mRefreshLayout.setOnRefreshLoadMoreListener(this);
mRefreshLayout.setRefreshHeader(new ClassicsHeader(getContext()));
mRefreshLayout.setRefreshFooter(new ClassicsFooter(getContext()));
mViewPager = (ViewPager) root.findViewById(R.id.viewPager);
mTabLayout = (TabLayout) root.findViewById(R.id.tableLayout);
mViewPager.setAdapter(mAdapter = new SmartPagerAdapter(Item.values()));
mTabLayout.setupWithViewPager(mViewPager, true);
}
Aggregations