code: public static SpanSizeLookup getSpanSizeLookup(RecyclerView view) {
          LayoutManager layout = view.getLayoutManager();
          if (layout instanceof GridLayoutManager) {
              return ((GridLayoutManager) layout).getSpanSizeLookup();
          }
          if (sDefSpanSizeLookup == null) {
              sDefSpanSizeLookup = new DefaultSpanSizeLookup();
          }
          return sDefSpanSizeLookup;
      }
docs: If the RecyclerView uses a {@link GridLayoutManager}, get its SpanSizeLookup. Otherwise get a
  {@link DefaultSpanSizeLookup DefaultSpanSizeLookup}.