Skip to content

Instantly share code, notes, and snippets.

@jezinka
Created September 14, 2017 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jezinka/cea3c8b8bf08302a23903eb7dbbbef65 to your computer and use it in GitHub Desktop.
Save jezinka/cea3c8b8bf08302a23903eb7dbbbef65 to your computer and use it in GitHub Desktop.
private void fillList(boolean onlyEmpty) {
Calendar calendarInstance = Calendar.getInstance();
calendarInstance.setTime(TimeUtils.getWeekStartDate(new Date()));
List<Meal> meals = mealContract.getRandomMeals(dbHelper, getPlanLength());
for (Meal meal : meals) {
if (!onlyEmpty || dinnerAdapter.isDayEmpty(calendarInstance.getTime())) {
dinnerContract.insert(dbHelper, meal.getId(), calendarInstance.getTime());
}
calendarInstance.add(Calendar.DATE, 1);
}
dinnerAdapter.updateResults();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment