Duveaux

Untitled

Oct 30th, 2012
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.97 KB | None | 0 0
  1.         @Override
  2.         public View onCreateView(LayoutInflater inflater, ViewGroup container,
  3.                 Bundle savedInstanceState) {
  4.             /*
  5.              * Main control for Fragments - gets repeated for each listtab
  6.              * Should be controlled using Config.java
  7.              */
  8.  
  9.             // Default to everything from tab 1 (we always have a tab 1)
  10.             Integer ref_layout = R.layout.tab1;
  11.            
  12.             // Change the variables according to the current fragment, so that the rest of the code knows what to do
  13.             // Variable content is taken from Config.java
  14.             if (mNum == 2){
  15.                 ref_layout = R.layout.tab2;
  16.             }if (mNum == 3){
  17.                 ref_layout = R.layout.tab3;
  18.             }if (mNum == 4){
  19.                 ref_layout = R.layout.tab4;
  20.             }if (mNum == 5){
  21.                 ref_layout = R.layout.tab5;
  22.             }if (mNum == 6){
  23.                 ref_layout = R.layout.tab6;
  24.             }
  25.            
  26.            
  27.             View v = inflater.inflate(ref_layout, container, false); // Inflate appropriate view
  28.        
  29.             String[] titles;
  30.             String[] images;
  31.             Core x = new Core();
  32.  
  33.             if (mCache=="No cache"){
  34.                 x.new refreshList(this,getActivity(),mNum).execute();
  35.             }else{
  36.                 titles = mCache.split("SEPAPPCONSTRUCTORSEP");
  37.                 images = mCache3.split("SEPAPPCONSTRUCTORSEP");
  38.                 String streamURL = c.t1arg1;
  39.                 Boolean tListImage = c.t1ListImage;
  40.                 if (mNum==2){streamURL = c.t2arg1;tListImage = c.t2ListImage;}else if (mNum==3){streamURL = c.t3arg1;tListImage = c.t3ListImage;}else if (mNum==4){streamURL = c.t4arg1;tListImage = c.t4ListImage;}else if (mNum==5){streamURL = c.t5arg1;tListImage = c.t5ListImage;}else if (mNum==6){streamURL = c.t6arg1;tListImage = c.t6ListImage;}
  41.                 if (streamURL.matches(".*api.twitter.*")){
  42.                     setListAdapter(new ArrayAdapter<String>(getActivity(),
  43.                             R.layout.list_item_twitter,R.id.list_content, titles));
  44.                     }else{
  45.                         if (tListImage){
  46.                             ImageLoader imageLoader = ImageLoader.getInstance();
  47.                             imageLoader.init(ImageLoaderConfiguration.createDefault(this.getSherlockActivity().getBaseContext()));
  48.  
  49.                             listAdapter a = x.new listAdapter();
  50.                             a.initialize(titles,images,this,getActivity());
  51.                             setListAdapter(a);
  52.                             }else{
  53.                                 setListAdapter(new ArrayAdapter<String>(getActivity(),
  54.                                         android.R.layout.simple_list_item_1, titles));
  55.                             }
  56.  
  57.  
  58.                        // setListAdapter(new ArrayAdapter<String>(getActivity(),
  59.                         //      R.layout.list_item,R.id.li_text, titles));
  60.                     }
  61.                 x.new refreshList(this,getActivity(),mNum).execute();
  62.             }
  63.            
  64.             return v;
  65.         }
  66.        
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment