Esempio n. 1
0
  private void fillData(String result) {
    DealData dealData = null;
    try {
      dealData = GsonUtil.json2bean(result, DealData.class);
      ArrayList<Deal> deals = dealData.getData().getDeals();

      if (isRefresh) {
        mAllDeals.clear();
        convenientBanner.setcurrentitem(0);
      }
      mAllDeals.addAll(deals);
      if (newsListAdapter == null) {
        newsListAdapter = new TabListAdapter(mContext, mAllDeals);
        home_Xlistview.setAdapter(newsListAdapter);
      } else {
        newsListAdapter.setData(mAllDeals);
        newsListAdapter.notifyDataSetChanged();
      }
      mHandler.sendEmptyMessage(MSG_STOP_REFRESH);
      home_Xlistview.setVisibility(View.VISIBLE);
      hideBaseLoading();

    } catch (Exception e) {
      hideBaseLoading();
      if (mAllDeals.size() == 0 && !isRefresh) {
        showLoadingError();
      } else {
        mHandler.sendEmptyMessage(MSG_STOP_REFRESH);
        ToastUtil.showToast(mContext, "亲,加载错误啦,请重试.");
      }
      e.printStackTrace();
    }
  }
Esempio n. 2
0
 @Override
 public void onDestroyView() {
   super.onDestroyView();
   Log.i("abc", "tab--onDestroyView>" + mType);
   mAllDeals.clear();
   if (convenientBanner != null) {
     boolean result = home_Xlistview.removeHeaderView(convenientBanner);
   }
   home_Xlistview.setVisibility(View.GONE);
   // 停止翻页
   convenientBanner.stopTurning();
 }