// Path: app/src/main/java/org/nutritionfacts/dailydozen/util/DateUtil.java
// public class DateUtil {
//     public static Calendar getCalendarForYearMonthAndDay(final int year,
//                                                           final int monthOneBased,
//                                                           final int day) {
//         // We need to subtract one to convert the one-based month arg into a zero-based month
//         final Calendar cal = getCalendarForYearAndMonth(year, monthOneBased - 1);
//         cal.set(Calendar.DAY_OF_MONTH, day);
//         return cal;
//     }
// 
//     public static Calendar getCalendarForYearAndMonth(final int year, final int monthZeroBased) {
//         final Calendar cal = getCalendarForToday();
//         cal.set(Calendar.YEAR, year);
//         cal.set(Calendar.MONTH, monthZeroBased);
//         cal.set(Calendar.DAY_OF_MONTH, 1);
//         return cal;
//     }
// 
//     private static Calendar getCalendarForToday() {
//         final Calendar cal = Calendar.getInstance(Locale.getDefault());
//         cal.set(Calendar.HOUR_OF_DAY, 0);
//         cal.set(Calendar.MINUTE, 0);
//         cal.set(Calendar.SECOND, 0);
//         cal.set(Calendar.MILLISECOND, 0);
//         return cal;
//     }
// 
//     public static int getCurrentYear() {
//         return getYear(getCalendarForToday());
//     }
// 
//     public static int getYear(Calendar cal) {
//         return cal.get(Calendar.YEAR);
//     }
// 
//     private static int getMonthZeroBased(Calendar cal) {
//         return cal.get(Calendar.MONTH);
//     }
// 
//     public static int getMonthOneBased(Calendar cal) {
//         return getMonthZeroBased(cal) + 1;
//     }
// 
//     public static void addOneMonth(Calendar cal) {
//         cal.add(Calendar.MONTH, 1);
//     }
// 
//     public static void subtractTwoMonths(Calendar cal) {
//         cal.add(Calendar.MONTH, -2);
//     }
// 
//     public static String toStringYYYYMM(Calendar cal) {
//         return String.format("%s%s", getYear(cal), getMonthOneBased(cal));
//     }
// 
//     public static String getShortNameOfMonth(final int monthNumberOneBased) {
//         return new SimpleDateFormat("MMM", Locale.getDefault())
//                 .format(getCalendarForYearAndMonth(2016, monthNumberOneBased - 1).getTime());
//     }
// 
//     public static DateTime convertDateToDateTime(final Date date) {
//         return date != null ? DateTime.forInstant(date.getTime(), TimeZone.getDefault()) : null;
//     }
// 
//     public static Date convertDayToDate(final Day day) {
//         return day != null ? getCalendarForYearMonthAndDay(day.getYear(), day.getMonth(), day.getDayNumber()).getTime() : null;
//     }
// 
//     public static boolean is24HourTimeFormat(final Context context) {
//         return DateFormat.is24HourFormat(context);
//     }
// 
//     public static String formatTime(final Context context, int hourOfDay, int minute) {
//         if (is24HourTimeFormat(context)) {
//             return String.format(Locale.getDefault(), "%02d:%02d", hourOfDay, minute);
//         } else {
//             int hour = hourOfDay < 12 ? hourOfDay : hourOfDay % 12;
//             if (hour == 0) {
//                 hour = 12;
//             }
// 
//             return String.format(Locale.getDefault(), "%s:%02d %s", hour, minute, hourOfDay < 12 ? "AM" : "PM");
//         }
//     }
// }


import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.gson.annotations.SerializedName;
import org.nutritionfacts.dailydozen.util.DateUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import timber.log.Timber;
package org.nutritionfacts.dailydozen.model.pref;







public class UpdateReminderPref {
    // The default Update Reminder notification displays at 8pm
    @SerializedName("hourOfDay")
    private int hourOfDay = 20; // Default to 8pm
    @SerializedName("minute")
    private int minute = 0;
    @SerializedName("reminderTimes")
    private List<String> reminderTimes = new ArrayList<>();

    public void setHourOfDay(int hourOfDay) {
        this.hourOfDay = hourOfDay;
    }

    public int getHourOfDay() {
        return hourOfDay;
    }

    public void setMinute(int minute) {
        this.minute = minute;
    }

    public int getMinute() {
        return minute;
    }

