private void initRefreshLayout() { mRefreshLayout.setWaveColor(0x000); mRefreshLayout.setIsOverLay(true); mRefreshLayout.setWaveShow(true); mRefreshLayout.setLoadMore(true); mRefreshLayout.setMaterialRefreshListener( new MaterialRefreshListener() { @Override public void onRefresh(MaterialRefreshLayout materialRefreshLayout) { new Handler() .postDelayed( new Runnable() { @Override public void run() { mRefreshLayout.finishRefresh(); } }, 2000); } @Override public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) { new Handler() .postDelayed( new Runnable() { @Override public void run() { mRefreshLayout.finishRefreshLoadMore(); } }, 2000); } }); }
/** 初始化 */ private void initView() { findViewById(R.id.tv_cancel).setOnClickListener(this); listView = $(R.id.lv_list); refreshLayout = $(R.id.refresh_layout); View emptyView = $(R.id.list_empty_view); emptyView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { getNetDatas(); } }); listView.setEmptyView(emptyView); scheduleUserGroupAdapter = new ScheduleUserGroupAdapter(this); listView.setAdapter(scheduleUserGroupAdapter); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Creator p = scheduleUserGroupAdapter.getItem(position); Intent intent = new Intent(ScheduleOtherUserListActivity.this, ScheduleOtherListActivity.class); intent.putExtra("otherUserId", p.getId()); startActivity(intent); } }); refreshLayout.setLoadMore(true); refreshLayout.setMaterialRefreshListener( new MaterialRefreshListener() { @Override public void onRefresh(MaterialRefreshLayout materialRefreshLayout) { getNetDatas(); } @Override public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) { getNetDatasMore(); } }); getNetDatas(); }