Search in sources :

Example 1 with EmptyInterface

use of com.instructure.pandarecycler.interfaces.EmptyInterface in project instructure-android by instructure.

the class RecyclerViewUtils method buildRecyclerView.

// Sync
public static RecyclerView buildRecyclerView(View rootView, final Context context, final SyncRecyclerAdapter recyclerAdapter, final SyncPresenter presenter, int swipeToRefreshLayoutResId, int recyclerViewResId, int emptyViewResId, String emptyViewText) {
    EmptyInterface emptyInterface = (EmptyInterface) rootView.findViewById(emptyViewResId);
    RecyclerView recyclerView = (RecyclerView) rootView.findViewById(recyclerViewResId);
    emptyInterface.setTitleText(emptyViewText);
    emptyInterface.setNoConnectionText(context.getString(R.string.noConnection));
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(recyclerAdapter);
    final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(swipeToRefreshLayoutResId);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!com.instructure.pandautils.utils.Utils.isNetworkAvailable(context)) {
                swipeRefreshLayout.setRefreshing(false);
            } else {
                presenter.refresh(true);
            }
        }
    });
    return recyclerView;
}
Also used : EmptyInterface(com.instructure.pandarecycler.interfaces.EmptyInterface) RecyclerView(android.support.v7.widget.RecyclerView) PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 2 with EmptyInterface

use of com.instructure.pandarecycler.interfaces.EmptyInterface in project instructure-android by instructure.

the class RecyclerViewUtils method buildRecyclerView.

public static RecyclerView buildRecyclerView(View rootView, final Context context, final SyncExpandableRecyclerAdapter recyclerAdapter, final SyncExpandablePresenter presenter, int swipeToRefreshLayoutResId, int recyclerViewResId, int emptyViewResId, String emptyViewText) {
    EmptyInterface emptyInterface = (EmptyInterface) rootView.findViewById(emptyViewResId);
    RecyclerView recyclerView = (RecyclerView) rootView.findViewById(recyclerViewResId);
    emptyInterface.setTitleText(emptyViewText);
    emptyInterface.setNoConnectionText(context.getString(R.string.noConnection));
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(recyclerAdapter);
    final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(swipeToRefreshLayoutResId);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!com.instructure.pandautils.utils.Utils.isNetworkAvailable(context)) {
                swipeRefreshLayout.setRefreshing(false);
            } else {
                presenter.refresh(true);
            }
        }
    });
    return recyclerView;
}
Also used : EmptyInterface(com.instructure.pandarecycler.interfaces.EmptyInterface) RecyclerView(android.support.v7.widget.RecyclerView) PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 3 with EmptyInterface

use of com.instructure.pandarecycler.interfaces.EmptyInterface in project instructure-android by instructure.

the class RecyclerViewUtils method buildRecyclerView.

public static RecyclerView buildRecyclerView(View rootView, final Context context, final SyncRecyclerAdapter recyclerAdapter, final SyncPresenter presenter, int swipeToRefreshLayoutResId, int recyclerViewResId, int emptyViewResId, String emptyViewText) {
    EmptyInterface emptyInterface = (EmptyInterface) rootView.findViewById(emptyViewResId);
    RecyclerView recyclerView = (RecyclerView) rootView.findViewById(recyclerViewResId);
    emptyInterface.setTitleText(emptyViewText);
    emptyInterface.setNoConnectionText(context.getString(R.string.noConnection));
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(recyclerAdapter);
    final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(swipeToRefreshLayoutResId);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!com.instructure.pandautils.utils.Utils.isNetworkAvailable(context)) {
                swipeRefreshLayout.setRefreshing(false);
            } else {
                presenter.refresh(true);
            }
        }
    });
    return recyclerView;
}
Also used : EmptyInterface(com.instructure.pandarecycler.interfaces.EmptyInterface) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 4 with EmptyInterface

use of com.instructure.pandarecycler.interfaces.EmptyInterface in project instructure-android by instructure.

the class RecyclerViewUtils method buildRecyclerView.

public static RecyclerView buildRecyclerView(View rootView, final Context context, final SyncExpandableRecyclerAdapter recyclerAdapter, final SyncExpandablePresenter presenter, int swipeToRefreshLayoutResId, int recyclerViewResId, int emptyViewResId, String emptyViewText) {
    EmptyInterface emptyInterface = (EmptyInterface) rootView.findViewById(emptyViewResId);
    RecyclerView recyclerView = (RecyclerView) rootView.findViewById(recyclerViewResId);
    emptyInterface.setTitleText(emptyViewText);
    emptyInterface.setNoConnectionText(context.getString(R.string.noConnection));
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(recyclerAdapter);
    final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(swipeToRefreshLayoutResId);
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!com.instructure.pandautils.utils.Utils.isNetworkAvailable(context)) {
                swipeRefreshLayout.setRefreshing(false);
            } else {
                presenter.refresh(true);
            }
        }
    });
    return recyclerView;
}
Also used : EmptyInterface(com.instructure.pandarecycler.interfaces.EmptyInterface) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)4 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)4 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)4 RecyclerView (android.support.v7.widget.RecyclerView)4 EmptyInterface (com.instructure.pandarecycler.interfaces.EmptyInterface)4 PandaRecyclerView (com.instructure.pandarecycler.PandaRecyclerView)2