    public void addReminderTime(Context context, int hourOfDay, int minute) {
        // Add new reminder to set to eliminate duplicates
        Set<String> reminderTimesSet = new HashSet<>(reminderTimes);
// Path: app/src/main/java/org/nutritionfacts/dailydozen/util/DateUtil.java
// public class DateUtil {
//     public static Calendar getCalendarForYearMonthAndDay(final int year,
//                                                           final int monthOneBased,
//                                                           final int day) {
//         // We need to subtract one to convert the one-based month arg into a zero-based month
//         final Calendar cal = getCalendarForYearAndMonth(year, monthOneBased - 1);
//         cal.set(Calendar.DAY_OF_MONTH, day);
//         return cal;
//     }
// 
//     public static Calendar getCalendarForYearAndMonth(final int year, final int monthZeroBased) {
//         final Calendar cal = getCalendarForToday();
//         cal.set(Calendar.YEAR, year);
//         cal.set(Calendar.MONTH, monthZeroBased);
//         cal.set(Calendar.DAY_OF_MONTH, 1);
//         return cal;
//     }
// 
//     private static Calendar getCalendarForToday() {
//         final Calendar cal = Calendar.getInstance(Locale.getDefault());
//         cal.set(Calendar.HOUR_OF_DAY, 0);
//         cal.set(Calendar.MINUTE, 0);
//         cal.set(Calendar.SECOND, 0);
//         cal.set(Calendar.MILLISECOND, 0);
//         return cal;
//     }
// 
//     public static int getCurrentYear() {
//         return getYear(getCalendarForToday());
//     }
// 
//     public static int getYear(Calendar cal) {
//         return cal.get(Calendar.YEAR);
//     }
// 
//     private static int getMonthZeroBased(Calendar cal) {
//         return cal.get(Calendar.MONTH);
//     }
// 
//     public static int getMonthOneBased(Calendar cal) {
//         return getMonthZeroBased(cal) + 1;
//     }
// 
//     public static void addOneMonth(Calendar cal) {
//         cal.add(Calendar.MONTH, 1);
//     }
// 
//     public static void subtractTwoMonths(Calendar cal) {
//         cal.add(Calendar.MONTH, -2);
//     }
// 
//     public static String toStringYYYYMM(Calendar cal) {
//         return String.format("%s%s", getYear(cal), getMonthOneBased(cal));
//     }
// 
//     public static String getShortNameOfMonth(final int monthNumberOneBased) {
//         return new SimpleDateFormat("MMM", Locale.getDefault())
//                 .format(getCalendarForYearAndMonth(2016, monthNumberOneBased - 1).getTime());
//     }
// 
//     public static DateTime convertDateToDateTime(final Date date) {
//         return date != null ? DateTime.forInstant(date.getTime(), TimeZone.getDefault()) : null;
//     }
// 
//     public static Date convertDayToDate(final Day day) {
//         return day != null ? getCalendarForYearMonthAndDay(day.getYear(), day.getMonth(), day.getDayNumber()).getTime() : null;
//     }
// 
//     public static boolean is24HourTimeFormat(final Context context) {
//         return DateFormat.is24HourFormat(context);
//     }
// 
//     public static String formatTime(final Context context, int hourOfDay, int minute) {
//         if (is24HourTimeFormat(context)) {
//             return String.format(Locale.getDefault(), "%02d:%02d", hourOfDay, minute);
//         } else {
//             int hour = hourOfDay < 12 ? hourOfDay : hourOfDay % 12;
//             if (hour == 0) {
//                 hour = 12;
//             }
// 
//             return String.format(Locale.getDefault(), "%s:%02d %s", hour, minute, hourOfDay < 12 ? "AM" : "PM");
//         }
//     }
// }


// Path: app/src/main/java/org/nutritionfacts/dailydozen/model/pref/UpdateReminderPref.java
import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.gson.annotations.SerializedName;
import org.nutritionfacts.dailydozen.util.DateUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import timber.log.Timber;

package org.nutritionfacts.dailydozen.model.pref;







public class UpdateReminderPref {
    // The default Update Reminder notification displays at 8pm
    @SerializedName("hourOfDay")
    private int hourOfDay = 20; // Default to 8pm
    @SerializedName("minute")
    private int minute = 0;
    @SerializedName("reminderTimes")
    private List<String> reminderTimes = new ArrayList<>();

    public void setHourOfDay(int hourOfDay) {
        this.hourOfDay = hourOfDay;
    }

    public int getHourOfDay() {
        return hourOfDay;
    }

    public void setMinute(int minute) {
        this.minute = minute;
    }

    public int getMinute() {
        return minute;
    }

    public void addReminderTime(Context context, int hourOfDay, int minute) {
        // Add new reminder to set to eliminate duplicates
        Set<String> reminderTimesSet = new HashSet<>(reminderTimes);
        reminderTimesSet.add(DateUtil.formatTime(context, hourOfDay, minute));