package com.sometrik.framework;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.LinearLayout;

public class FWAdapter extends ArrayAdapter<View> {

  private List<View> viewList;
  private FrameWork frame;
  
  public FWAdapter(Context context, List<View> viewList) {
    super(context, 0, viewList);
    this.frame = (FrameWork)context;
    this.viewList = viewList;
  }
  
  public void addItem(View view){
    viewList.add(view);
  }

  @Override
  public int getCount() {
    return viewList.size();
  }

  @Override
  public long getItemId(int arg0) {
    return 0;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    DisplayMetrics displaymetrics = new DisplayMetrics();
//    int dp = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 130, displaymetrics);
    AbsListView.LayoutParams params = new AbsListView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 130);
    View view = viewList.get(position);
    view.setLayoutParams(params);
    return view;
  }
  
}

@@ -89,67 +89,60 @@
 ort 
-android.content.Context;%0Aimport android.util.DisplayMetrics
+com.sometrik.vapu.R;%0A%0Aimport android.content.Context
 ;%0Aim
@@ -183,23 +183,27 @@
 oid.
-util.TypedValue
+view.LayoutInflater
 ;%0Aim
@@ -261,43 +261,8 @@
 up;%0A
-import android.widget.AbsListView;%0A
 impo
@@ -319,87 +319,16 @@
 get.
-BaseAdapter;%0Aimport android.widget.GridView;%0Aimport android.widget.LinearLayout
+TextView
 ;%0A%0Ap
@@ -410,16 +410,59 @@
 ewList;%0A
+  private ArrayList%3CAdapterData%3E dataList;%0A
   privat
@@ -612,16 +612,18 @@
 ontext;%0A
+//
     this
@@ -644,16 +644,66 @@
 ewList;%0A
+    this.dataList = new ArrayList%3CAdapterData%3E();%0A
   %7D%0A  %0A 
@@ -758,24 +758,126 @@
 d(view);%0A  %7D
+%0A  public void addItem(ArrayList%3CString%3E cellItems)%7B%0A    dataList.add(new AdapterData(cellItems));%0A  %7D
 %0A%0A  @Overrid
@@ -915,20 +915,20 @@
  return 
-view
+data
 List.siz
@@ -1086,24 +1086,624 @@
 p parent) %7B%0A
+    %0A%09%0A%09%0A%09LayoutInflater inflater = frame.getLayoutInflater();%0A%09convertView=inflater.inflate(R.layout.multicolumn_data, null);%0A%09%0A%09%0A%09TextView txtFirst=(TextView) convertView.findViewById(R.id.name);%0A%09TextView txtSecond=(TextView) convertView.findViewById(R.id.gender);%0A%09TextView txtThird=(TextView) convertView.findViewById(R.id.age);%0A%09TextView txtFourth=(TextView) convertView.findViewById(R.id.status);%0A%09%0A%09AdapterData data = dataList.get(position);%0A%09txtFirst.setText(data.getData(0));%0A%09txtSecond.setText(data.getData(1));%0A%09txtThird.setText(data.getData(2));%0A%09txtFourth.setText(data.getData(3));%0A%09%0A//
     DisplayM
@@ -1746,24 +1746,26 @@
 etrics();%0A//
+/
+/
     int dp =
@@ -1844,24 +1844,26 @@
 aymetrics);%0A
+//
     AbsListV
@@ -1960,16 +1960,18 @@
 , 130);%0A
+//
     View
@@ -2002,16 +2002,18 @@
 ition);%0A
+//
     view
@@ -2049,17 +2049,24 @@
  return 
-v
+convertV
 iew;%0A  %7D
@@ -2069,10 +2069,349 @@
 %0A  %7D%0A  %0A
-%7D
+  public class AdapterData %7B%0A%0A    private ArrayList%3CString%3E dataList;%0A%0A    public AdapterData(ArrayList%3CString%3E dataList) %7B%0A      this.dataList = dataList;%0A    %7D%0A%0A    public String getData(int position) %7B%0A%0A      if (position %3C dataList.size()) %7B%0A%09return dataList.get(position);%0A      %7D else %7B%0A%09return dataList.get(0);%0A      %7D%0A    %7D%0A%0A  %7D%0A%7D%0A%0A
 %0A

Change Adapter to be used with Gridview test