Add choice of 7 days to settings for dynamic playlists (#616)

* Add choice of N days to settings for dynamic playlists (#3)

* Code review
This commit is contained in:
soncaokim 2018-12-03 22:45:47 +01:00 committed by Eugene
commit f7cbfb38d9
4 changed files with 21 additions and 0 deletions

View file

@ -29,6 +29,18 @@ public class CalendarUtil {
}
/**
* Returns the time elapsed so far last N days in milliseconds.
*
* @return Time elapsed since N days in milliseconds.
*/
public long getElapsedDays(int numDays) {
long elapsed = getElapsedToday();
elapsed += numDays * MS_PER_DAY;
return elapsed;
}
/**
* Returns the time elapsed so far this week in milliseconds.
*
* @return Time elapsed this week in milliseconds.

View file

@ -290,6 +290,10 @@ public final class PreferenceUtil {
interval = calendarUtil.getElapsedWeek();
break;
case "past_seven_days":
interval = calendarUtil.getElapsedDays(7);
break;
case "past_three_months":
interval = calendarUtil.getElapsedMonths(3);
break;