v0.8.2a: tweaked logic for news last read time
This commit is contained in:
parent
a78df087f6
commit
605c4a5577
|
@ -302,8 +302,7 @@ public class SPDSettings extends GameSettings {
|
|||
}
|
||||
|
||||
public static long newsLastRead(){
|
||||
//returns the current time when none is stored, so historical news isn't seen as unread
|
||||
return getLong(KEY_NEWS_LAST_READ, Game.realTime);
|
||||
return getLong(KEY_NEWS_LAST_READ, 0);
|
||||
}
|
||||
|
||||
//Window management (desktop only atm)
|
||||
|
|
|
@ -266,7 +266,10 @@ public class NewsScene extends PixelScene {
|
|||
this.article = article;
|
||||
|
||||
icon(News.parseArticleIcon(article));
|
||||
if (article.date.getTime() > SPDSettings.newsLastRead()) textColor(Window.SHPX_COLOR);
|
||||
long lastRead = SPDSettings.newsLastRead();
|
||||
if (lastRead > 0 && article.date.getTime() > lastRead) {
|
||||
textColor(Window.SHPX_COLOR);
|
||||
}
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(article.date);
|
||||
|
|
|
@ -228,10 +228,17 @@ public class TitleScene extends PixelScene {
|
|||
super.update();
|
||||
|
||||
if (unreadCount == -1 && News.articlesAvailable()){
|
||||
unreadCount = News.unreadArticles(new Date(SPDSettings.newsLastRead()));
|
||||
if (unreadCount > 0){
|
||||
unreadCount = Math.min(unreadCount, 9);
|
||||
text(text() + "(" + unreadCount + ")");
|
||||
long lastRead = SPDSettings.newsLastRead();
|
||||
if (lastRead == 0){
|
||||
if (News.articles().get(0) != null) {
|
||||
SPDSettings.newsLastRead(News.articles().get(0).date.getTime());
|
||||
}
|
||||
} else {
|
||||
unreadCount = News.unreadArticles(new Date(SPDSettings.newsLastRead()));
|
||||
if (unreadCount > 0) {
|
||||
unreadCount = Math.min(unreadCount, 9);
|
||||
text(text() + "(" + unreadCount + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user