private void refreshList() { if (Utils.isOnline(getActivity())) { getActivity().getContentResolver().delete(Contract.Nodes.CONTENT_URI, null, null); currentBatch = 1; updateManager.startUpdating(UpdateManager.UpdateType.NODES, LOAD_LIMIT, 0); setRefreshIndicationState(true); // TODO: Load only unacknowledged alarms here. updateManager.startUpdating(UpdateManager.UpdateType.ALARMS, 0, 0); } else { Toast.makeText(getActivity(), getString(R.string.refresh_failed_offline), Toast.LENGTH_LONG) .show(); } }
private void refreshList() { if (Utils.isOnline(getActivity())) { getActivity().getContentResolver().delete(Contract.Alarms.CONTENT_URI, null, null); updateManager.startUpdating(UpdateManager.UpdateType.ALARMS, LOAD_LIMIT, 0); setRefreshIndicationState(true); } else { Toast.makeText(getActivity(), getString(R.string.refresh_failed_offline), Toast.LENGTH_LONG) .show(); } }
@Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (updateManager.isUpdating(UpdateManager.UpdateType.NODES)) { return; } if (scrollState == SCROLL_STATE_IDLE) { if (getListView().getLastVisiblePosition() >= getListView().getCount() - SCROLL_THRESHOLD) { // TODO: Add search support updateManager.startUpdating( UpdateManager.UpdateType.NODES, LOAD_LIMIT, LOAD_LIMIT * currentBatch); currentBatch++; setRefreshIndicationState(true); } } }