private void initViews() { myTitleBarHelper = new MyTitleBarHelper(this, getWindow().getDecorView().findViewById(android.R.id.content)); myTitleBarHelper.setLeftImgVisible(false); myTitleBarHelper.resetState(); myTitleBarHelper.setMiddleText("查询历史"); myTitleBarHelper.setRightImgVisible(false); myTitleBarHelper.setLeftImag(R.mipmap.btn_back); refreshLayout_no_receive = (SwipeRefreshLayout) findViewById(R.id.swipe_no_receive_layout); refreshLayout_no_receive.setColorSchemeResources(R.color.repair_line_color); refreshLayout_received = (SwipeRefreshLayout) findViewById(R.id.swipe_received_layout); refreshLayout_received.setColorSchemeResources(R.color.repair_line_color); express_no_receive = (Button) findViewById(R.id.express_no_receive); btn_express_received = (Button) findViewById(R.id.btn_express_received); empty_list_view = (TextView) findViewById(R.id.empty_list_view); lv_no_receive = (ListView) findViewById(R.id.lv_no_receive); lv_no_receive.setEmptyView(empty_list_view); lv_received = (ListView) findViewById(R.id.lv_received); lv_received.setEmptyView(empty_list_view); footBar = LayoutInflater.from(this).inflate(R.layout.item_progressbar, null); lv_no_receive.addFooterView(footBar); lv_received.addFooterView(footBar); mFootBarView = new FootBarHelper(footBar, this); mFootBarView.hideFooter(); }
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) {} }); }