Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. public class WineryFragment extends Fragment {
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  4. super.onCreateView(inflater, container, savedInstanceState);
  5.  
  6. View root = inflater.inflate(R.layout.activity_winery, container, false);
  7.  
  8. //Creating wines.
  9. Wine bembibre =new Wine(
  10. "Bembibre",
  11. "Tinto",
  12. R.drawable.bembibre,
  13. "Dominio de Tares",
  14. "http://www.dominiodetares.com/portfolio/bembibre/",
  15. "Este vino muestra toda la complejidad y la elegancia de la variedad Mencía. En fase visual luce un color rojo picota muy cobierto con tonalidades violáceas en el menisco. En nariz aparecen recuerdos frutales muy intensos de frutas rojas (frambuesa, cereza) y una potente ciruela negra asi como tonos florales de la gama de las rosas y violetas, vegetales muy elegantes y complementarios, hojarasca verde, tabaco y maderas aromáticas (sándalo) que le brindan un troque ciertamente perfumado",
  16. "El Bierzo",
  17. 5);
  18. bembibre.addGrape("Mencía");
  19.  
  20. Wine vegaval =new Wine(
  21. "Vegaval",
  22. "Tinto",
  23. R.drawable.vegaval,
  24. "Miguel de Calatayud",
  25. "http://www.vegaval.com/es",
  26. "Este vino es para gente guay como Jhon ó Gabriela, el gordo no, el no es guay",
  27. "Valdepeñas",
  28. 4);
  29. vegaval.addGrape("Tempranillo");
  30.  
  31. //View for fragment add tabs.
  32. FragmentTabHost tabHost = (FragmentTabHost) root.findViewById(android.R.id.tabhost);
  33. tabHost.setup(getActivity(), getActivity().getSupportFragmentManager(), android.R.id.tabcontent);
  34.  
  35.  
  36. //Adding the first tab.
  37. Bundle arguments = new Bundle();
  38. arguments.putSerializable(WineFragment.ARG_WINE, bembibre);
  39. tabHost.addTab(tabHost.newTabSpec(bembibre.getName()).setIndicator(bembibre.getName()), WineryFragment.class, arguments);
  40.  
  41. //Adding the second tab
  42. arguments = new Bundle();
  43. arguments.putSerializable(WineFragment.ARG_WINE, vegaval);
  44. tabHost.addTab(tabHost.newTabSpec(vegaval.getName()).setIndicator(vegaval.getName()), WineryFragment.class, arguments);
  45.  
  46. return root;
  47. }
  48. }
  49.  
  50. package jhon.casique.baccus.controller.activity;
  51.  
  52. import android.support.v4.app.Fragment;
  53.  
  54. import jhon.casique.baccus.controller.fragments.WineryFragment;
  55.  
  56. public class WineryActivity extends FragmentContainerActivity {
  57. @Override
  58. protected Fragment createFragment() {
  59. return new WineryFragment();
  60. }
  61. }
  62.  
  63. tabHost.addTab(tabHost.newTabSpec(bembibre.getName()).setIndicator(bembibre.getName()), WineryFragment.class, arguments);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement