AboutLayout.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.ivalentin.gm;
  2. import android.annotation.SuppressLint;
  3. import android.os.Bundle;
  4. import android.app.Fragment;
  5. import android.view.LayoutInflater;
  6. import android.view.View;
  7. import android.view.ViewGroup;
  8. import android.webkit.WebView;
  9. /**
  10. * Layout that show information about the app and the developer.
  11. * It's pretty much static.
  12. *
  13. * @see Fragment
  14. *
  15. * @author Iñigo Valentin
  16. *
  17. */
  18. public class AboutLayout extends Fragment{
  19. /**
  20. * Run when the fragment is inflated.
  21. * Assigns views, gets the date and does the first call to the {@link @populate function}.
  22. *
  23. * @param inflater A LayoutInflater to manage views
  24. * @param container The container View
  25. * @param savedInstanceState Bundle containing the state
  26. *
  27. * @return the fragment view
  28. *
  29. * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
  30. */
  31. @SuppressLint("InflateParams") //Throws unknown error when done properly.
  32. @Override
  33. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  34. //Load the layout.
  35. View view = inflater.inflate(R.layout.fragment_layout_about, null);
  36. //Set the title
  37. ((MainActivity) getActivity()).setSectionTitle(view.getContext().getString(R.string.menu_about));
  38. //Set some tricky webView to show some text .
  39. WebView wvCode = (WebView) view.findViewById(R.id.wv_about_code);
  40. wvCode.loadData(view.getContext().getString(R.string.about_code), "text/html", "UTF-8");
  41. //Return the view itself.
  42. return view;
  43. }
  44. }