Apostolos Fanakis
6 years ago
15 changed files with 412 additions and 89 deletions
@ -0,0 +1,88 @@ |
|||||
|
package gr.auth.databases.flavours.model; |
||||
|
|
||||
|
import android.os.Parcel; |
||||
|
import android.os.Parcelable; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
|
||||
|
public class Profile implements Parcelable { |
||||
|
private int id, age, reviewsNumber; |
||||
|
private String username, email; |
||||
|
private ArrayList<RestaurantSummary> restaurantsOwned; |
||||
|
private ArrayList<DietSummary> dietsFollowed; |
||||
|
|
||||
|
public Profile(int id, int age, int reviewsNumber, String username, String email, |
||||
|
ArrayList<RestaurantSummary> restaurantsOwned, ArrayList<DietSummary> dietsFollowed) { |
||||
|
this.id = id; |
||||
|
this.age = age; |
||||
|
this.reviewsNumber = reviewsNumber; |
||||
|
this.username = username; |
||||
|
this.email = email; |
||||
|
this.restaurantsOwned = restaurantsOwned; |
||||
|
this.dietsFollowed = dietsFollowed; |
||||
|
} |
||||
|
|
||||
|
public int getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public int getAge() { |
||||
|
return age; |
||||
|
} |
||||
|
|
||||
|
public int getReviewsNumber() { |
||||
|
return reviewsNumber; |
||||
|
} |
||||
|
|
||||
|
public String getUsername() { |
||||
|
return username; |
||||
|
} |
||||
|
|
||||
|
public String getEmail() { |
||||
|
return email; |
||||
|
} |
||||
|
|
||||
|
public ArrayList<RestaurantSummary> getRestaurantsOwned() { |
||||
|
return restaurantsOwned; |
||||
|
} |
||||
|
|
||||
|
public ArrayList<DietSummary> getDietsFollowed() { |
||||
|
return dietsFollowed; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int describeContents() { |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void writeToParcel(Parcel out, int flags) { |
||||
|
out.writeInt(id); |
||||
|
out.writeInt(age); |
||||
|
out.writeInt(reviewsNumber); |
||||
|
out.writeString(username); |
||||
|
out.writeString(email); |
||||
|
out.writeList(restaurantsOwned); |
||||
|
out.writeList(dietsFollowed); |
||||
|
} |
||||
|
|
||||
|
public static final Parcelable.Creator<Profile> CREATOR = new Parcelable.Creator<Profile>() { |
||||
|
public Profile createFromParcel(Parcel in) { |
||||
|
return new Profile(in); |
||||
|
} |
||||
|
|
||||
|
public Profile[] newArray(int size) { |
||||
|
return new Profile[size]; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
private Profile(Parcel in) { |
||||
|
id = in.readInt(); |
||||
|
age = in.readInt(); |
||||
|
reviewsNumber = in.readInt(); |
||||
|
username = in.readString(); |
||||
|
email = in.readString(); |
||||
|
restaurantsOwned = (ArrayList<RestaurantSummary>) in.readArrayList(DietRatingPair.class.getClassLoader()); |
||||
|
dietsFollowed = (ArrayList<DietSummary>) in.readArrayList(DietRatingPair.class.getClassLoader()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package gr.auth.databases.flavours.model; |
||||
|
|
||||
|
import android.os.Parcel; |
||||
|
import android.os.Parcelable; |
||||
|
|
||||
|
public class RestaurantSummary implements Parcelable { |
||||
|
private int id; |
||||
|
private String name; |
||||
|
|
||||
|
public RestaurantSummary(int id, String name) { |
||||
|
this.id = id; |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public int getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int describeContents() { |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void writeToParcel(Parcel out, int flags) { |
||||
|
out.writeInt(id); |
||||
|
out.writeString(name); |
||||
|
} |
||||
|
|
||||
|
public static final Parcelable.Creator<RestaurantSummary> CREATOR = new Parcelable.Creator<RestaurantSummary>() { |
||||
|
public RestaurantSummary createFromParcel(Parcel in) { |
||||
|
return new RestaurantSummary(in); |
||||
|
} |
||||
|
|
||||
|
public RestaurantSummary[] newArray(int size) { |
||||
|
return new RestaurantSummary[size]; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
private RestaurantSummary(Parcel in) { |
||||
|
id = in.readInt(); |
||||
|
name = in.readString(); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue