/** 初始化窗口的基本信息,声明所需基本变量,避免重复创建 */
  private void initPopupWindow() {
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    popView = inflater.inflate(R.layout.main_popupwindow_layout, null);
    mWebView = (WebView) popView.findViewById(R.id.main_pop_webview);
    popTitle = (TextView) popView.findViewById(R.id.main_pop_title);
    popAuthor = (TextView) popView.findViewById(R.id.main_pop_author);
    popHotPoint = (Button) popView.findViewById(R.id.main_pop_hotpoint);
    popEdit = (Button) popView.findViewById(R.id.main_pop_toedit);
    popShare = (Button) popView.findViewById(R.id.main_pop_share);
    popContainer = (RelativeLayout) popView.findViewById(R.id.main_pop_container);

    animation = AnimationUtil.initAlphaShowAnimation();
    screenWByH = DPIUtil.getWidthByHight();

    baseWidth = imgWidth * 2 - DPIUtil.dip2px(getActivity(), 80);

    mWebView.setWebViewClient(
        new CustomWebViewClient() {
          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
          }

          @Override
          public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
          }
        });
    //        mWebView.setWebChromeClient(new WebChromeClient());
    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    // 扩大比例的缩放
    mWebView.getSettings().setUseWideViewPort(true);
    // 自适应屏幕
    mWebView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    mWebView.getSettings().setLoadWithOverviewMode(true);

    popupWindow =
        new PopupWindow(
            popView,
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
            false);
    popupWindow.setBackgroundDrawable(new BitmapDrawable());
    popupWindow.setOutsideTouchable(true);
    popupWindow.setFocusable(true);
    popupWindow.setAnimationStyle(R.style.popupwindowStyle);

    initPopListener();
  }
  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];
  }