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:
parent
acd21b1231
commit
f7cbfb38d9
4 changed files with 21 additions and 0 deletions
|
|
@ -28,6 +28,18 @@ public class CalendarUtil {
|
|||
+ calendar.get(Calendar.MILLISECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@
|
|||
<string name="never">Never</string>
|
||||
<string name="today">Today</string>
|
||||
<string name="this_week">This week</string>
|
||||
<string name="past_seven_days">Past 7 days</string>
|
||||
<string name="this_month">This month</string>
|
||||
<string name="past_three_months">Past 3 months</string>
|
||||
<string name="this_year">This year</string>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
<string-array name="pref_playlists_recently_played_interval_titles">
|
||||
<item>@string/today</item>
|
||||
<item>@string/this_week</item>
|
||||
<item>@string/past_seven_days</item>
|
||||
<item>@string/this_month</item>
|
||||
<item>@string/past_three_months</item>
|
||||
<item>@string/this_year</item>
|
||||
|
|
@ -35,6 +36,7 @@
|
|||
<string-array name="pref_playlists_recently_played_interval_values">
|
||||
<item>today</item>
|
||||
<item>this_week</item>
|
||||
<item>past_seven_days</item>
|
||||
<item>this_month</item>
|
||||
<item>past_three_months</item>
|
||||
<item>this_year</item>
|
||||
|
|
@ -43,6 +45,7 @@
|
|||
<string-array name="pref_playlists_last_added_interval_titles">
|
||||
<item>@string/today</item>
|
||||
<item>@string/this_week</item>
|
||||
<item>@string/past_seven_days</item>
|
||||
<item>@string/this_month</item>
|
||||
<item>@string/past_three_months</item>
|
||||
<item>@string/this_year</item>
|
||||
|
|
@ -51,6 +54,7 @@
|
|||
<string-array name="pref_playlists_last_added_interval_values">
|
||||
<item>today</item>
|
||||
<item>this_week</item>
|
||||
<item>past_seven_days</item>
|
||||
<item>this_month</item>
|
||||
<item>past_three_months</item>
|
||||
<item>this_year</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue