Java Code Examples for com.eveningoutpost.dexdrip.UtilityModels.Constants#WEEK_IN_MS
The following examples show how to use
com.eveningoutpost.dexdrip.UtilityModels.Constants#WEEK_IN_MS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Reminders.java From xDrip with GNU General Public License v3.0 | 6 votes |
private long getPeriod(RadioButton rbday, RadioButton rbhour, RadioButton rbweek) { long period; try { period = Integer.parseInt(reminderDaysEdt.getText().toString()); } catch (NumberFormatException e) { period = 1; // TODO avoid this happening from the UI try { reminderDaysEdt.setText("" + period); } catch (Exception ee) { // } } if (rbday.isChecked()) { period = period * Constants.DAY_IN_MS; } else if (rbhour.isChecked()) { period = period * Constants.HOUR_IN_MS; } else if (rbweek.isChecked()) { period = period * Constants.WEEK_IN_MS; } return period; }
Example 2
Source File: Reminders.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private long getPeriod(RadioButton rbday, RadioButton rbhour, RadioButton rbweek) { long period; try { period = Integer.parseInt(reminderDaysEdt.getText().toString()); } catch (NumberFormatException e) { period = 1; // TODO avoid this happening from the UI try { reminderDaysEdt.setText("" + period); } catch (Exception ee) { // } } if (rbday.isChecked()) { period = period * Constants.DAY_IN_MS; } else if (rbhour.isChecked()) { period = period * Constants.HOUR_IN_MS; } else if (rbweek.isChecked()) { period = period * Constants.WEEK_IN_MS; } return period; }
Example 3
Source File: JoH.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static String niceTimeScalarNatural(long t) { if (t > 3000000) t = t + 10000; // round up by 10 seconds if nearly an hour if ((t > Constants.DAY_IN_MS) && (t < Constants.WEEK_IN_MS * 2)) { final SimpleDateFormat df = new SimpleDateFormat("EEEE", Locale.getDefault()); final String day = df.format(new Date(JoH.tsl() + t)); return ((t > Constants.WEEK_IN_MS) ? "next " : "") + day; } else { return niceTimeScalar(t); } }
Example 4
Source File: JoH.java From xDrip with GNU General Public License v3.0 | 5 votes |
public static String niceTimeScalarNatural(long t) { if (t > 3000000) t = t + 10000; // round up by 10 seconds if nearly an hour if ((t > Constants.DAY_IN_MS) && (t < Constants.WEEK_IN_MS * 2)) { final SimpleDateFormat df = new SimpleDateFormat("EEEE", Locale.getDefault()); final String day = df.format(new Date(JoH.tsl() + t)); return ((t > Constants.WEEK_IN_MS) ? "next " : "") + day; } else { return niceTimeScalar(t); } }
Example 5
Source File: Reminders.java From xDrip with GNU General Public License v3.0 | 5 votes |
public void snoozeAdjust(View v) { final String button_text = ((Button) v).getTag().toString(); //changed String to Tag, to make the texts translateable Log.d(TAG, "Snooze adjust button: " + button_text); long multiplier = Constants.MINUTE_IN_MS; final String[] button_textA = button_text.split(" "); switch (button_textA[1].toLowerCase()) { case "hour": case "hours": multiplier = Constants.HOUR_IN_MS; break; case "day": case "days": multiplier = Constants.DAY_IN_MS; break; case "week": case "weeks": multiplier = Constants.WEEK_IN_MS; break; } final long snooze_adjust = Integer.parseInt(button_textA[0]) * multiplier; Log.d(TAG, "Snoozed adjust button result: " + snooze_adjust); dismissItem(last_swiped); snoozeReminder(last_swiped, snooze_adjust); reinject(last_swiped); }
Example 6
Source File: JoH.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static String niceTimeScalarNatural(long t) { if (t > 3000000) t = t + 10000; // round up by 10 seconds if nearly an hour if ((t > Constants.DAY_IN_MS) && (t < Constants.WEEK_IN_MS * 2)) { final SimpleDateFormat df = new SimpleDateFormat("EEEE", Locale.getDefault()); final String day = df.format(new Date(JoH.tsl() + t)); return ((t > Constants.WEEK_IN_MS) ? "next " : "") + day; } else { return niceTimeScalar(t); } }
Example 7
Source File: JoH.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public static String niceTimeScalarNatural(long t) { if (t > 3000000) t = t + 10000; // round up by 10 seconds if nearly an hour if ((t > Constants.DAY_IN_MS) && (t < Constants.WEEK_IN_MS * 2)) { final SimpleDateFormat df = new SimpleDateFormat("EEEE", Locale.getDefault()); final String day = df.format(new Date(JoH.tsl() + t)); return ((t > Constants.WEEK_IN_MS) ? "next " : "") + day; } else { return niceTimeScalar(t); } }
Example 8
Source File: Reminders.java From xDrip-plus with GNU General Public License v3.0 | 5 votes |
public void snoozeAdjust(View v) { final String button_text = ((Button) v).getTag().toString(); //changed String to Tag, to make the texts translateable Log.d(TAG, "Snooze adjust button: " + button_text); long multiplier = Constants.MINUTE_IN_MS; final String[] button_textA = button_text.split(" "); switch (button_textA[1].toLowerCase()) { case "hour": case "hours": multiplier = Constants.HOUR_IN_MS; break; case "day": case "days": multiplier = Constants.DAY_IN_MS; break; case "week": case "weeks": multiplier = Constants.WEEK_IN_MS; break; } final long snooze_adjust = Integer.parseInt(button_textA[0]) * multiplier; Log.d(TAG, "Snoozed adjust button result: " + snooze_adjust); dismissItem(last_swiped); snoozeReminder(last_swiped, snooze_adjust); reinject(last_swiped); }
Example 9
Source File: Reminder.java From xDrip with GNU General Public License v3.0 | 4 votes |
public boolean isDaysPeriod() { return (period >= Constants.DAY_IN_MS) && (period < (Constants.WEEK_IN_MS * 2)); }
Example 10
Source File: Reminder.java From xDrip with GNU General Public License v3.0 | 4 votes |
public boolean isWeeksPeriod() { return (period >= (2 * Constants.WEEK_IN_MS)); }
Example 11
Source File: Reminder.java From xDrip with GNU General Public License v3.0 | 4 votes |
public long periodInUnits() { if (isDaysPeriod()) return period / Constants.DAY_IN_MS; if (isHoursPeriod()) return period / Constants.HOUR_IN_MS; if (isWeeksPeriod()) return period / Constants.WEEK_IN_MS; return -1; // ERROR }
Example 12
Source File: Reminder.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public boolean isDaysPeriod() { return (period >= Constants.DAY_IN_MS) && (period < (Constants.WEEK_IN_MS * 2)); }
Example 13
Source File: Reminder.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public boolean isWeeksPeriod() { return (period >= (2 * Constants.WEEK_IN_MS)); }
Example 14
Source File: Reminder.java From xDrip-plus with GNU General Public License v3.0 | 4 votes |
public long periodInUnits() { if (isDaysPeriod()) return period / Constants.DAY_IN_MS; if (isHoursPeriod()) return period / Constants.HOUR_IN_MS; if (isWeeksPeriod()) return period / Constants.WEEK_IN_MS; return -1; // ERROR }