From f042f9a46ba102d3aa6079425605f3373f574036 Mon Sep 17 00:00:00 2001 From: Aran Zaiger Date: Fri, 8 Jul 2016 00:58:22 +0300 Subject: [PATCH] added "avatar" property to Note --- .../matan/ara/sagi/thesocialnotework/Note.java | 14 ++++++++++++-- .../sagi/thesocialnotework/PersonalFragment.java | 1 + .../matan/ara/sagi/thesocialnotework/Utils.java | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java index 34329fd..d18064b 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java @@ -16,13 +16,13 @@ public class Note implements Parcelable{ protected int likes; protected ArrayList tags; protected float lat, lon; - protected String id, address, title, body, timestamp; + protected String id, address, title, body, timestamp, avatar; protected boolean isPublic; - public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic, int likes, ArrayList tags) { + public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic, int likes,String avatar, ArrayList tags) { this.id = id; this.lat = lat; this.lon = lon; @@ -34,18 +34,23 @@ public class Note implements Parcelable{ this.isPublic = isPublic; this.likes = likes; this.tags = tags; + this.avatar = avatar; } + + protected Note(Parcel in) { likes = in.readInt(); tags = in.createStringArrayList(); lat = in.readFloat(); lon = in.readFloat(); + id = in.readString(); address = in.readString(); title = in.readString(); body = in.readString(); timestamp = in.readString(); + avatar = in.readString(); isPublic = in.readByte() != 0; } @@ -72,6 +77,7 @@ public class Note implements Parcelable{ ", body='" + body + '\'' + ", timestamp=" + timestamp + ", isPublic=" + isPublic + + ", avatar=" + avatar+ '}'; } @@ -157,6 +163,9 @@ public class Note implements Parcelable{ public void setTags(ArrayList tags) { this.tags = tags; } + public String getAvatar() {return avatar;} + + public void setAvatar(String avatar) {this.avatar = avatar; } @Override public int describeContents() { @@ -174,6 +183,7 @@ public class Note implements Parcelable{ dest.writeString(title); dest.writeString(body); dest.writeString(timestamp); + dest.writeString(avatar); dest.writeByte((byte) (isPublic ? 1 : 0)); } diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java index 49ef80d..1dacf2c 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java @@ -301,6 +301,7 @@ public class PersonalFragment extends Fragment { time.toString(), noteObject.getBoolean("is_public"), noteObject.getInt("likes"), + noteObject.getString("avatar"), jsonArrayToStringArray(noteObject.getJSONArray("tags")) ); listOfNotes.add(addNote); diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Utils.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Utils.java index 7d9d42d..4fa4af2 100644 --- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Utils.java +++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Utils.java @@ -85,6 +85,7 @@ public class Utils { time.toString(), noteObject.getBoolean("is_public"), noteObject.getInt("likes"), + noteObject.getString("avatar"), jsonArrayToStringArray(noteObject.getJSONArray("tags")) ); return note;