Skip to content

Commit

Permalink
Fix times in message list
Browse files Browse the repository at this point in the history
The Date object stores a UTC timestamp. It will automatically be converted to the correct local time.

Fixes Pushjet#27
  • Loading branch information
mrtnmtth committed Jan 30, 2018
1 parent 3bb40aa commit b44f0d2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/io/Pushjet/api/PushListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
if (title.equals(""))
title = entries.get(position).getService().getName();
String description = entries.get(position).getMessage();
Date pushDate = entries.get(position).getLocalTimestamp();
Date pushDate = entries.get(position).getTimestamp();
Bitmap icon = entries.get(position).getService().getIconBitmapOrDefault(context);

dateText.setText(this.df.format(pushDate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}

public Date getLocalTimestamp() {
return new Date(timestamp.getTime() + TimeZone.getDefault().getOffset(System.currentTimeMillis()));
}

public String getTitleOrName() {
String ret = title;
if (ret.equals(""))
Expand Down

0 comments on commit b44f0d2

Please sign in to comment.