Advertisement
minafaw3

Tutorial_Fragment

Oct 11th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. package com.imaadv.leaynik.test;
  2.  
  3.  
  4. import android.support.v4.app.Fragment;
  5. import android.support.v4.app.FragmentManager;
  6. import android.support.v4.app.FragmentPagerAdapter;
  7.  
  8. import com.viewpagerindicator.IconPagerAdapter;
  9.  
  10. class Tutorial_Fragment extends FragmentPagerAdapter implements
  11. IconPagerAdapter {
  12. protected static final String[] CONTENT = new String[] { "This", "Is", "s" };
  13. private int mCount = CONTENT.length;
  14. private String Content;
  15. private String TestName;
  16.  
  17. public Tutorial_Fragment(FragmentManager fm, String Content, String TestName) {
  18. super(fm);
  19. this.Content = Content;
  20. this.TestName = TestName;
  21. }
  22.  
  23. @Override
  24. public Fragment getItem(int position) {
  25. switch (position) {
  26. // case 0:
  27. // return TestDefntion.newInstance(CONTENT[0], Content);
  28.  
  29. case 0:
  30. return Aye_distance.newInstance(CONTENT[0]);
  31. case 1:
  32. return Close_aye.newInstance(CONTENT[1]);
  33. case 2:
  34. if (TestName.contentEquals("astigmatism")) {
  35. return testone_Image.newInstance(CONTENT[2]);
  36. } else if (TestName.contentEquals("visionacuty")) {
  37. return test2_Image.newInstance(CONTENT[2]);
  38. } else if (TestName.contentEquals("consens")) {
  39. return test3_Image.newInstance(CONTENT[2]);
  40. } else if (TestName.contentEquals("blind")) {
  41. return test4_Image.newInstance(CONTENT[2]);
  42. } else if (TestName.contentEquals("red")) {
  43. return test5_Image.newInstance(CONTENT[2]);
  44. } else if (TestName.contentEquals("central")) {
  45. return test6_Image.newInstance(CONTENT[2]);
  46. }
  47. return Test_Image.newInstance(CONTENT[3], TestName);
  48.  
  49. default:
  50. return Aye_distance.newInstance(CONTENT[0]);
  51.  
  52. }
  53. }
  54.  
  55. @Override
  56. public int getCount() {
  57. return mCount;
  58. }
  59.  
  60. @Override
  61. public CharSequence getPageTitle(int position) {
  62. return Visual_aquity_TestFragmentAdapter.CONTENT[position
  63. % CONTENT.length];
  64. }
  65.  
  66. @Override
  67. public int getIconResId(int index) {
  68. return 0;
  69. }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement