Search in sources :

Example 1 with SimpleViewHolder

use of nucleus.example.util.adapters.SimpleViewHolder in project nucleus by konmik.

the class MainFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    check1.setText(MainPresenter.NAME_1);
    check2.setText(MainPresenter.NAME_2);
    pager = new RxPager(10, page -> {
        adapter.showProgress();
        getPresenter().requestNext(page);
    });
    adapter = new SimpleListAdapter<>(R.layout.recycler_view_progress, new ClassViewHolderType<>(ServerAPI.Item.class, R.layout.item, v -> new SimpleViewHolder<>(v, this::onItemClick)));
    recyclerView.setAdapter(adapter);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addOnScrollListener(new OnScrollPaging(layoutManager, adapter, pager::next));
}
Also used : ServerAPI(nucleus.example.network.ServerAPI) PageBundle(nucleus.example.util.PageBundle) BaseFragment(nucleus.example.ui.base.BaseFragment) Bundle(android.os.Bundle) SimpleListAdapter(nucleus.example.util.adapters.SimpleListAdapter) RequiresPresenter(nucleus.factory.RequiresPresenter) LayoutInflater(android.view.LayoutInflater) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) OnScrollPaging(nucleus.example.util.OnScrollPaging) SimpleViewHolder(nucleus.example.util.adapters.SimpleViewHolder) ClassViewHolderType(nucleus.example.util.adapters.ClassViewHolderType) ViewGroup(android.view.ViewGroup) OnClick(butterknife.OnClick) RxPager(nucleus.example.util.RxPager) RecyclerView(android.support.v7.widget.RecyclerView) Arrays.asList(java.util.Arrays.asList) CheckedTextView(android.widget.CheckedTextView) Toast(android.widget.Toast) View(android.view.View) R(nucleus.example.R) Bind(butterknife.Bind) Nullable(android.support.annotation.Nullable) ItemFragment(nucleus.example.ui.item.ItemFragment) RxPager(nucleus.example.util.RxPager) ClassViewHolderType(nucleus.example.util.adapters.ClassViewHolderType) ServerAPI(nucleus.example.network.ServerAPI) OnScrollPaging(nucleus.example.util.OnScrollPaging) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

Bundle (android.os.Bundle)1 Nullable (android.support.annotation.Nullable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 CheckedTextView (android.widget.CheckedTextView)1 Toast (android.widget.Toast)1 Bind (butterknife.Bind)1 OnClick (butterknife.OnClick)1 Arrays.asList (java.util.Arrays.asList)1 R (nucleus.example.R)1 ServerAPI (nucleus.example.network.ServerAPI)1 BaseFragment (nucleus.example.ui.base.BaseFragment)1 ItemFragment (nucleus.example.ui.item.ItemFragment)1 OnScrollPaging (nucleus.example.util.OnScrollPaging)1 PageBundle (nucleus.example.util.PageBundle)1 RxPager (nucleus.example.util.RxPager)1 ClassViewHolderType (nucleus.example.util.adapters.ClassViewHolderType)1