added "avatar" property to Note

This commit is contained in:
Aran Zaiger 2016-07-08 00:58:22 +03:00
parent ab578c792a
commit f042f9a46b
3 changed files with 14 additions and 2 deletions

View file

@ -16,13 +16,13 @@ public class Note implements Parcelable{
protected int likes; protected int likes;
protected ArrayList<String> tags; protected ArrayList<String> tags;
protected float lat, lon; protected float lat, lon;
protected String id, address, title, body, timestamp; protected String id, address, title, body, timestamp, avatar;
protected boolean isPublic; protected boolean isPublic;
public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic, int likes, ArrayList<String> tags) { public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic, int likes,String avatar, ArrayList<String> tags) {
this.id = id; this.id = id;
this.lat = lat; this.lat = lat;
this.lon = lon; this.lon = lon;
@ -34,18 +34,23 @@ public class Note implements Parcelable{
this.isPublic = isPublic; this.isPublic = isPublic;
this.likes = likes; this.likes = likes;
this.tags = tags; this.tags = tags;
this.avatar = avatar;
} }
protected Note(Parcel in) { protected Note(Parcel in) {
likes = in.readInt(); likes = in.readInt();
tags = in.createStringArrayList(); tags = in.createStringArrayList();
lat = in.readFloat(); lat = in.readFloat();
lon = in.readFloat(); lon = in.readFloat();
id = in.readString(); id = in.readString();
address = in.readString(); address = in.readString();
title = in.readString(); title = in.readString();
body = in.readString(); body = in.readString();
timestamp = in.readString(); timestamp = in.readString();
avatar = in.readString();
isPublic = in.readByte() != 0; isPublic = in.readByte() != 0;
} }
@ -72,6 +77,7 @@ public class Note implements Parcelable{
", body='" + body + '\'' + ", body='" + body + '\'' +
", timestamp=" + timestamp + ", timestamp=" + timestamp +
", isPublic=" + isPublic + ", isPublic=" + isPublic +
", avatar=" + avatar+
'}'; '}';
} }
@ -157,6 +163,9 @@ public class Note implements Parcelable{
public void setTags(ArrayList<String> tags) { public void setTags(ArrayList<String> tags) {
this.tags = tags; this.tags = tags;
} }
public String getAvatar() {return avatar;}
public void setAvatar(String avatar) {this.avatar = avatar; }
@Override @Override
public int describeContents() { public int describeContents() {
@ -174,6 +183,7 @@ public class Note implements Parcelable{
dest.writeString(title); dest.writeString(title);
dest.writeString(body); dest.writeString(body);
dest.writeString(timestamp); dest.writeString(timestamp);
dest.writeString(avatar);
dest.writeByte((byte) (isPublic ? 1 : 0)); dest.writeByte((byte) (isPublic ? 1 : 0));
} }

View file

@ -301,6 +301,7 @@ public class PersonalFragment extends Fragment {
time.toString(), time.toString(),
noteObject.getBoolean("is_public"), noteObject.getBoolean("is_public"),
noteObject.getInt("likes"), noteObject.getInt("likes"),
noteObject.getString("avatar"),
jsonArrayToStringArray(noteObject.getJSONArray("tags")) jsonArrayToStringArray(noteObject.getJSONArray("tags"))
); );
listOfNotes.add(addNote); listOfNotes.add(addNote);

View file

@ -85,6 +85,7 @@ public class Utils {
time.toString(), time.toString(),
noteObject.getBoolean("is_public"), noteObject.getBoolean("is_public"),
noteObject.getInt("likes"), noteObject.getInt("likes"),
noteObject.getString("avatar"),
jsonArrayToStringArray(noteObject.getJSONArray("tags")) jsonArrayToStringArray(noteObject.getJSONArray("tags"))
); );
return note; return note;