diff options
author | Vitaly Takmazov | 2016-04-08 16:22:07 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-04-08 16:23:15 +0300 |
commit | 80cd101bf9291cd9e8b1a883e3148ff95c445cc1 (patch) | |
tree | aa44e63c2b2a7a6e09d9b88a858d9a95fd7f693a /src/main/java | |
parent | d23e7fff4da9bbfd7ee85ff34c78de631d55c4a5 (diff) |
encapsulate some properties
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/Message.java | 18 | ||||
-rw-r--r-- | src/main/java/com/juick/User.java | 24 |
2 files changed, 33 insertions, 9 deletions
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java index 263a247d..c128b4f2 100644 --- a/src/main/java/com/juick/Message.java +++ b/src/main/java/com/juick/Message.java @@ -47,10 +47,10 @@ public class Message implements Comparable { public String Video = null; public Place Place = null; public int Likes = 0; - public boolean UserLike = false; + private boolean liked = false; public List<Message> childs = new ArrayList<>(); private Optional<PM> PM = Optional.empty(); - Optional<Recommendation> Recommendation = Optional.empty(); + private Optional<Recommendation> Recommendation = Optional.empty(); public Message() { } @@ -74,7 +74,7 @@ public class Message implements Comparable { Video = msg.Video; Place = msg.Place; Likes = msg.Likes; - UserLike = msg.UserLike; + setLiked(msg.isLiked()); childs = msg.childs; PM = msg.PM; Recommendation = msg.Recommendation; @@ -156,8 +156,8 @@ public class Message implements Comparable { public String getTagsString() { String ret = ""; if (!Tags.isEmpty()) { - for (int i = 0; i < Tags.size(); i++) { - ret += " *" + Tags.get(i); + for (String Tag : Tags) { + ret += " *" + Tag; } if (FriendsOnly) { ret += " *friends"; @@ -233,4 +233,12 @@ public class Message implements Comparable { public void setRecommendation(Recommendation recommendation) { this.Recommendation = Optional.ofNullable(recommendation); } + + public boolean isLiked() { + return liked; + } + + public void setLiked(boolean liked) { + this.liked = liked; + } } diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java index 40a3df96..13df2058 100644 --- a/src/main/java/com/juick/User.java +++ b/src/main/java/com/juick/User.java @@ -28,9 +28,9 @@ public class User { public Object Avatar = null; private String FullName = null; private String JID = null; - public int MessagesCount = 0; + private int unreadCount; private String AuthHash = null; - public boolean Banned = false; + private boolean banned = false; public User() { } @@ -41,9 +41,9 @@ public class User { Avatar = u.Avatar; setFullName(u.getFullName()); setJID(u.getJID()); - MessagesCount = u.MessagesCount; + setUnreadCount(u.getUnreadCount()); setAuthHash(u.getAuthHash()); - Banned = u.Banned; + setBanned(u.isBanned()); } @Override @@ -90,4 +90,20 @@ public class User { public void setAuthHash(String authHash) { AuthHash = authHash; } + + public int getUnreadCount() { + return unreadCount; + } + + public void setUnreadCount(int unreadCount) { + this.unreadCount = unreadCount; + } + + public boolean isBanned() { + return banned; + } + + public void setBanned(boolean banned) { + this.banned = banned; + } } |