Search in sources :

Example 1 with FalsifyFooter

use of com.scwang.smartrefresh.layout.footer.FalsifyFooter in project SmartRefreshLayout by scwang90.

the class PureScrollExampleFragmentFooter method onViewCreated.

@Override
public void onViewCreated(@NonNull View root, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(root, savedInstanceState);
    Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().finish();
        }
    });
    toolbar.setTitle("Footer单独使用");
    RefreshLayout refreshLayout = (RefreshLayout) root.findViewById(R.id.refreshLayout);
    refreshLayout.setEnablePureScrollMode(false);
    refreshLayout.setRefreshFooter(new FalsifyFooter(getContext()));
    View view = root.findViewById(R.id.recyclerView);
    if (view instanceof RecyclerView) {
        RecyclerView recyclerView = (RecyclerView) view;
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), VERTICAL));
        recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(Arrays.asList(Item.values()), simple_list_item_2, this) {

            @Override
            protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) {
                holder.text(android.R.id.text1, model.name());
                holder.text(android.R.id.text2, model.name);
                holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
            }
        });
    }
}
Also used : SmartViewHolder(com.scwang.refreshlayout.adapter.SmartViewHolder) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) FalsifyFooter(com.scwang.smartrefresh.layout.footer.FalsifyFooter) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) Item(com.scwang.refreshlayout.fragment.example.PureScrollExampleFragment.Item) RefreshLayout(com.scwang.smartrefresh.layout.api.RefreshLayout) RecyclerView(android.support.v7.widget.RecyclerView) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 SmartViewHolder (com.scwang.refreshlayout.adapter.SmartViewHolder)1 Item (com.scwang.refreshlayout.fragment.example.PureScrollExampleFragment.Item)1 RefreshLayout (com.scwang.smartrefresh.layout.api.RefreshLayout)1 FalsifyFooter (com.scwang.smartrefresh.layout.footer.FalsifyFooter)1