From ab8ee7060ccef64595d545f72c3ae8bf584d3f5c Mon Sep 17 00:00:00 2001 From: Ezerous Date: Wed, 6 Mar 2019 13:43:41 +0200 Subject: [PATCH] RecentItem fix --- .../gr/thmmy/mthmmy/model/RecentItem.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/model/RecentItem.java b/app/src/main/java/gr/thmmy/mthmmy/model/RecentItem.java index 4baf0b42..4221566a 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/model/RecentItem.java +++ b/app/src/main/java/gr/thmmy/mthmmy/model/RecentItem.java @@ -1,27 +1,22 @@ package gr.thmmy.mthmmy.model; import java.util.Date; -import java.util.HashMap; +import java.util.Map; public class RecentItem { private int boardId, postId, topicId, posterId; private String boardTitle, topicTitle, poster; private Date timestamp; - public RecentItem(int boardId, String boardTitle, int postId, String poster, int posterId, int timestamp, - int topicId, String topicTitle) { - this.boardId = boardId; - this.postId = postId; - this.poster = poster; - this.posterId = posterId; - this.topicId = topicId; - this.boardTitle = boardTitle; - this.topicTitle = topicTitle; - this.timestamp = new Date(timestamp); - } - - public RecentItem(HashMap keymap) { - + public RecentItem(Map map) { + this.boardId = ((Long) map.get("boardId")).intValue(); + this.postId = ((Long) map.get("postId")).intValue(); + this.poster = String.valueOf(map.get("poster")); + this.posterId = ((Long) map.get("posterId")).intValue(); + this.topicId = ((Long) map.get("topicId")).intValue(); + this.boardTitle = String.valueOf(map.get("boardTitle")); + this.topicTitle = String.valueOf(map.get("topicTitle")); + this.timestamp = new Date((long)(map.get("timestamp")) * 1000); } public Date getTimestamp() {