Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. public int getImageId() {
  2. return imageId;
  3. }
  4.  
  5. public void setImageId(int imageId) {
  6. this.imageId = imageId;
  7. }
  8.  
  9. public String getTitle() {
  10. return title;
  11. }
  12.  
  13. public void setTitle(String title) {
  14. this.title = title;
  15. }
  16.  
  17. public List<Product> getProductList() {
  18. //pseudo code to get product, replace your code to get real product here
  19. productList = new ArrayList<>();
  20. productList.add(new Product(R.drawable.ii1, " Story Name", "This is description 1"));
  21. productList.add(new Product(R.drawable.i2, "Story Name", "This is description 2"));
  22. productList.add(new Product(R.drawable.i3, "Story Name", "This is description 3"));
  23. productList.add(new Product(R.drawable.i4, "Story Name", "This is description 4"));
  24. productList.add(new Product(R.drawable.i5, "Story Name", "This is description 5"));
  25. productList.add(new Product(R.drawable.i6, "Story Name", "This is description 6"));
  26. productList.add(new Product(R.drawable.i8, "Story Name", "This is description 8"));
  27. productList.add(new Product(R.drawable.i9, "Story Name", "This is description 9"));
  28. productList.add(new Product(R.drawable.i10, "Story Name", "This is description 10"));
  29.  
  30. return productList;
  31. }
  32.  
  33. mToolbar = findViewById(R.id.toolbar);
  34. img = findViewById(R.id.imageView6);
  35. t=findViewById(R.id.textView4);
  36. Bundle bundle = getIntent().getExtras();
  37.  
  38. if (bundle != null) {
  39. mToolbar.setTitle(bundle.getString("title"));
  40.  
  41. if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  42. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.ii1));
  43. t.setText(bundle.getString("title"));
  44. }
  45.  
  46. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")){
  47. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i2));
  48.  
  49. }
  50.  
  51. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  52. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i3));
  53.  
  54. }
  55.  
  56. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  57. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i4));
  58.  
  59. }
  60.  
  61. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  62. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i5));
  63.  
  64. }
  65.  
  66. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  67. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i6));
  68.  
  69. }
  70.  
  71. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  72. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i8));
  73.  
  74. }
  75.  
  76. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  77. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i9));
  78.  
  79. }
  80.  
  81. else if (mToolbar.getTitle().toString().equalsIgnoreCase("Story Name")) {
  82. img .setImageDrawable(ContextCompat.getDrawable(SecondActivity.this, R.drawable.i10));
  83.  
  84. }
  85.  
  86.  
  87. }
  88. }
  89.  
  90. }
  91.  
  92. <ImageView
  93. android:id="@+id/imageView6"
  94. android:layout_width="160dp"
  95. android:layout_height="180dp"
  96. android:layout_marginLeft="13dp"
  97. android:layout_marginStart="13dp"
  98. android:layout_marginTop="60dp"
  99. app:srcCompat="@drawable/ii1"
  100. tools:ignore="ContentDescription"
  101. android:layout_below="@+id/appBarLayout"
  102. android:layout_alignParentLeft="true"
  103. android:layout_alignParentStart="true" />
  104.  
  105. <TextView
  106. android:id="@+id/textView4"
  107. android:layout_width="wrap_content"
  108. android:layout_height="wrap_content"
  109. android:layout_alignTop="@+id/imageView6"
  110. android:layout_marginLeft="15dp"
  111. android:layout_marginStart="15dp"
  112. android:layout_marginTop="22dp"
  113. android:layout_toRightOf="@+id/imageView6"
  114. android:textSize="14sp"
  115. tools:ignore="HardcodedText,RtlHardcoded" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement