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(){
|
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, 0);
|
||||||
return getLong(KEY_NEWS_LAST_READ, Game.realTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Window management (desktop only atm)
|
//Window management (desktop only atm)
|
||||||
|
|
|
@ -266,7 +266,10 @@ public class NewsScene extends PixelScene {
|
||||||
this.article = article;
|
this.article = article;
|
||||||
|
|
||||||
icon(News.parseArticleIcon(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();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTime(article.date);
|
cal.setTime(article.date);
|
||||||
|
|
|
@ -228,12 +228,19 @@ public class TitleScene extends PixelScene {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
if (unreadCount == -1 && News.articlesAvailable()){
|
if (unreadCount == -1 && News.articlesAvailable()){
|
||||||
|
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()));
|
unreadCount = News.unreadArticles(new Date(SPDSettings.newsLastRead()));
|
||||||
if (unreadCount > 0){
|
if (unreadCount > 0) {
|
||||||
unreadCount = Math.min(unreadCount, 9);
|
unreadCount = Math.min(unreadCount, 9);
|
||||||
text(text() + "(" + unreadCount + ")");
|
text(text() + "(" + unreadCount + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (unreadCount > 0){
|
if (unreadCount > 0){
|
||||||
textColor(ColorMath.interpolate( 0xFFFFFF, Window.SHPX_COLOR, 0.5f + (float)Math.sin(Game.timeTotal*5)/2f));
|
textColor(ColorMath.interpolate( 0xFFFFFF, Window.SHPX_COLOR, 0.5f + (float)Math.sin(Game.timeTotal*5)/2f));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user