code: private void prepareWidget(View widget, @Nullable List<String> refinementAttributes) {
          if (!widgets.contains(widget)) { // process once each widget
              widgets.add(widget);
              if (widget instanceof Hits) {
                  // Link hits to activity's empty view
                  ((Hits) widget).setEmptyView(getEmptyView(widget.getRootView()));
  
                  int itemLayoutId = ((Hits) widget).getLayoutId();
  
                  if (itemLayoutId == 0) {
                      throw new IllegalStateException(Errors.LAYOUT_MISSING_HITS_ITEMLAYOUT);
                  }
              } else if (widget instanceof RefinementList) {
                  searcher.addFacetRefinement(((RefinementList) widget).getAttribute(), null,
                          ((RefinementList) widget).getOperation() == RefinementList.OPERATION_OR);
                  if (refinementAttributes != null) {
                      refinementAttributes.add(((RefinementList) widget).getAttribute());
                  }
              } else if (widget instanceof ListView) {
                  ((ListView) widget).setEmptyView(getEmptyView(widget.getRootView()));
              }
          }
      }
docs: Prepares the widget: adding it to widgets, applying its specific settings
  and storing its eventual refinement attribute.
  
  @param widget               the widget to prepare.
  @param refinementAttributes a List to store the widget's eventual refinement attributes.