title: RecyclerView: Using different LayoutManagers and item structure based on screen orientation
body: <p>I'm working with <code>recyclerview</code> that should use different element positioning(grid for landscape and list for portrait) with different <code>.xml</code> structure for items. </p>
  
  <p>For the first part I see solution in simple orientation checking in <code>onCreateView()</code> method:</p>
  
  <pre><code> switch (getResources().getConfiguration().orientation) {
              case 1:
                  recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
                  break;
              case 2:
                  recyclerView.setLayoutManager(new GridLayoutManager(getActivity(),2));
                  break;
          }
  </code></pre>
  
  <p>But for the second part I have doubts. The simplest way is to pass LayoutManager as a constructor parameter to Adapter and check layout in <code>onCreateViewHolder()</code> with <code>instanceof</code> operator. But it doesn't look as good
    or right solution. </p>
  
  <p>So, are there any common pattern or better way for such situations?</p>