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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations