private List<Integer> getList() { List<Integer> list = new ArrayList<Integer>(); int size = adapter.getLists().size(); int lastPosition = size > 0 ? adapter.getLists().get(size - 1) : 0; for (int i = 1; i < 20; i++) { list.add(lastPosition + i); } return list; }
@Override public void handleMessage(Message msg) { switch (msg.what) { case 0: Toast.makeText(mContext, "DOWN", Toast.LENGTH_SHORT).show(); swipeRefreshLayout.setRefreshing(false); adapter.getLists().clear(); addList(); break; case 1: Toast.makeText(mContext, "UP", Toast.LENGTH_SHORT).show(); addList(); break; default: break; } }
private void addList() { List<Integer> list = getList(); adapter.getLists().addAll(list); adapter.notifyDataSetChanged(); }