public H5FontBar(H5Page page) {
    this.h5Page = page;
    Activity activity = (Activity) page.getContext().getContext();
    LayoutInflater layoutInflater = LayoutInflater.from(activity);

    contentView = layoutInflater.inflate(R.layout.h5_font_bar, null);
    rootView = activity.getWindow().getDecorView().findViewById(android.R.id.content);

    fontBlankView = contentView.findViewById(R.id.h5_font_blank);
    fontBlankView.setOnClickListener(this);

    fontToolBar = contentView.findViewById(R.id.h5_font_bar);
    fontToolBar.setOnClickListener(this);

    ivSize1 = (ImageView) contentView.findViewById(R.id.iv_font_size1);
    ivSize2 = (ImageView) contentView.findViewById(R.id.iv_font_size2);
    ivSize3 = (ImageView) contentView.findViewById(R.id.iv_font_size3);
    ivSize4 = (ImageView) contentView.findViewById(R.id.iv_font_size4);
    fontBarClose = contentView.findViewById(R.id.h5_font_close);

    fontSize1 = contentView.findViewById(R.id.h5_font_size1);
    fontSize2 = contentView.findViewById(R.id.h5_font_size2);
    fontSize3 = contentView.findViewById(R.id.h5_font_size3);
    fontSize4 = contentView.findViewById(R.id.h5_font_size4);

    fontSize1.setOnClickListener(this);
    fontSize2.setOnClickListener(this);
    fontSize3.setOnClickListener(this);
    fontSize4.setOnClickListener(this);

    fontBarClose.setOnClickListener(this);

    int fontSize = H5Container.WEBVIEW_FONT_SIZE_NORMAL;
    H5Scenario scenario = h5Page.getSession().getScenario();
    if (scenario != null) {
      String fontStr = scenario.getData().get(H5Container.FONT_SIZE);
      if (!TextUtils.isEmpty(fontStr)) {
        fontSize = Integer.parseInt(fontStr);
      }
      updateFontBar(fontSize);
    }
  }
  private void onFontSizeChanged(int size) {
    JSONObject param = new JSONObject();
    try {
      param.put("size", size);
    } catch (JSONException e) {
      H5Log.e(TAG, "exception", e);
    }

    h5Page.sendIntent(H5Plugin.H5_PAGE_FONT_SIZE, param);
    updateFontBar(size);
  }