@Override public void onLoadMore() { // TODO Auto-generated method stub if (mRecords.size() >= total) { mRecordList.stopLoadMore(); mRecordList.setPullLoadEnable(false); CommonUtil.toastShort(getActivity(), "没有更多数据"); } else { getMoreData(); } }
/** * enable or disable the buttons * * @param * @return */ private void toggleButtons() { boolean shouldEnable = !TextUtils.isEmpty(tradeClientName) && !TextUtils.isEmpty(tradeStartDate) && !TextUtils.isEmpty(tradeEndDate); mTradeSearch.setEnabled(shouldEnable); mTradeStatistic.setEnabled(shouldEnable); if (mRecords.size() > 0) { mRecordList.setPullLoadEnable(shouldEnable); } }
private void initViews(View view) { mInflater = LayoutInflater.from(getActivity()); View header = mInflater.inflate(R.layout.fragment_trade_flow, null); mTradeClient = header.findViewById(R.id.trade_client); mTradeClientName = (TextView) header.findViewById(R.id.trade_client_name); mTradeStart = header.findViewById(R.id.trade_start); mTradeStartDate = (TextView) header.findViewById(R.id.trade_start_date); mTradeEnd = header.findViewById(R.id.trade_end); mTradeEndDate = (TextView) header.findViewById(R.id.trade_end_date); mTradeSearch = (Button) header.findViewById(R.id.trade_search); mTradeStatistic = (Button) header.findViewById(R.id.trade_statistic); mTradeSearchContent = (LinearLayout) header.findViewById(R.id.trade_search_content); mTradeClient.setOnClickListener(this); mTradeStart.setOnClickListener(this); mTradeEnd.setOnClickListener(this); mTradeSearch.setOnClickListener(this); mTradeStatistic.setOnClickListener(this); if (null == mRecords) { mRecords = new ArrayList<TradeRecord>(); } mRecordList = (XListView) view.findViewById(R.id.trade_record_list); mAdapter = new TradeRecordListAdapter(); mRecordList.addHeaderView(header); mRecordList.setAdapter(mAdapter); mRecordList.initHeaderAndFooter(); mRecordList.setXListViewListener(this); mRecordList.setPullRefreshEnable(false); mRecordList.setAdapter(mAdapter); mRecordList.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { TradeRecord record = (TradeRecord) view.getTag(R.id.trade_status); Intent intent = new Intent(getActivity(), TradeDetailActivity.class); intent.putExtra(TRADE_RECORD_ID, record.getId()); intent.putExtra(TRADE_TYPE, mTradeType); startActivity(intent); } }); }