added note ownerId
This commit is contained in:
parent
e9da6be78d
commit
db003f82d7
2 changed files with 310 additions and 291 deletions
|
@ -16,13 +16,11 @@ 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, avatar;
|
protected String id, address, title, body, timestamp, avatar, ownerId;
|
||||||
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, String avatar, String ownerId, 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;
|
||||||
|
@ -35,10 +33,10 @@ public class Note implements Parcelable{
|
||||||
this.likes = likes;
|
this.likes = likes;
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
|
this.ownerId = ownerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected Note(Parcel in) {
|
protected Note(Parcel in) {
|
||||||
likes = in.readInt();
|
likes = in.readInt();
|
||||||
tags = in.createStringArrayList();
|
tags = in.createStringArrayList();
|
||||||
|
@ -51,6 +49,7 @@ public class Note implements Parcelable{
|
||||||
body = in.readString();
|
body = in.readString();
|
||||||
timestamp = in.readString();
|
timestamp = in.readString();
|
||||||
avatar = in.readString();
|
avatar = in.readString();
|
||||||
|
ownerId = in.readString();
|
||||||
isPublic = in.readByte() != 0;
|
isPublic = in.readByte() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +65,21 @@ public class Note implements Parcelable{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Note{" +
|
return "Note{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", lat=" + lat +
|
", lat=" + lat +
|
||||||
", lon=" + lon +
|
", lon=" + lon +
|
||||||
|
|
||||||
", address='" + address + '\'' +
|
", address='" + address + '\'' +
|
||||||
", title='" + title + '\'' +
|
", title='" + title + '\'' +
|
||||||
", body='" + body + '\'' +
|
", body='" + body + '\'' +
|
||||||
", timestamp=" + timestamp +
|
", timestamp=" + timestamp +
|
||||||
", isPublic=" + isPublic +
|
", isPublic=" + isPublic +
|
||||||
", avatar=" + avatar +
|
", avatar=" + avatar +
|
||||||
|
", ownerId=" + ownerId +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +150,7 @@ public class Note implements Parcelable{
|
||||||
public String getLocationAndTime() {
|
public String getLocationAndTime() {
|
||||||
return getTimestamp() + " at " + getAddress();
|
return getTimestamp() + " at " + getAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLikes() {
|
public int getLikes() {
|
||||||
return likes;
|
return likes;
|
||||||
}
|
}
|
||||||
|
@ -163,9 +166,23 @@ 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; }
|
public String getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnerId() {
|
||||||
|
return ownerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnerId(String ownerId) {
|
||||||
|
this.ownerId = ownerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int describeContents() {
|
public int describeContents() {
|
||||||
|
@ -184,6 +201,7 @@ public class Note implements Parcelable{
|
||||||
dest.writeString(body);
|
dest.writeString(body);
|
||||||
dest.writeString(timestamp);
|
dest.writeString(timestamp);
|
||||||
dest.writeString(avatar);
|
dest.writeString(avatar);
|
||||||
|
dest.writeString(ownerId);
|
||||||
dest.writeByte((byte) (isPublic ? 1 : 0));
|
dest.writeByte((byte) (isPublic ? 1 : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,7 @@ public class PersonalFragment extends Fragment {
|
||||||
noteObject.getBoolean("is_public"),
|
noteObject.getBoolean("is_public"),
|
||||||
noteObject.getInt("likes"),
|
noteObject.getInt("likes"),
|
||||||
noteObject.getString("avatar"),
|
noteObject.getString("avatar"),
|
||||||
|
noteObject.getString("owner_id"),
|
||||||
jsonArrayToStringArray(noteObject.getJSONArray("tags"))
|
jsonArrayToStringArray(noteObject.getJSONArray("tags"))
|
||||||
);
|
);
|
||||||
listOfNotes.add(addNote);
|
listOfNotes.add(addNote);
|
||||||
|
|
Loading…
Reference in a new issue