public static String getPrettyDate(Date date) {
   if (isToday(date)) {
     return MyPlateApplication.getContext().getString(R.string.today);
   } else if (isYesterday(date)) {
     return MyPlateApplication.getContext().getString(R.string.yesterday);
   } else {
     return dateFormatter.format(date);
   }
 }
  @Override
  public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    // Diary entry item selected
    DiaryEntry clickedEntry = (DiaryEntry) this.adapter.getItem(position);

    MyPlateApplication.setWorkingDateStamp(this.selectedDate);
    int section = this.adapter.getSectionForPosition(position);
    switch (section) {
      case 0:
        MyPlateApplication.setWorkingTimeOfDay(TimeOfDay.BREAKFAST);
        break;
      case 1:
        MyPlateApplication.setWorkingTimeOfDay(TimeOfDay.LUNCH);
        break;
      case 2:
        MyPlateApplication.setWorkingTimeOfDay(TimeOfDay.DINNER);
        break;
      case 3:
        MyPlateApplication.setWorkingTimeOfDay(TimeOfDay.SNACKS);
        break;
    }

    if (clickedEntry instanceof FoodDiaryEntry) {
      FoodDiaryEntry diaryEntry = (FoodDiaryEntry) clickedEntry;
      Intent intent = new Intent(MyPlateApplication.getContext(), AddFoodActivity.class);
      intent.putExtra(FoodDiaryEntry.class.getName(), diaryEntry);
      startActivity(intent);
    } else if (clickedEntry instanceof ExerciseDiaryEntry) {
      ExerciseDiaryEntry diaryEntry = (ExerciseDiaryEntry) clickedEntry;
      Intent intent = new Intent(MyPlateApplication.getContext(), AddExerciseActivity.class);
      intent.putExtra(ExerciseDiaryEntry.class.getName(), diaryEntry);
      startActivity(intent);
    } else if (clickedEntry instanceof WaterDiaryEntry) {
      WaterDiaryEntry diaryEntry = (WaterDiaryEntry) clickedEntry;
      Intent intent = new Intent(MyPlateApplication.getContext(), AddWaterActivity.class);
      intent.putExtra(WaterDiaryEntry.class.getName(), diaryEntry);
      startActivity(intent);
    } else if (clickedEntry instanceof WeightDiaryEntry) {
      WeightDiaryEntry diaryEntry = (WeightDiaryEntry) clickedEntry;
      Intent intent = new Intent(MyPlateApplication.getContext(), AddWeightActivity.class);
      intent.putExtra(WeightDiaryEntry.class.getName(), diaryEntry);
      startActivity(intent);
    }
  }