protected void executeOnLoadDataSuccess(List<?> data) {
   if (mState == STATE_REFRESH) {
     mAdapter.clear();
   }
   mAdapter.addData(data);
   mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
   if (data.size() == 0 && mState == STATE_REFRESH) {
     mErrorLayout.setErrorType(EmptyLayout.NODATA);
   } else if (data.size() < TDevice.getPageSize()) {
     if (mState == STATE_REFRESH) {
       mAdapter.setState(RecycleBaseAdapter.STATE_LESS_ONE_PAGE);
     } else mAdapter.setState(RecycleBaseAdapter.STATE_NO_MORE);
   } else {
     mAdapter.setState(RecycleBaseAdapter.STATE_LOAD_MORE);
   }
 }
 /**
  * 获取数据失败时候调用的代码
  *
  * @param error
  */
 protected void executeOnLoadDataError(String error) {
   if (mCurrentPage == 0) {
     if (mAdapter.getDataSize() == 0) {
       mErrorLayout.setErrorType(EmptyLayout.NETWORK_ERROR);
     } else {
       mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
       String message = error;
       if (TextUtils.isEmpty(error)) {
         if (TDevice.hasInternet()) {
           message = getString(R.string.tip_load_date_error);
         } else {
           message = getString(R.string.tip_network_error);
         }
       }
       AppContext.showToashShort(message);
     }
   } else {
     mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
     mAdapter.setState(RecycleBaseAdapter.STATE_NETWORK_ERROR);
   }
   mAdapter.notifyDataSetChanged();
 }
  protected void initViews(View view) {
    mErrorLayout = (EmptyLayout) view.findViewById(R.id.error_layout);
    mErrorLayout.setOnLayoutClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            mCurrentPage = 0;
            mState = STATE_REFRESH;
            mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
            requestData(true);
          }
        });
    mSwipeRefresh = (SwipeRefreshLayout) view.findViewById(R.id.srl_refresh);
    mSwipeRefresh.setColorSchemeResources(
        R.color.main_green, R.color.main_gray, R.color.main_black, R.color.main_purple);
    mSwipeRefresh.setOnRefreshListener(
        new OnRefreshListener() {
          @Override
          public void onRefresh() {
            refresh();
          }
        });
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recycleView);
    mRecyclerView.setOnScrollListener(mScrollListener);
    if (isNeedListDivider()) {
      mRecyclerView.addItemDecoration(
          new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
    }
    mLayoutManager = new LinearLayoutManager(getActivity());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setHasFixedSize(false);

    if (mAdapter != null) {
      mRecyclerView.setAdapter(mAdapter);
      mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
    } else {
      mAdapter = getListAdapter();
      mAdapter.setOnItemClickListener(this);
      mAdapter.setOnItemLongClickListener(this);
      mRecyclerView.setAdapter(mAdapter);
      if (requestDataIfViewCreated()) {
        mCurrentPage = 0;
        mState = STATE_REFRESH;
        mErrorLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
        new ReadCacheTask(this).execute();
      } else {
        mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
      }
    }
    if (mStoreEmptyState != -1) {
      mErrorLayout.setErrorType(mStoreEmptyState);
    }
    if (!TextUtils.isEmpty(mStoreEmptyMessage)) {
      mErrorLayout.setErrorMessage(mStoreEmptyMessage);
    }
  }
 @Override
 public void onDestroyView() {
   mStoreEmptyState = mErrorLayout.getErrorState();
   mStoreEmptyMessage = mErrorLayout.getErrorMessage();
   super.onDestroyView();
 }