package com.hackathon.hackathon2014.activity;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

import com.hackathon.hackathon2014.R;
import com.hackathon.hackathon2014.adapter.FriendAdapter;
import com.hackathon.hackathon2014.model.FriendModel;

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

public class SearchResultsFragment extends Fragment {
	View view;
    Activity activity;

    @Override
	public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle savedInstanceState) {
    	view = inflater.inflate(R.layout.search_results_fragment, container, false);
        activity = this.getActivity();
        //getList();
		return view ;
	}
    
    public void getList() {
    	ListView lv = ( ListView ) view.findViewById(R.id.search_result_list);
    	List<FriendModel> friendLists = new ArrayList<FriendModel>();
    	friendLists.add(new FriendModel("Jeed", "1"));
    	friendLists.add(new FriendModel("Ja", "2"));
    	friendLists.add(new FriendModel("Jaja", "3"));
        friendLists.add(new FriendModel("Jap", "4"));
    	
    	FriendAdapter adapter = new FriendAdapter(activity, friendLists);
//		ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
//                android.R.layout.simple_list_item_1, AndroidOS);

		lv.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				
				Toast.makeText(getActivity(), "myPos "+ position , Toast.LENGTH_SHORT).show();
			}
			
		});
		
		lv.setAdapter(adapter);
		
		
    }
    
    
}

@@ -98,16 +98,51 @@
 agment;%0A
+import android.app.ProgressDialog;%0A
 import a
@@ -553,16 +553,142 @@
 ndModel;
+%0Aimport com.hackathon.hackathon2014.webservice.PostRequestHandler;%0Aimport com.hackathon.hackathon2014.webservice.RestProvider;
 %0A%0Aimport
@@ -821,16 +821,205 @@
 ctivity;
+%0A    private final String url1 = %22http://api.radar.codedeck.com/users/%22;%0A    private final  String url2 = %22/friendsuggestions%22;%0A    List%3CFriendModel%3E friendLists;%0A    ProgressDialog dialog;
 %0A%0A    @O
@@ -1321,24 +1321,180 @@
 st() %7B%0A    %09
+friendLists = new ArrayList%3CFriendModel%3E();%0A        dialog = ProgressDialog.show( activity, %22%22,%0A                %22Loading. Please wait...%22, true);%0A        //
 ListView lv 
@@ -1560,28 +1560,29 @@
     
-%09List%3CFriendModel%3E f
+    RestProvider.getF
 rien
@@ -1582,37 +1582,52 @@
 etFriendList
-s =
+(%22%22,
  new 
-Array
+PostRequestHandler%3C
 List%3CFriendM
@@ -1635,231 +1635,353 @@
 del%3E
+%3E
 ()
-;
+ %7B
 %0A    
-%09friendLists.add(new FriendModel(%22Jeed%22, %221%22));%0A    %09friendLists.add(new FriendModel(%22Ja%22, %222%22));%0A    %09friendLists.add(new FriendModel(%22Jaja%22, %223%22));%0A        friendLists.add(new FriendModel(%22Jap%22, %224%22)
+        @Override%0A            public void handle(List%3CFriendModel%3E friendModels) %7B%0A                upDateFriendList(friendModels);%0A            %7D%0A        %7D);%0A    %7D%0A%0A    public void upDateFriendList( List%3CFriendModel%3E fl) %7B%0A        friendLists = fl;%0A        ListView lv = ( ListView ) view.findViewById(R.id.search_result_list
 );%0A    
-%09%0A
     
-%09
 Frie
@@ -2046,153 +2046,16 @@
 s);%0A
-//%09%09ArrayAdapter%3CString%3E adapter = new ArrayAdapter%3CString%3E(getActivity(),%0A//                android.R.layout.simple_list_item_1, AndroidOS);%0A%0A%09%09
+        
 lv.s
@@ -2108,24 +2108,42 @@
 ) %7B%0A
-%09%09%09@Override%0A%09%09%09
+            @Override%0A            
 publ
@@ -2200,13 +2200,44 @@
 ew,%0A
-%09%09%09%09%09
+                                    
 int 
@@ -2261,17 +2261,24 @@
 ) %7B%0A
-%09%09%09%09%0A%09%09%09%09
+                
 Toas
@@ -2356,28 +2356,44 @@
 ();%0A
-%09%09%09%7D%0A%09%09%09%0A%09%09%7D);%0A%09%09%0A%09%09
+            %7D%0A%0A        %7D);%0A%0A        
 lv.s
@@ -2416,28 +2416,39 @@
 r);%0A
-%09%09%0A%09%09%0A
     
-%7D%0A
     
+dialog.cancel();
 %0A    
+%7D%0A%0A
 %0A%7D%0A

fix SearchResultsFragment.java