Guest User

Untitled

a guest
Jun 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. //nothing changed here
  2.  
  3. package com.example.mariakovaleva.dortmundtourguide;
  4.  
  5. import android.os.Parcel;
  6. import android.os.Parcelable;
  7. import android.renderscript.Sampler;
  8.  
  9. import java.util.ArrayList;
  10.  
  11. public class Place implements Parcelable {
  12.  
  13. private static final int NO_IMAGE_PROVIDED = -1;
  14.  
  15. private int mImageResourceId = NO_IMAGE_PROVIDED;
  16. private int mTitleTextId;
  17. private int mContentTextId;
  18. private ArrayList<Place> place1 = new ArrayList<>();
  19. private ArrayList<Place> place2 = new ArrayList<>();
  20. private ArrayList<Place> place3 = new ArrayList<>();
  21.  
  22. public Place(int imageResourceId, int titleTextId, int contentTextId) {
  23. mImageResourceId = imageResourceId;
  24. mTitleTextId = titleTextId;
  25. mContentTextId = contentTextId;
  26. }
  27.  
  28. public Place(int titleTextId, int contentTextId) {
  29. mTitleTextId = titleTextId;
  30. mContentTextId = contentTextId;
  31. }
  32.  
  33. public Place (Parcel in) {
  34. super();
  35. readFromParcel(in);
  36. }
  37.  
  38. public static final Parcelable.Creator<ArrayList<ArrayList<Place>>> CREATOR = new Parcelable.Creator<ArrayList<ArrayList<Place>>>() {
  39. @Override
  40. public ArrayList<ArrayList<Place>> createFromParcel(Parcel in) {
  41. //cannot resolve constructor
  42. return new ArrayList<ArrayList<Place>>(in);
  43. }
  44.  
  45. @Override
  46. //attemting to use incompatible return type
  47. public ArrayList<ArrayList<Place>> newArray(int size) {
  48. return newArray[size];
  49. }
  50. };
  51.  
  52. public void readFromParcel(Parcel in) {
  53. place1 = in.readArrayList(ClassLoader.getSystemClassLoader());
  54. place2 = in.readArrayList(ClassLoader.getSystemClassLoader());
  55. place3 = in.readArrayList(ClassLoader.getSystemClassLoader());
  56. }
  57.  
  58. @Override
  59. public int describeContents() {
  60. return 0;
  61. }
  62.  
  63. @Override
  64. public void writeToParcel(Parcel dest, int flags) {
  65. dest.writeTypedList(place1);
  66. dest.writeTypedList(place2);
  67. dest.writeTypedList(place3);
  68. }
  69.  
  70. public int getImageResourceId() {
  71. return mImageResourceId;
  72. }
  73.  
  74. public int getTitleTextId() {
  75. return mTitleTextId;
  76. }
  77.  
  78. public int getContentTextId() {
  79. return mContentTextId;
  80. }
  81.  
  82. public boolean hasImage() {
  83. return mImageResourceId != NO_IMAGE_PROVIDED;
  84. }
  85. }
Add Comment
Please, Sign In to add comment