private void initView() { title = new MyTitleBarHelper(this, getWindow().getDecorView().findViewById(android.R.id.content)); title.setMiddleText("常用电话"); title.setOnclickListener(this); keeperTitle = (TextView) findViewById(R.id.my_title_tel); wuyeKeeper = (TextView) findViewById(R.id.tv_wuye); keeperTel = (TextView) findViewById(R.id.tv_tel); cell = (RelativeLayout) findViewById(R.id.phone_line_one); cellTitle = (TextView) findViewById(R.id.my_title_tel); img_tel_one = (ImageView) findViewById(R.id.img_tel_one); ll_wuye_keeper = (LinearLayout) findViewById(R.id.ll_wuye_keeper); // commTel = (TextView) findViewById(R.id.tel1); iv_title_bar_left = (ImageView) findViewById(R.id.iv_title_bar_left); tv_tel_pager = (TextView) findViewById(R.id.tv_tel_pager); // 创建布局管理器 mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view); LinearLayoutManager mLayoutManager = new LinearLayoutManager(this); mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); mRecyclerView.setLayoutManager(mLayoutManager); adapter = new MyTelRecycleAdapter(); adapter.setOnItemClickListener(this); mRecyclerView.setAdapter(adapter); }
private void initEvents() { myTitleBarHelper.setOnclickListener(this); express_no_receive.setOnClickListener(this); btn_express_received.setOnClickListener(this); refreshLayout_no_receive.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (CommonUtils.isNetworkConnected(ExpressQueryRecordActivity.this)) { NoReceiveCanLoad = true; NoReceivePageNum = 1; isShowDialog = false; requestExpressNoReceive(); } else { if (refreshLayout_no_receive != null && refreshLayout_no_receive.isRefreshing()) { refreshLayout_no_receive.setRefreshing(false); } toast("网络不可用"); } } }); lv_no_receive.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case AbsListView.OnScrollListener.SCROLL_STATE_IDLE: if (NoReceiveCanLoad && lv_no_receive.getCount() >= 0 && lv_no_receive.getLastVisiblePosition() == (lv_no_receive.getCount() - 1)) { // 上拉刷新停止 if (noReceivedAdapter == null || refreshLayout_no_receive.isRefreshing()) return; if (CommonUtils.isNetworkConnected(ExpressQueryRecordActivity.this)) { isShowDialog = false; // 请求下一页数据 NoReceivePageNum++; mFootBarView.showFooter(); requestExpressNoReceive(); } else { mFootBarView.hideFooter(); toast("网络不可用"); } } break; } } @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {} }); refreshLayout_received.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { if (CommonUtils.isNetworkConnected(ExpressQueryRecordActivity.this)) { isShowDialog = false; ReceivedCanLoad = true; ReceivedPageNum = 1; requestExpressReceived(); } else { if (refreshLayout_received != null && refreshLayout_received.isRefreshing()) { refreshLayout_received.setRefreshing(false); } toast("网络不可用"); } } }); lv_received.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { switch (scrollState) { case AbsListView.OnScrollListener.SCROLL_STATE_IDLE: if (ReceivedCanLoad && lv_received.getCount() >= 0 && lv_received.getLastVisiblePosition() == (lv_received.getCount() - 1)) { // 上拉刷新停止 if (receivedAdapter == null || refreshLayout_received.isRefreshing()) return; if (CommonUtils.isNetworkConnected(ExpressQueryRecordActivity.this)) { isShowDialog = false; // 请求下一页数据 ReceivedPageNum++; mFootBarView.showFooter(); requestExpressReceived(); } else { mFootBarView.hideFooter(); toast("网络不可用"); } } break; } } @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {} }); }