package com.sometrik.framework;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;

public class AutoColumnLayout extends LinearLayout {
  
  //For small view AutoLayout puts views vertically
  //For big view Autolayout groups 2 views next to each other
  
  private ArrayList<View> viewList;
  private Context context;
  private FrameWork frame;
  
  public AutoColumnLayout(Context context){
    super(context);
    this.context = context;
    frame = (FrameWork)context;
    viewList = new ArrayList<View>();
    setOrientation(LinearLayout.VERTICAL);
  }
  
  public void addChild(View view){
    viewList.add(view);
  }
  
  public void showView(){
    buildAutoLayout(checkForBigView());
    frame.setContentView(this);
  }
  
  private void buildAutoLayout(Boolean bigView) {
    
    if (bigView) {
      for (int i = 0; i < viewList.size(); i++) {
	LinearLayout layout = new LinearLayout(context);
	layout.setOrientation(LinearLayout.HORIZONTAL);
	layout.addView(viewList.get(i));

	if (viewList.size() - 1 > i) {
	  layout.addView(viewList.get(i + 1));
	  i++;
	}
	addView(layout);
      }

    } else {
      for (View view : viewList) {
	addView(view);
      }
    }
  }

  private boolean checkForBigView(){
    //TODO
    return false;
  }
  

}

@@ -87,16 +87,58 @@
 ontext;%0A
+import android.content.res.Configuration;%0A
 import a
@@ -1339,17 +1339,207 @@
   //TODO
-%0A
+ Truly detect screen size%0A   int orientation =  frame.getResources().getConfiguration().orientation;%0A   if (orientation == Configuration.ORIENTATION_PORTRAIT)%7B%0A     return true;%0A   %7D else %7B%0A 
     retu
@@ -1548,16 +1548,21 @@
  false;%0A
+   %7D%0A
   %7D%0A  %0A%0A

Check for screen orientation in autoLayout