Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- /*
- * Main control for Fragments - gets repeated for each listtab
- * Should be controlled using Config.java
- */
- // Default to everything from tab 1 (we always have a tab 1)
- Integer ref_layout = R.layout.tab1;
- // Change the variables according to the current fragment, so that the rest of the code knows what to do
- // Variable content is taken from Config.java
- if (mNum == 2){
- ref_layout = R.layout.tab2;
- }if (mNum == 3){
- ref_layout = R.layout.tab3;
- }if (mNum == 4){
- ref_layout = R.layout.tab4;
- }if (mNum == 5){
- ref_layout = R.layout.tab5;
- }if (mNum == 6){
- ref_layout = R.layout.tab6;
- }
- View v = inflater.inflate(ref_layout, container, false); // Inflate appropriate view
- String[] titles;
- String[] images;
- Core x = new Core();
- if (mCache=="No cache"){
- x.new refreshList(this,getActivity(),mNum).execute();
- }else{
- titles = mCache.split("SEPAPPCONSTRUCTORSEP");
- images = mCache3.split("SEPAPPCONSTRUCTORSEP");
- String streamURL = c.t1arg1;
- Boolean tListImage = c.t1ListImage;
- 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;}
- if (streamURL.matches(".*api.twitter.*")){
- setListAdapter(new ArrayAdapter<String>(getActivity(),
- R.layout.list_item_twitter,R.id.list_content, titles));
- }else{
- if (tListImage){
- ImageLoader imageLoader = ImageLoader.getInstance();
- imageLoader.init(ImageLoaderConfiguration.createDefault(this.getSherlockActivity().getBaseContext()));
- listAdapter a = x.new listAdapter();
- a.initialize(titles,images,this,getActivity());
- setListAdapter(a);
- }else{
- setListAdapter(new ArrayAdapter<String>(getActivity(),
- android.R.layout.simple_list_item_1, titles));
- }
- // setListAdapter(new ArrayAdapter<String>(getActivity(),
- // R.layout.list_item,R.id.li_text, titles));
- }
- x.new refreshList(this,getActivity(),mNum).execute();
- }
- return v;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment