Skip to content

Commit e01d2ff

Browse files
committed
Merge branch 'hugomg-bug-172'
2 parents 45c0fb8 + 17d3b6b commit e01d2ff

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

app/src/main/java/cz/martykan/forecastie/activities/MainActivity.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,20 @@ public ParseResult parseLongTermJson(String result) {
606606
weather.setIcon(setWeatherIcon(Integer.parseInt(idString), cal.get(Calendar.HOUR_OF_DAY)));
607607

608608
Calendar today = Calendar.getInstance();
609-
if (cal.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR)) {
609+
today.set(Calendar.HOUR_OF_DAY, 0);
610+
today.set(Calendar.MINUTE, 0);
611+
today.set(Calendar.SECOND, 0);
612+
today.set(Calendar.MILISECOND, 0);
613+
614+
Calendar tomorrow = today.clone();
615+
tomorrow.add(Calendar.DAY_OF_YEAR, 1);
616+
617+
Calendar.later = today.clone();
618+
tomorrow.add(Calendar.DAY_OF_YEAR, 2);
619+
620+
if (cal.before(tomorrow)) {
610621
longTermTodayWeather.add(weather);
611-
} else if (cal.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR) + 1) {
622+
} else if (cal.before(later)) {
612623
longTermTomorrowWeather.add(weather);
613624
} else {
614625
longTermWeather.add(weather);

0 commit comments

Comments
 (0)