/** {@inheritDoc} */
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    setDrawingCacheEnabled(true);
    setAlwaysDrawnWithCacheEnabled(true);

    mMinFieldHeight =
        mContext.getResources().getDimensionPixelSize(R.dimen.editor_min_line_item_height);
    mFields = (ViewGroup) findViewById(R.id.editors);
    mExpansionView = (ImageView) findViewById(R.id.expansion_view);
    mExpansionViewContainer = findViewById(R.id.expansion_view_container);
    mExpansionViewContainer.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // Save focus
            final View focusedChild = getFocusedChild();
            final int focusedViewId = focusedChild == null ? -1 : focusedChild.getId();

            // Reconfigure GUI
            mHideOptional = !mHideOptional;
            onOptionalFieldVisibilityChange();
            rebuildValues();

            // Restore focus
            View newFocusView = findViewById(focusedViewId);
            if (newFocusView == null || newFocusView.getVisibility() == GONE) {
              // find first visible child
              newFocusView = TextFieldsEditorView.this;
            }
            newFocusView.requestFocus();
          }
        });
  }
  /** {@inheritDoc} */
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    setDrawingCacheEnabled(true);
    setAlwaysDrawnWithCacheEnabled(true);

    mMinFieldHeight =
        mContext.getResources().getDimensionPixelSize(R.dimen.editor_min_line_item_height);
    mFields = (ViewGroup) findViewById(R.id.editors);
    mExpansionView = (ImageView) findViewById(R.id.expansion_view);
    mExpansionViewContainer = findViewById(R.id.expansion_view_container);
    mExpansionViewContainer.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // Save focus
            final View focusedChild = getFocusedChild();
            final int focusedViewId = focusedChild == null ? -1 : focusedChild.getId();
            // GPBYY-50 add(start)
            InputMethodManager imm =
                (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
            if (imm != null && v != null) {
              imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
            }
            // GPBYY-50 add(end)
            // Reconfigure GUI
            mHideOptional = !mHideOptional;
            onOptionalFieldVisibilityChange();
            rebuildValues();

            // Restore focus
            View newFocusView = findViewById(focusedViewId);
            if (newFocusView == null || newFocusView.getVisibility() == GONE) {
              // find first visible child
              newFocusView = TextFieldsEditorView.this;
            }
            newFocusView.requestFocus();
          }
        });
  }