private void initData() {
    userId =
        SharedPreferenceUtil.getAccountSharedPreference(getActivity())
            .getString(SharedPreferenceUtil.USERID, "");
    templateTag = "";
    LID = 1;
    gson = new Gson();
    client = new AsyncHttpClient();
    url = HttpConfig.getGetWorks(userId);
    DPIUtil.getScreenMetrics(getActivity());
    float windowWidth = DPIUtil.screen_width;
    float paddingWidth = DPIUtil.dip2px(getActivity(), 5);
    imgWidth = windowWidth / 2 - paddingWidth;

    mList = new ArrayList<>();
    mViewList = new ArrayList<>();
    backUpFile = new File(FileUtil.TEXT_BACKUP);
    if (backUpFile.exists()) {
      String json = TempEditUtil.getJsonFromFile(FileUtil.TEXT_BACKUP);
      if (json != null) {
        try {
          Type type = new TypeToken<HomeDataEntry>() {}.getType();
          homeData = gson.fromJson(json, type);
          hotWork = homeData.getData().getHotWorkTagList();
          mList.addAll(homeData.getData().getWorks().getWorks());
          getViewpager();
        } catch (Exception e) {

        }
      }
    }

    refreshLayout.setColorSchemeColors(getResources().getColor(R.color.theme_accent));
    refreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            firstVisibleItem = 0;
            visibleItemCount = 0;
            totalItemCount = 0;
            previousTotal = 0;
            LID = 1;
            mList.clear();
            getListData();
          }
        });
    firstVisiableItemPositions = new int[2];
  }
  private void getListData() {
    RequestParams params = RequestParam.getRequestParams(getActivity());
    String workId = "";
    String lastId = "";
    String lastData = "";
    if (mList.size() != 0 && tempEntry != null) {
      workId = tempEntry.getData().getLastRank();
      lastId = tempEntry.getData().getLastWorkId();
      lastData = tempEntry.getData().getLastDate();
    } else {
      if (mList.size() != 0 && homeData != null) {
        workId = homeData.getData().getWorks().getLastRank();
        lastId = homeData.getData().getWorks().getLastWorkId();
        lastData = homeData.getData().getWorks().getLastDate();
      }
    }

    Log.e("work", workId);
    Queue queue = new Queue();
    queue.setWorksId("");
    queue.setLastRank(workId);
    queue.setLastWorkId(lastId);
    queue.setLastDate(lastData);
    queue.setText("");
    queue.setUserId("");
    queue.setUserId("-1");
    queue.setTemplateId("");
    queue.setTemplateTag("");
    queue.setHotPoint(-1);
    queue.setHotTagId(LID);
    queue.setDateNow("");
    queue.setTemplateFlag(-1);
    queue.setStatus("");
    String query = gson.toJson(queue);
    params.put("query", query);
    params.put("pageCount", 10);
    Log.e("param", params.toString());
    client.post(
        url,
        params,
        new AsyncHttpResponseCallBack(getActivity()) {
          @Override
          public void onSuccess(int i, Header[] headers, byte[] bytes) {
            super.onSuccess(i, headers, bytes);
            Log.e("json", new String(bytes));
            Type type = new TypeToken<TempEntry>() {}.getType();
            tempEntry = new TempEntry();
            try {
              tempEntry = gson.fromJson(new String(bytes), type);
              mList.addAll(tempEntry.getData().getWorks());
              //                adapter.setmList(mList);
              if (mList.size() > tempEntry.getData().getWorks().size()) {
                adapter.notifyItemRangeInserted(
                    mList.size() - tempEntry.getData().getWorks().size() + 1,
                    tempEntry.getData().getWorks().size());
              } else {
                adapter.notifyDataSetChanged();
              }

              //
            } catch (Exception ex) {
            }

            if (circleBar.isShowing()) {
              circleBar.dismiss();
            }
            refreshLayout.setRefreshing(false);
            progressBar_bottom.setVisibility(View.GONE);
          }

          @Override
          public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) {
            if (circleBar.isShowing()) {
              circleBar.dismiss();
            }
            refreshLayout.setRefreshing(false);
            progressBar_bottom.setVisibility(View.GONE);
          }
        });
  }