Search in sources :

Example 11 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project instructure-android by instructure.

the class RecyclerViewUtils method buildRecyclerView.

public static RecyclerView buildRecyclerView(final Context context, final SyncRecyclerAdapter recyclerAdapter, final SyncPresenter presenter, final SwipeRefreshLayout swipeToRefreshLayout, final RecyclerView recyclerView, final EmptyInterface emptyViewInterface, final String emptyViewText) {
    emptyViewInterface.setTitleText(emptyViewText);
    emptyViewInterface.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);
    swipeToRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

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

Example 12 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout 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 13 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project instructure-android by instructure.

the class RecyclerViewUtils method buildRecyclerView.

public static PandaRecyclerView buildRecyclerView(View rootView, final Context context, final BaseRecyclerAdapter baseRecyclerAdapter, int swipeToRefreshLayoutResId, int recyclerViewResId, int emptyViewResId, String emptyViewText) {
    EmptyViewInterface emptyViewInterface = (EmptyViewInterface) rootView.findViewById(emptyViewResId);
    PandaRecyclerView pandaRecyclerView = (PandaRecyclerView) rootView.findViewById(recyclerViewResId);
    emptyViewInterface.emptyViewText(emptyViewText);
    emptyViewInterface.setNoConnectionText(context.getString(R.string.noConnection));
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    pandaRecyclerView = (PandaRecyclerView) rootView.findViewById(R.id.recyclerView);
    pandaRecyclerView.setLayoutManager(layoutManager);
    pandaRecyclerView.setEmptyView(emptyViewInterface);
    pandaRecyclerView.setItemAnimator(new DefaultItemAnimator());
    pandaRecyclerView.setAdapter(baseRecyclerAdapter);
    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 {
                baseRecyclerAdapter.refresh();
            }
        }
    });
    return pandaRecyclerView;
}
Also used : PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) EmptyViewInterface(com.instructure.pandarecycler.interfaces.EmptyViewInterface) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Example 14 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout 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 15 with SwipeRefreshLayout

use of android.support.v4.widget.SwipeRefreshLayout in project instructure-android by instructure.

the class ParentFragment method configureRecyclerView.

public PandaRecyclerView configureRecyclerView(View rootView, Context context, final BaseRecyclerAdapter baseRecyclerAdapter, int swipeRefreshLayoutResId, int emptyViewResId, int recyclerViewResId, String emptyViewString, boolean withDivider) {
    EmptyViewInterface emptyViewInterface = (EmptyViewInterface) rootView.findViewById(emptyViewResId);
    PandaRecyclerView recyclerView = (PandaRecyclerView) rootView.findViewById(recyclerViewResId);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setEmptyView(emptyViewInterface);
    emptyViewInterface.emptyViewText(emptyViewString);
    emptyViewInterface.setNoConnectionText(getString(R.string.noConnection));
    recyclerView.setSelectionEnabled(true);
    recyclerView.setAdapter(baseRecyclerAdapter);
    if (withDivider) {
        recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL_LIST));
    }
    mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(swipeRefreshLayoutResId);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!com.instructure.pandautils.utils.Utils.isNetworkAvailable(getContext())) {
                mSwipeRefreshLayout.setRefreshing(false);
            } else {
                baseRecyclerAdapter.refresh();
            }
        }
    });
    return recyclerView;
}
Also used : PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) EmptyViewInterface(com.instructure.pandarecycler.interfaces.EmptyViewInterface) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(com.instructure.speedgrader.decorations.DividerItemDecoration) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)102 View (android.view.View)55 RecyclerView (android.support.v7.widget.RecyclerView)43 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)41 TextView (android.widget.TextView)29 Bundle (android.os.Bundle)21 Intent (android.content.Intent)17 Handler (android.os.Handler)17 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)16 AdapterView (android.widget.AdapterView)15 ListView (android.widget.ListView)15 ArrayList (java.util.ArrayList)13 ImageView (android.widget.ImageView)10 ViewGroup (android.view.ViewGroup)9 Context (android.content.Context)8 LayoutInflater (android.view.LayoutInflater)8 GridLayoutManager (android.support.v7.widget.GridLayoutManager)7 PandaRecyclerView (com.instructure.pandarecycler.PandaRecyclerView)7 SearchView (android.support.v7.widget.SearchView)6 Toolbar (android.support.v7.widget.Toolbar)6